|
| 1 | +"""add_owasp_demo_tables |
| 2 | +
|
| 3 | +Revision ID: 832f5763b245 |
| 4 | +Revises: d19595e777a0 |
| 5 | +Create Date: 2025-12-14 13:28:50.376252 |
| 6 | +
|
| 7 | +""" |
| 8 | +from alembic import op |
| 9 | +import sqlalchemy as sa |
| 10 | +import sqlmodel.sql.sqltypes |
| 11 | + |
| 12 | + |
| 13 | +# revision identifiers, used by Alembic. |
| 14 | +revision = '832f5763b245' |
| 15 | +down_revision = 'd19595e777a0' |
| 16 | +branch_labels = None |
| 17 | +depends_on = None |
| 18 | + |
| 19 | + |
| 20 | +def upgrade(): |
| 21 | + # ### commands auto generated by Alembic - please adjust! ### |
| 22 | + op.create_table('audit_log', |
| 23 | + sa.Column('id', sa.Uuid(), nullable=False), |
| 24 | + sa.Column('action', sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False), |
| 25 | + sa.Column('user_id', sa.Uuid(), nullable=True), |
| 26 | + sa.Column('details', sqlmodel.sql.sqltypes.AutoString(length=5000), nullable=True), |
| 27 | + sa.Column('ip_address', sqlmodel.sql.sqltypes.AutoString(length=45), nullable=True), |
| 28 | + sa.Column('timestamp', sa.DateTime(), nullable=False), |
| 29 | + sa.PrimaryKeyConstraint('id') |
| 30 | + ) |
| 31 | + op.create_table('secret_document', |
| 32 | + sa.Column('id', sa.Uuid(), nullable=False), |
| 33 | + sa.Column('title', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False), |
| 34 | + sa.Column('content', sqlmodel.sql.sqltypes.AutoString(length=10000), nullable=False), |
| 35 | + sa.Column('classification', sqlmodel.sql.sqltypes.AutoString(length=50), nullable=False), |
| 36 | + sa.Column('owner_id', sa.Uuid(), nullable=False), |
| 37 | + sa.Column('created_at', sa.DateTime(), nullable=False), |
| 38 | + sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ondelete='CASCADE'), |
| 39 | + sa.PrimaryKeyConstraint('id') |
| 40 | + ) |
| 41 | + op.create_table('user_note', |
| 42 | + sa.Column('id', sa.Integer(), nullable=False), |
| 43 | + sa.Column('title', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False), |
| 44 | + sa.Column('content', sqlmodel.sql.sqltypes.AutoString(length=5000), nullable=False), |
| 45 | + sa.Column('owner_id', sa.Uuid(), nullable=False), |
| 46 | + sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ondelete='CASCADE'), |
| 47 | + sa.PrimaryKeyConstraint('id') |
| 48 | + ) |
| 49 | + # ### end Alembic commands ### |
| 50 | + |
| 51 | + |
| 52 | +def downgrade(): |
| 53 | + # ### commands auto generated by Alembic - please adjust! ### |
| 54 | + op.drop_table('user_note') |
| 55 | + op.drop_table('secret_document') |
| 56 | + op.drop_table('audit_log') |
| 57 | + # ### end Alembic commands ### |
0 commit comments