mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Merge branch 'master' into remove-initial-update-sms-sender
This commit is contained in:
38
migrations/versions/0135_stats_template_usage.py
Normal file
38
migrations/versions/0135_stats_template_usage.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0135_stats_template_usage
|
||||
Revises: 0134_add_email_2fa_template
|
||||
Create Date: 2017-11-07 14:35:04.798561
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0135_stats_template_usage'
|
||||
down_revision = '0134_add_email_2fa_template'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('stats_template_usage_by_month',
|
||||
sa.Column('template_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('month', sa.Integer(), nullable=False),
|
||||
sa.Column('year', sa.Integer(), nullable=False),
|
||||
sa.Column('count', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['template_id'], ['templates.id'], ),
|
||||
sa.PrimaryKeyConstraint('template_id', 'month', 'year')
|
||||
)
|
||||
op.create_index(op.f('ix_stats_template_usage_by_month_month'), 'stats_template_usage_by_month', ['month'], unique=False)
|
||||
op.create_index(op.f('ix_stats_template_usage_by_month_template_id'), 'stats_template_usage_by_month', ['template_id'], unique=False)
|
||||
op.create_index(op.f('ix_stats_template_usage_by_month_year'), 'stats_template_usage_by_month', ['year'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_stats_template_usage_by_month_year'), table_name='stats_template_usage_by_month')
|
||||
op.drop_index(op.f('ix_stats_template_usage_by_month_template_id'), table_name='stats_template_usage_by_month')
|
||||
op.drop_index(op.f('ix_stats_template_usage_by_month_month'), table_name='stats_template_usage_by_month')
|
||||
op.drop_table('stats_template_usage_by_month')
|
||||
# ### end Alembic commands ###
|
||||
28
migrations/versions/0136_user_mobile_nullable.py
Normal file
28
migrations/versions/0136_user_mobile_nullable.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0136_user_mobile_nullable
|
||||
Revises: 0135_stats_template_usage
|
||||
Create Date: 2017-11-08 11:49:05.773974
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import column
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0136_user_mobile_nullable'
|
||||
down_revision = '0135_stats_template_usage'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('users', 'mobile_number', nullable=True)
|
||||
|
||||
op.create_check_constraint(
|
||||
'ck_users_mobile_or_email_auth',
|
||||
'users',
|
||||
"auth_type = 'email_auth' or mobile_number is not null"
|
||||
)
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('users', 'mobile_number', nullable=False)
|
||||
op.drop_constraint('ck_users_mobile_or_email_auth', 'users')
|
||||
Reference in New Issue
Block a user