37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
|
"""Add RepositoryActionCount table
|
||
|
|
||
|
Revision ID: 30c044b75632
|
||
|
Revises: 2b4dc0818a5e
|
||
|
Create Date: 2015-04-13 13:21:18.159602
|
||
|
|
||
|
"""
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '30c044b75632'
|
||
|
down_revision = '2b4dc0818a5e'
|
||
|
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
def upgrade(tables):
|
||
|
### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('repositoryactioncount',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('repository_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('count', sa.Integer(), nullable=False),
|
||
|
sa.Column('date', sa.Date(), nullable=False),
|
||
|
sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], name=op.f('fk_repositoryactioncount_repository_id_repository')),
|
||
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_repositoryactioncount'))
|
||
|
)
|
||
|
op.create_index('repositoryactioncount_date', 'repositoryactioncount', ['date'], unique=False)
|
||
|
op.create_index('repositoryactioncount_repository_id', 'repositoryactioncount', ['repository_id'], unique=False)
|
||
|
op.create_index('repositoryactioncount_repository_id_date', 'repositoryactioncount', ['repository_id', 'date'], unique=True)
|
||
|
### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade(tables):
|
||
|
### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('repositoryactioncount')
|
||
|
### end Alembic commands ###
|