From 4e9af79511eebfa7039d180c30d115a8ad6d2cd1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 10 Nov 2022 12:20:43 +0300 Subject: 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 --- .../auth/20221110_05_BaNtL-create-roles-table.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 migrations/auth/20221110_05_BaNtL-create-roles-table.py (limited to 'migrations') 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") +] -- cgit v1.2.3