This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-14 13:45:21 +09:00
1 parent 6df09a4039
commit 95840e307a
2 files changed
+28 -18

No files matched your search

@@ -17,23 +17,28 @@ depends_on = None
def upgrade(): def upgrade():
# ### Create feedback table ### conn = op.get_bind()
op.create_table( inspector = sa.inspect(conn)
'feedback', existing_tables = set(inspector.get_table_names())
sa.Column('id', sa.Text(), primary_key=True), # Unique identifier for each feedback (TEXT type)
sa.Column('user_id', sa.Text(), nullable=True), # ID of the user providing the feedback (TEXT type) if 'feedback' not in existing_tables:
sa.Column('version', sa.BigInteger(), default=0), # Version of feedback (BIGINT type) # ### Create feedback table ###
sa.Column('type', sa.Text(), nullable=True), # Type of feedback (TEXT type) op.create_table(
sa.Column('data', sa.JSON(), nullable=True), # Feedback data (JSON type) 'feedback',
sa.Column('meta', sa.JSON(), nullable=True), # Metadata for feedback (JSON type) sa.Column('id', sa.Text(), primary_key=True), # Unique identifier for each feedback (TEXT type)
sa.Column('snapshot', sa.JSON(), nullable=True), # snapshot data for feedback (JSON type) sa.Column('user_id', sa.Text(), nullable=True), # ID of the user providing the feedback (TEXT type)
sa.Column( sa.Column('version', sa.BigInteger(), default=0), # Version of feedback (BIGINT type)
'created_at', sa.BigInteger(), nullable=False sa.Column('type', sa.Text(), nullable=True), # Type of feedback (TEXT type)
), # Feedback creation timestamp (BIGINT representing epoch) sa.Column('data', sa.JSON(), nullable=True), # Feedback data (JSON type)
sa.Column( sa.Column('meta', sa.JSON(), nullable=True), # Metadata for feedback (JSON type)
'updated_at', sa.BigInteger(), nullable=False sa.Column('snapshot', sa.JSON(), nullable=True), # snapshot data for feedback (JSON type)
), # Feedback update timestamp (BIGINT representing epoch) sa.Column(
) 'created_at', sa.BigInteger(), nullable=False
), # Feedback creation timestamp (BIGINT representing epoch)
sa.Column(
'updated_at', sa.BigInteger(), nullable=False
), # Feedback update timestamp (BIGINT representing epoch)
)
def downgrade(): def downgrade():
@@ -19,7 +19,12 @@ depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None: def upgrade() -> None:
op.add_column('user', sa.Column('scim', sa.JSON(), nullable=True)) conn = op.get_bind()
inspector = sa.inspect(conn)
user_cols = {c['name'] for c in inspector.get_columns('user')}
if 'scim' not in user_cols:
op.add_column('user', sa.Column('scim', sa.JSON(), nullable=True))
def downgrade() -> None: def downgrade() -> None: