Updated the Provider stats and rates DAO objects to query based on the identifier in the ProviderDetails object.

- updated all tests
- changed teardown to leave provider details rows on end of individual tests
This commit is contained in:
Martyn Inglis
2016-05-06 09:09:47 +01:00
parent fedbb27ffd
commit 57e05feafb
15 changed files with 149 additions and 135 deletions

View File

@@ -15,7 +15,6 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('provider_rates',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('valid_from', sa.DateTime(), nullable=False),
@@ -33,12 +32,9 @@ def upgrade():
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_provider_statistics_service_id'), 'provider_statistics', ['service_id'], unique=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_provider_statistics_service_id'), table_name='provider_statistics')
op.drop_table('provider_statistics')
op.drop_table('provider_rates')
### end Alembic commands ###

View File

@@ -62,7 +62,6 @@ def upgrade():
"UPDATE provider_statistics set provider_id = (select id from provider_details where identifier = 'ses') where provider = 'ses'"
)
def downgrade():
op.drop_constraint(None, 'provider_statistics', type_='foreignkey')
@@ -73,4 +72,3 @@ def downgrade():
op.drop_column('provider_rates', 'provider_id')
op.drop_table('provider_details')
### end Alembic commands ###

View File

@@ -26,7 +26,6 @@ def upgrade():
op.drop_column('provider_statistics', 'provider')
def downgrade():
op.add_column('provider_statistics', sa.Column('provider', postgresql.ENUM('mmg', 'twilio', 'firetext', 'ses', name='providers'), autoincrement=False, nullable=False))
@@ -37,4 +36,3 @@ def downgrade():
op.alter_column('provider_rates', 'provider_id',
existing_type=postgresql.UUID(),
nullable=True)