Skip to content

Commit db50854

Browse files
committed
Add migration script
1 parent 0c1aefd commit db50854

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""Add functions api access rights
2+
3+
Revision ID: 4f6fd2586491
4+
Revises: afb1ba08f3c2
5+
Create Date: 2025-06-13 12:14:59.317685+00:00
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "4f6fd2586491"
14+
down_revision = "afb1ba08f3c2"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.create_table(
22+
"funcapi_group_api_access_rights",
23+
sa.Column("group_id", sa.BigInteger(), nullable=False),
24+
sa.Column("product_name", sa.String(), nullable=False),
25+
sa.Column("read_functions", sa.Boolean(), nullable=True),
26+
sa.Column("write_functions", sa.Boolean(), nullable=True),
27+
sa.Column("execute_functions", sa.Boolean(), nullable=True),
28+
sa.Column("read_function_jobs", sa.Boolean(), nullable=True),
29+
sa.Column("write_function_jobs", sa.Boolean(), nullable=True),
30+
sa.Column("execute_function_jobs", sa.Boolean(), nullable=True),
31+
sa.Column("read_function_job_collections", sa.Boolean(), nullable=True),
32+
sa.Column("write_function_job_collections", sa.Boolean(), nullable=True),
33+
sa.Column("execute_function_job_collections", sa.Boolean(), nullable=True),
34+
sa.Column(
35+
"created",
36+
sa.DateTime(timezone=True),
37+
server_default=sa.text("now()"),
38+
nullable=False,
39+
),
40+
sa.Column(
41+
"modified",
42+
sa.DateTime(timezone=True),
43+
server_default=sa.text("now()"),
44+
nullable=False,
45+
),
46+
sa.ForeignKeyConstraint(
47+
["group_id"],
48+
["groups.gid"],
49+
name="fk_func_access_to_groups_group_id",
50+
onupdate="CASCADE",
51+
ondelete="CASCADE",
52+
),
53+
sa.ForeignKeyConstraint(
54+
["product_name"],
55+
["products.name"],
56+
name="fk_func_access_to_products_product_name",
57+
onupdate="CASCADE",
58+
ondelete="CASCADE",
59+
),
60+
sa.PrimaryKeyConstraint(
61+
"group_id",
62+
"product_name",
63+
name="pk_func_group_product_name_to_api_access_rights",
64+
),
65+
)
66+
# ### end Alembic commands ###
67+
68+
69+
def downgrade():
70+
# ### commands auto generated by Alembic - please adjust! ###
71+
op.drop_table("funcapi_group_api_access_rights")
72+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)