added manager user type
This commit is contained in:
24
migrations/versions/72ab6c4c6a5f_merge_heads.py
Normal file
24
migrations/versions/72ab6c4c6a5f_merge_heads.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""merge heads
|
||||
|
||||
Revision ID: 72ab6c4c6a5f
|
||||
Revises: 0a8006bd1732, add_docupulse_settings, add_manager_role, make_events_user_id_nullable
|
||||
Create Date: 2025-06-05 14:21:46.046125
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '72ab6c4c6a5f'
|
||||
down_revision = ('0a8006bd1732', 'add_docupulse_settings', 'add_manager_role', 'make_events_user_id_nullable')
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
@@ -8,6 +8,7 @@ Create Date: 2024-03-19 10:00:00.000000
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from datetime import datetime
|
||||
from sqlalchemy import text
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'add_docupulse_settings'
|
||||
@@ -28,7 +29,7 @@ def upgrade():
|
||||
server_default='10737418240')
|
||||
|
||||
# Check if we need to insert default data
|
||||
result = conn.execute("SELECT COUNT(*) FROM docupulse_settings").scalar()
|
||||
result = conn.execute(text("SELECT COUNT(*) FROM docupulse_settings")).scalar()
|
||||
if result == 0:
|
||||
conn.execute("""
|
||||
INSERT INTO docupulse_settings (id, max_rooms, max_conversations, max_storage, updated_at)
|
||||
|
||||
38
migrations/versions/add_manager_role.py
Normal file
38
migrations/versions/add_manager_role.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Add manager role
|
||||
|
||||
Revision ID: add_manager_role
|
||||
Revises: 25da158dd705
|
||||
Create Date: 2024-03-20 10:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'add_manager_role'
|
||||
down_revision = '25da158dd705'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
inspector = inspect(conn)
|
||||
columns = [col['name'] for col in inspector.get_columns('user')]
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
if 'is_manager' not in columns:
|
||||
batch_op.add_column(sa.Column('is_manager', sa.Boolean(), nullable=True, server_default='false'))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_column('is_manager')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user