Files
notifications-api/migrations/versions/0002_add_templates.py

39 lines
1.3 KiB
Python
Raw Normal View History

2016-01-13 11:04:13 +00:00
"""empty message
Revision ID: 0002_add_templates
Revises: 0001_initialise_data
Create Date: 2016-01-13 10:10:37.303109
"""
# revision identifiers, used by Alembic.
revision = '0002_add_templates'
down_revision = '0001_initialise_data'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('templates',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('template_type', sa.Enum('sms', 'email', 'letter', name='template_type'), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('content', sa.Text(), nullable=False),
sa.Column('service_id', sa.BigInteger(), nullable=True),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_templates_service_id'), 'templates', ['service_id'], unique=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_templates_service_id'), table_name='templates')
op.drop_table('templates')
### end Alembic commands ###