|
1
|
|
|
"""Initial migration |
|
2
|
|
|
|
|
3
|
|
|
Revision ID: c28cd6618f35 |
|
4
|
|
|
Revises: None |
|
5
|
|
|
Create Date: 2016-11-30 00:43:31.083737 |
|
6
|
|
|
|
|
7
|
|
|
""" |
|
8
|
|
|
|
|
9
|
|
|
# revision identifiers, used by Alembic. |
|
10
|
|
|
revision = 'c28cd6618f35' |
|
11
|
|
|
down_revision = None |
|
12
|
|
|
|
|
13
|
|
|
from alembic import op |
|
14
|
|
|
import sqlalchemy as sa |
|
15
|
|
|
import geoalchemy2 |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
def upgrade(): |
|
19
|
|
|
# ### commands auto generated by Alembic - please adjust! ### |
|
20
|
|
|
op.create_table('areas', |
|
21
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
22
|
|
|
sa.Column('name', sa.Text(), nullable=True), |
|
23
|
|
|
sa.PrimaryKeyConstraint('id') |
|
24
|
|
|
) |
|
25
|
|
|
op.create_table('lifts', |
|
26
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
27
|
|
|
sa.Column('dt', sa.DateTime(), nullable=True), |
|
28
|
|
|
sa.Column('description', sa.Text(), nullable=True), |
|
29
|
|
|
sa.Column('geom', geoalchemy2.types.Geometry(geometry_type='LINESTRING', srid=4326), nullable=True), |
|
30
|
|
|
sa.PrimaryKeyConstraint('id') |
|
31
|
|
|
) |
|
32
|
|
|
op.create_table('snow_reporters', |
|
33
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
34
|
|
|
sa.Column('name', sa.Text(), nullable=True), |
|
35
|
|
|
sa.PrimaryKeyConstraint('id') |
|
36
|
|
|
) |
|
37
|
|
|
op.create_table('user', |
|
38
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
39
|
|
|
sa.Column('username', sa.String(), nullable=True), |
|
40
|
|
|
sa.Column('password', sa.String(), nullable=True), |
|
41
|
|
|
sa.PrimaryKeyConstraint('id') |
|
42
|
|
|
) |
|
43
|
|
|
op.create_table('daily_reports', |
|
44
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
45
|
|
|
sa.Column('dt', sa.DateTime(), nullable=True), |
|
46
|
|
|
sa.Column('report', sa.Text(), nullable=True), |
|
47
|
|
|
sa.Column('reporter_id', sa.Integer(), nullable=True), |
|
48
|
|
|
sa.ForeignKeyConstraint(['reporter_id'], ['snow_reporters.id'], ), |
|
49
|
|
|
sa.PrimaryKeyConstraint('id') |
|
50
|
|
|
) |
|
51
|
|
|
op.create_table('lift_status', |
|
52
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
53
|
|
|
sa.Column('running', sa.Boolean(), nullable=True), |
|
54
|
|
|
sa.Column('scheduled', sa.Boolean(), nullable=True), |
|
55
|
|
|
sa.Column('hold', sa.Boolean(), nullable=True), |
|
56
|
|
|
sa.Column('lift_id', sa.Integer(), nullable=True), |
|
57
|
|
|
sa.ForeignKeyConstraint(['lift_id'], ['lifts.id'], ), |
|
58
|
|
|
sa.PrimaryKeyConstraint('id') |
|
59
|
|
|
) |
|
60
|
|
|
op.create_table('trails', |
|
61
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
62
|
|
|
sa.Column('name', sa.Text(), nullable=True), |
|
63
|
|
|
sa.Column('geom', geoalchemy2.types.Geometry(geometry_type='LINESTRING', srid=4326), nullable=True), |
|
64
|
|
|
sa.Column('description', sa.Text(), nullable=True), |
|
65
|
|
|
sa.Column('osm_id', sa.BigInteger(), nullable=True), |
|
66
|
|
|
sa.Column('current', sa.Boolean(), nullable=True), |
|
67
|
|
|
sa.Column('area_id', sa.Integer(), nullable=True), |
|
68
|
|
|
sa.ForeignKeyConstraint(['area_id'], ['areas.id'], ), |
|
69
|
|
|
sa.PrimaryKeyConstraint('id') |
|
70
|
|
|
) |
|
71
|
|
|
op.create_table('trail_status', |
|
72
|
|
|
sa.Column('id', sa.Integer(), nullable=False), |
|
73
|
|
|
sa.Column('dt', sa.DateTime(), nullable=True), |
|
74
|
|
|
sa.Column('open', sa.Boolean(), nullable=True), |
|
75
|
|
|
sa.Column('groomed', sa.Boolean(), nullable=True), |
|
76
|
|
|
sa.Column('snowmaking', sa.Boolean(), nullable=True), |
|
77
|
|
|
sa.Column('trail_id', sa.Integer(), nullable=True), |
|
78
|
|
|
sa.ForeignKeyConstraint(['trail_id'], ['trails.id'], ), |
|
79
|
|
|
sa.PrimaryKeyConstraint('id') |
|
80
|
|
|
) |
|
81
|
|
|
# ### end Alembic commands ### |
|
82
|
|
|
|
|
83
|
|
|
|
|
84
|
|
|
def downgrade(): |
|
85
|
|
|
# ### commands auto generated by Alembic - please adjust! ### |
|
86
|
|
|
op.drop_table('trail_status') |
|
87
|
|
|
op.drop_table('trails') |
|
88
|
|
|
op.drop_table('lift_status') |
|
89
|
|
|
op.drop_table('daily_reports') |
|
90
|
|
|
op.drop_table('user') |
|
91
|
|
|
op.drop_table('snow_reporters') |
|
92
|
|
|
op.drop_table('lifts') |
|
93
|
|
|
op.drop_table('areas') |
|
94
|
|
|
# ### end Alembic commands ### |
|
95
|
|
|
|