diff options
author | Frederick Muriuki Muriithi | 2022-11-10 12:20:43 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-11-10 12:20:43 +0300 |
commit | 4e9af79511eebfa7039d180c30d115a8ad6d2cd1 (patch) | |
tree | dfd6dddc92d54c1ab73971c3a64b0faaf2f36ca4 /migrations | |
parent | 25a92b6ebcdbc1453a9f8ea4a46dea96c906af71 (diff) | |
download | genenetwork3-4e9af79511eebfa7039d180c30d115a8ad6d2cd1.tar.gz |
Migrations: migration for 'roles' table
* migrations/auth/20221110_05_BaNtL-create-roles-table.py: new migration
* tests/unit/auth/test_create_table_migrations.py: test new migration
* tests/unit/auth/test_migrations_indexes.py: test new migration
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/auth/20221110_05_BaNtL-create-roles-table.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/migrations/auth/20221110_05_BaNtL-create-roles-table.py b/migrations/auth/20221110_05_BaNtL-create-roles-table.py new file mode 100644 index 0000000..bf238f6 --- /dev/null +++ b/migrations/auth/20221110_05_BaNtL-create-roles-table.py @@ -0,0 +1,26 @@ +""" +Create 'roles' table +""" + +from yoyo import step + +__depends__ = {'20221110_04_6PRFQ-create-genotype-resources-table'} + +steps = [ + step( + """ + CREATE TABLE IF NOT EXISTS roles( + group_id TEXT NOT NULL, + role_id TEXT NOT NULL PRIMARY KEY, + role_name TEXT NOT NULL, + FOREIGN KEY(group_id) REFERENCES groups(group_id) + ) WITHOUT ROWID + """, + "DROP TABLE IF EXISTS roles"), + step( + """ + CREATE INDEX IF NOT EXISTS idx_tbl_roles_cols_group_id + ON roles(group_id) + """, + "DROP INDEX IF EXISTS idx_tbl_roles_cols_group_id") +] |