1 """ps_contacts add endpoint and modify expiration_time to bigint
3 Revision ID: ef7efc2d3964
5 Create Date: 2016-06-02 18:18:46.231920
10 revision =
'ef7efc2d3964'
11 down_revision =
'a845e4d8ade8'
13 from alembic
import op
14 import sqlalchemy
as sa
18 context = op.get_context()
20 op.add_column(
'ps_contacts', sa.Column(
'endpoint', sa.String(40)))
22 if context.bind.dialect.name !=
'postgresql':
23 op.alter_column(
'ps_contacts',
'expiration_time', type_=sa.BigInteger)
25 op.execute(
'ALTER TABLE ps_contacts ALTER COLUMN expiration_time TYPE BIGINT USING expiration_time::bigint')
27 op.create_index(
'ps_contacts_qualifyfreq_exp',
'ps_contacts', [
'qualify_frequency',
'expiration_time'])
28 op.create_index(
'ps_aors_qualifyfreq_contact',
'ps_aors', [
'qualify_frequency',
'contact'])
30 context_name = op.get_context().bind.dialect.name
31 if context_name !=
'mssql' and context_name !=
'mysql':
32 op.drop_index(
'ps_aors_qualifyfreq_contact')
33 op.drop_index(
'ps_contacts_qualifyfreq_exp')
35 op.drop_index(
'ps_aors_qualifyfreq_contact', table_name=
'ps_aors')
36 op.drop_index(
'ps_contacts_qualifyfreq_exp', table_name=
'ps_contacts')
37 op.drop_column(
'ps_contacts',
'endpoint')
38 op.alter_column(
'ps_contacts',
'expiration_time', type_=sa.String(40))