V17.0.0.20220210_2__reference_genome_file.sql 915 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
alter table reference_genome_table add column file_id integer;

ALTER TABLE reference_genome_table
    ADD CONSTRAINT reference_genome_table_file_fk FOREIGN KEY (file_id) REFERENCES public.file_entry_table(id)
    ON DELETE SET NULL;

update reference_genome_table set file_id = 
select id from file_entry_table where 
  file_entry_table.url=reference_genome_table.source_url and 
  file_entry_table.download_progress>90; 

alter table reference_genome_gene_mapping_table add column file_id integer;

ALTER TABLE reference_genome_gene_mapping_table
    ADD CONSTRAINT reference_genome_gene_mapping_table_file_fk FOREIGN KEY (file_id) REFERENCES public.file_entry_table(id)
    ON DELETE SET NULL;

update reference_genome_gene_mapping_table set file_id = 
select id from file_entry_table where 
  file_entry_table.url=reference_genome_gene_mapping_table.source_url and 
  file_entry_table.download_progress>90;