fixed migrations

This commit is contained in:
2025-06-02 16:11:56 +02:00
parent c95a1c456b
commit 4dbaa27cba
98 changed files with 399 additions and 109 deletions

View File

@@ -7,6 +7,7 @@ Create Date: 2025-06-01 20:09:08.019884
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
@@ -18,7 +19,12 @@ depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('email_templates',
conn = op.get_bind()
inspector = inspect(conn)
tables = inspector.get_table_names()
if 'email_templates' not in tables:
op.create_table('email_templates',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=100), nullable=False),
sa.Column('subject', sa.String(length=200), nullable=False),
@@ -54,7 +60,12 @@ def downgrade():
type_=postgresql.JSONB(astext_type=sa.Text()),
existing_nullable=True)
op.create_table('notification',
conn = op.get_bind()
inspector = inspect(conn)
tables = inspector.get_table_names()
if 'notification' not in tables:
op.create_table('notification',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False),