aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20221110_02_z1dWf-create-mrna-resources-table.py
blob: 095911645134951f883e6e32047a0a37758e0a87 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Create 'mrna_resources' table

NOTE: One "mRNA dataset" should only ever be linked to one and only one resource object.
      One "resource object" should only ever be linked to one and only one "mRNA dataset".
"""

from yoyo import step

__depends__ = {'20221110_01_WtZ1I-create-resources-table'}

steps = [
    step(
        """
        CREATE TABLE IF NOT EXISTS mrna_resources(
            resource_id TEXT PRIMARY KEY,
            dataset_id TEXT NOT NULL UNIQUE,
            FOREIGN KEY(resource_id) REFERENCES resources(resource_id)
        ) WITHOUT ROWID
        """,
        "DROP TABLE IF EXISTS mrna_resources")
]