Skip to content

Commit 4c2ea55

Browse files
committed
add migration
1 parent a8faf13 commit 4c2ea55

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

create_db.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ psql --quiet -h "$db" -U $PGUSER -d genomic -a -f data/pr_315.sql >>setup_out.tx
4444
psql --quiet -h "$db" -U $PGUSER -d genomic -a -f data/pr_339.sql >>setup_out.txt
4545
psql --quiet -h "$db" -U $PGUSER -d genomic -a -f data/pr_341.sql >>setup_out.txt
4646
psql --quiet -h "$db" -U $PGUSER -d genomic -a -f data/pr_352.sql >>setup_out.txt
47+
psql --quiet -h "$db" -U $PGUSER -d genomic -a -f data/pf_374.sql >>setup_out.txt
4748
echo "...done"

data/pr_374.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO
2+
$$
3+
BEGIN
4+
-- remove the old primary key on the serial id and make a composite pkey on
5+
-- contig_id + pos_bucket_id
6+
ALTER TABLE pos_bucket_variantfile_association DROP CONSTRAINT pos_bucket_variantfile_association_pos_bucket_id_fkey;
7+
ALTER TABLE pos_bucket DROP CONSTRAINT pos_bucket_pkey;
8+
ALTER TABLE pos_bucket ADD CONSTRAINT pos_bucket_unique UNIQUE (id);
9+
ALTER TABLE pos_bucket ALTER COLUMN id SET NOT NULL;
10+
ALTER TABLE pos_bucket ADD CONSTRAINT pos_bucket_pkey PRIMARY KEY (contig_id, pos_bucket_id);
11+
ALTER TABLE pos_bucket_variantfile_association ADD CONSTRAINT pos_bucket_variantfile_association_pos_bucket_id_fkey FOREIGN KEY (pos_bucket_id) REFERENCES pos_bucket (id);
12+
END;
13+
$$;

0 commit comments

Comments
 (0)