-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9665696
commit 6588404
Showing
3 changed files
with
280 additions
and
2 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
migrations/versions/20240830_1902_11461790578a_add_link_full_schema3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
"""add_link_full_schema3 | ||
Revision ID: 11461790578a | ||
Revises: da280c5f1dac | ||
Create Date: 2024-08-30 19:02:34.621922 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
import os | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '11461790578a' | ||
down_revision = 'da280c5f1dac' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.drop_table('new_with_dates', schema='STG_RASPHYSMSU') | ||
op.drop_table('link_new_with_dates', schema='STG_RASPHYSMSU') | ||
|
||
|
||
def downgrade(): | ||
op.create_table( | ||
'link_new_with_dates', | ||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), | ||
sa.Column('subject', sa.VARCHAR(), autoincrement=False, nullable=True), | ||
sa.Column('start', sa.VARCHAR(), autoincrement=False, nullable=True), | ||
sa.Column('end', sa.VARCHAR(), autoincrement=False, nullable=True), | ||
sa.Column('odd', sa.BOOLEAN(), autoincrement=False, nullable=True), | ||
sa.Column('even', sa.BOOLEAN(), autoincrement=False, nullable=True), | ||
sa.Column('weekday', sa.INTEGER(), autoincrement=False, nullable=True), | ||
sa.Column('num', sa.INTEGER(), autoincrement=False, nullable=True), | ||
sa.Column('place', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('group', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('teacher', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('events_id', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True), | ||
sa.PrimaryKeyConstraint('id', name='link_new_with_dates_pkey'), | ||
schema='STG_RASPHYSMSU', | ||
) | ||
op.create_table( | ||
'new_with_dates', | ||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), | ||
sa.Column('subject', sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.Column('odd', sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column('even', sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column('weekday', sa.INTEGER(), autoincrement=False, nullable=True), | ||
sa.Column('num', sa.INTEGER(), autoincrement=False, nullable=True), | ||
sa.Column('start', sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.Column('end', sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.Column('place', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('group', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('teacher', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=False), | ||
sa.Column('events_id', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True), | ||
sa.PrimaryKeyConstraint('id', name='new_with_dates_pkey'), | ||
schema='STG_RASPHYSMSU', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.grant_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) |
135 changes: 135 additions & 0 deletions
135
migrations/versions/20240830_1904_0e97fd76b68a_add_link_full_schema3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
"""add_link_full_schema3 | ||
Revision ID: 0e97fd76b68a | ||
Revises: 11461790578a | ||
Create Date: 2024-08-30 19:04:02.502893 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
import os | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '0e97fd76b68a' | ||
down_revision = '11461790578a' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
'link_new_with_dates', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('subject', sa.String(), nullable=True), | ||
sa.Column('odd', sa.Boolean(), nullable=True), | ||
sa.Column('even', sa.Boolean(), nullable=True), | ||
sa.Column('weekday', sa.Integer(), nullable=True), | ||
sa.Column('num', sa.Integer(), nullable=True), | ||
sa.Column('start', sa.String(), nullable=True), | ||
sa.Column('end', sa.String(), nullable=True), | ||
sa.Column('place', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('group', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('teacher', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('events_id', sa.ARRAY(sa.Integer()), nullable=True), | ||
schema='STG_RASPHYSMSU', | ||
) | ||
op.create_table( | ||
'new_with_dates', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('subject', sa.String(), nullable=False), | ||
sa.Column('odd', sa.Boolean(), nullable=False), | ||
sa.Column('even', sa.Boolean(), nullable=False), | ||
sa.Column('weekday', sa.Integer(), nullable=True), | ||
sa.Column('num', sa.Integer(), nullable=True), | ||
sa.Column('start', sa.String(), nullable=False), | ||
sa.Column('end', sa.String(), nullable=False), | ||
sa.Column('place', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('group', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('teacher', sa.ARRAY(sa.Integer()), nullable=False), | ||
sa.Column('events_id', sa.ARRAY(sa.Integer()), nullable=True), | ||
schema='STG_RASPHYSMSU', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.grant_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.grant_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_all" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_all", | ||
['ALL'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
( | ||
"test_dwh_stg_rasphysmsu_write" | ||
if os.getenv("ENVIRONMENT") != "production" | ||
else "prod_dwh_stg_rasphysmsu_write" | ||
), | ||
['SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'INSERT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.revoke_on_table( | ||
"test_dwh_stg_rasphysmsu_read" if os.getenv("ENVIRONMENT") != "production" else "prod_dwh_stg_rasphysmsu_read", | ||
['SELECT'], | ||
'"STG_RASPHYSMSU".link_new_with_dates', | ||
) | ||
op.drop_table('new_with_dates', schema='STG_RASPHYSMSU') | ||
op.drop_table('link_new_with_dates', schema='STG_RASPHYSMSU') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters