Asterisk - The Open Source Telephony Project
GIT-master-f36a736
contrib
ast-db-manage
config
versions
ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py
Go to the documentation of this file.
1
"""ps_contacts add endpoint and modify expiration_time to bigint
2
3
Revision ID: ef7efc2d3964
4
Revises: a845e4d8ade8
5
Create Date: 2016-06-02 18:18:46.231920
6
7
"""
8
9
# revision identifiers, used by Alembic.
10
revision =
'ef7efc2d3964'
11
down_revision =
'a845e4d8ade8'
12
13
from
alembic
import
op
14
import
sqlalchemy
as
sa
15
16
17
def
upgrade
():
18
context = op.get_context()
19
20
op.add_column(
'ps_contacts'
, sa.Column(
'endpoint'
, sa.String(40)))
21
22
if
context.bind.dialect.name !=
'postgresql'
:
23
op.alter_column(
'ps_contacts'
,
'expiration_time'
, type_=sa.BigInteger)
24
else
:
25
op.execute(
'ALTER TABLE ps_contacts ALTER COLUMN expiration_time TYPE BIGINT USING expiration_time::bigint'
)
26
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'
])
29
def
downgrade
():
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'
)
34
else
:
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))
ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.upgrade
def upgrade()
Definition:
ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py:17
ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.downgrade
def downgrade()
Definition:
ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py:29
Generated on Wed Dec 18 2024 20:04:15 for Asterisk - The Open Source Telephony Project by
1.9.4