mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Added versions file for initial db and fixed tests.
This commit is contained in:
52
migrations/versions/0001_initialise_data.py
Normal file
52
migrations/versions/0001_initialise_data.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0001_initialise_data
|
||||
Revises: None
|
||||
Create Date: 2016-01-12 09:33:29.249042
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0001_initialise_data'
|
||||
down_revision = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('services',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('active', sa.Boolean(), nullable=False),
|
||||
sa.Column('limit', sa.BigInteger(), nullable=False),
|
||||
sa.Column('restricted', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('users',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('email_address', sa.String(length=255), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_users_email_address'), 'users', ['email_address'], unique=True)
|
||||
op.create_table('user_to_service',
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('service_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], )
|
||||
)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('user_to_service')
|
||||
op.drop_index(op.f('ix_users_email_address'), table_name='users')
|
||||
op.drop_table('users')
|
||||
op.drop_table('services')
|
||||
### end Alembic commands ###
|
||||
Reference in New Issue
Block a user