aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--migrations/auth/20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py22
-rw-r--r--tests/unit/auth/test_migrations_add_remove_columns.py6
2 files changed, 27 insertions, 1 deletions
diff --git a/migrations/auth/20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py b/migrations/auth/20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py
new file mode 100644
index 0000000..077182b
--- /dev/null
+++ b/migrations/auth/20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py
@@ -0,0 +1,22 @@
+"""
+Add 'privilege_category' and 'privilege_description' columns to 'privileges' table
+"""
+
+from yoyo import step
+
+__depends__ = {'20221110_07_7WGa1-create-role-privileges-table'}
+
+steps = [
+ step(
+ """
+ ALTER TABLE privileges ADD COLUMN
+ privilege_category TEXT NOT NULL DEFAULT 'common'
+ """,
+ "ALTER TABLE privileges DROP COLUMN privilege_category"),
+ step(
+ """
+ ALTER TABLE privileges ADD COLUMN
+ privilege_description TEXT
+ """,
+ "ALTER TABLE privileges DROP COLUMN privilege_description")
+]
diff --git a/tests/unit/auth/test_migrations_add_remove_columns.py b/tests/unit/auth/test_migrations_add_remove_columns.py
index b5df9d3..b43e1cf 100644
--- a/tests/unit/auth/test_migrations_add_remove_columns.py
+++ b/tests/unit/auth/test_migrations_add_remove_columns.py
@@ -13,7 +13,11 @@ query = "SELECT sql FROM sqlite_schema WHERE name=?"
test_params = (
("20221109_01_HbD5F-add-resource-meta-field-to-resource-categories-field.py",
- "resource_categories", "resource_meta TEXT", True),)
+ "resource_categories", "resource_meta TEXT", True),
+ ("20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py",
+ "privileges", "privilege_category TEXT", True),
+ ("20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py",
+ "privileges", "privilege_description TEXT", True))
def found(haystack: str, needle: str) -> bool:
return any([