3 Revision ID: b370c3eb4227
5 Create Date: 2020-07-17 19:22:15.267179
9 import sqlalchemy as sa
10 from sqlalchemy import orm
11 from app.models import ContentWarning
14 # revision identifiers, used by Alembic.
15 revision = 'b370c3eb4227'
16 down_revision = 'c5e4213721dd'
22 # ### commands auto generated by Alembic - please adjust! ###
23 op.create_table('content_warning',
24 sa.Column('id', sa.Integer(), nullable=False),
25 sa.Column('name', sa.String(length=100), nullable=False),
26 sa.Column('title', sa.String(length=100), nullable=False),
27 sa.Column('description', sa.String(length=500), nullable=False),
28 sa.PrimaryKeyConstraint('id'),
29 sa.UniqueConstraint('name')
31 op.create_table('content_warnings',
32 sa.Column('content_warning_id', sa.Integer(), nullable=False),
33 sa.Column('package_id', sa.Integer(), nullable=False),
34 sa.ForeignKeyConstraint(['content_warning_id'], ['content_warning.id'], ),
35 sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
36 sa.PrimaryKeyConstraint('content_warning_id', 'package_id')
40 session = orm.Session(bind=bind)
42 session.add(ContentWarning("Violence", "Non-cartoon violence"))
43 session.add(ContentWarning("Drugs", "Drugs or alcohol"))
44 session.add(ContentWarning("Bad Language"))
45 session.add(ContentWarning("Gambling"))
46 session.add(ContentWarning("Horror"))
49 # ### end Alembic commands ###
53 # ### commands auto generated by Alembic - please adjust! ###
54 op.drop_table('content_warnings')
55 op.drop_table('content_warning')
56 # ### end Alembic commands ###