aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20221110_05_BaNtL-create-roles-table.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-11-10 12:20:43 +0300
committerFrederick Muriuki Muriithi2022-11-10 12:20:43 +0300
commit4e9af79511eebfa7039d180c30d115a8ad6d2cd1 (patch)
treedfd6dddc92d54c1ab73971c3a64b0faaf2f36ca4 /migrations/auth/20221110_05_BaNtL-create-roles-table.py
parent25a92b6ebcdbc1453a9f8ea4a46dea96c906af71 (diff)
downloadgenenetwork3-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/auth/20221110_05_BaNtL-create-roles-table.py')
-rw-r--r--migrations/auth/20221110_05_BaNtL-create-roles-table.py26
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")
+]