summaryrefslogtreecommitdiff
path: root/contrib/ast-db-manage/voicemail/versions/a2e9769475e_create_tables.py
blob: 3dc4d47c4a899447774c6ac760a9491ef7c8fed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Asterisk -- An open source telephony toolkit.
#
# Copyright (C) 2013, Russell Bryant
#
# Russell Bryant <russell@rusellbryant.net>
#
# See http://www.asterisk.org for more information about
# the Asterisk project. Please do not directly contact
# any of the maintainers of this project for assistance;
# the project provides a web site, mailing lists and IRC
# channels for your use.
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#

"""Create tables

Revision ID: a2e9769475e
Revises: None
Create Date: 2013-07-29 23:43:09.431668

"""

# revision identifiers, used by Alembic.
revision = 'a2e9769475e'
down_revision = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.create_table(
        'voicemail_messages',
        sa.Column('dir', sa.String(255), nullable=False),
        sa.Column('msgnum', sa.Integer, nullable=False),
        sa.Column('context', sa.String(80)),
        sa.Column('macrocontext', sa.String(80)),
        sa.Column('callerid', sa.String(80)),
        sa.Column('origtime', sa.Integer),
        sa.Column('duration', sa.Integer),
        sa.Column('recording', sa.LargeBinary),
        sa.Column('flag', sa.String(30)),
        sa.Column('category', sa.String(30)),
        sa.Column('mailboxuser', sa.String(30)),
        sa.Column('mailboxcontext', sa.String(30)),
        sa.Column('msg_id', sa.String(40))
    )
    op.create_primary_key('voicemail_messages_dir_msgnum',
            'voicemail_messages', ['dir', 'msgnum'])
    op.create_index('voicemail_messages_dir', 'voicemail_messages', ['dir'])


def downgrade():
    op.drop_table('voicemail_messages')