diff options
author | Frederick Muriuki Muriithi | 2022-11-10 12:19:05 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-11-10 12:19:05 +0300 |
commit | 25a92b6ebcdbc1453a9f8ea4a46dea96c906af71 (patch) | |
tree | b5060892f3f14d07fd4faaeff93cf1347d784bbf /migrations | |
parent | 8972ec32949b7ad0c87043da1ac091d7404737a5 (diff) | |
download | genenetwork3-25a92b6ebcdbc1453a9f8ea4a46dea96c906af71.tar.gz |
Migrations: migration for 'genotype_resources' table
* migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py: new
migration
* tests/unit/auth/test_create_table_migrations.py: test new migration
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py b/migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py new file mode 100644 index 0000000..9200774 --- /dev/null +++ b/migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py @@ -0,0 +1,23 @@ +""" +Create 'genotype_resources' table + +NOTE: A "genotype resource" can only ever be linked to one and only one "resource object" + A "resource object" can be linked to one or more "genotype resource". +""" + +from yoyo import step + +__depends__ = {'20221110_03_ka3W0-create-phenotype-resources-table'} + +steps = [ + step( + """ + CREATE TABLE IF NOT EXISTS genotype_resources( + resource_id TEXT NOT NULL, + trait_id TEXT NOT NULL UNIQUE, + PRIMARY KEY(resource_id, trait_id), + FOREIGN KEY(resource_id) REFERENCES resources(resource_id) + ) WITHOUT ROWID + """, + "DROP TABLE IF EXISTS genotype_resources") +] |