alembic: Add missing queue and CDR table creation scripts.
[asterisk/asterisk.git] / contrib / ast-db-manage / cdr / versions / 210693f3123d_create_cdr_table.py
1 #
2 # Asterisk -- An open source telephony toolkit.
3 #
4 # Copyright (C) 2014, Richard Mudgett
5 #
6 # Richard Mudgett <rmudgett@digium.com>
7 #
8 # See http://www.asterisk.org for more information about
9 # the Asterisk project. Please do not directly contact
10 # any of the maintainers of this project for assistance;
11 # the project provides a web site, mailing lists and IRC
12 # channels for your use.
13 #
14 # This program is free software, distributed under the terms of
15 # the GNU General Public License Version 2. See the LICENSE file
16 # at the top of the source tree.
17 #
18
19 """Create CDR table.
20
21 Revision ID: 210693f3123d
22 Revises: None
23 Create Date: 2014-02-14 15:11:43.867292
24
25 """
26
27 # revision identifiers, used by Alembic.
28 revision = '210693f3123d'
29 down_revision = None
30
31 from alembic import op
32 import sqlalchemy as sa
33
34
35 def upgrade():
36     op.create_table(
37         'cdr',
38         sa.Column('accountcode', sa.String(20)),
39         sa.Column('src', sa.String(80)),
40         sa.Column('dst', sa.String(80)),
41         sa.Column('dcontext', sa.String(80)),
42         sa.Column('clid', sa.String(80)),
43         sa.Column('channel', sa.String(80)),
44         sa.Column('dstchannel', sa.String(80)),
45         sa.Column('lastapp', sa.String(80)),
46         sa.Column('lastdata', sa.String(80)),
47         sa.Column('start', sa.DateTime()),
48         sa.Column('answer', sa.DateTime()),
49         sa.Column('end', sa.DateTime()),
50         sa.Column('duration', sa.Integer),
51         sa.Column('billsec', sa.Integer),
52         sa.Column('disposition', sa.String(45)),
53         sa.Column('amaflags', sa.String(45)),
54         sa.Column('userfield', sa.String(256)),
55         sa.Column('uniqueid', sa.String(150)),
56         sa.Column('linkedid', sa.String(150)),
57         sa.Column('peeraccount', sa.String(20)),
58         sa.Column('sequence', sa.Integer)
59     )
60
61
62 def downgrade():
63     op.drop_table('cdr')
64