first commit
This commit is contained in:
56
db/versions/a904d0d1e1a7_create_initial_tables.py
Normal file
56
db/versions/a904d0d1e1a7_create_initial_tables.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""create initial tables
|
||||
|
||||
Revision ID: a904d0d1e1a7
|
||||
Revises:
|
||||
Create Date: 2016-08-31 11:16:58.286054
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a904d0d1e1a7'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'users',
|
||||
sa.Column('id', sa.Integer, primary_key=True),
|
||||
sa.Column('username', sa.Unicode, nullable=False),
|
||||
sa.Column('password_hash', sa.Unicode, nullable=False)
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
'sites',
|
||||
sa.Column('id', sa.Integer, primary_key=True),
|
||||
sa.Column('user_id', sa.Integer, sa.ForeignKey('users.id')),
|
||||
sa.Column('project_name', sa.Unicode, nullable=False),
|
||||
sa.Column('building_height', sa.Float, nullable=False),
|
||||
sa.Column('building_width', sa.Float, nullable=False),
|
||||
sa.Column('building_length', sa.Float, nullable=False),
|
||||
sa.Column('parapet_height', sa.Float, nullable=False),
|
||||
sa.Column('wind_speed', sa.Integer, nullable=False),
|
||||
sa.Column('exposure_category', sa.Unicode, nullable=False),
|
||||
sa.Column('exposure_transition_distance', sa.Integer),
|
||||
sa.Column('ballast_block_weight', sa.Float, nullable=False),
|
||||
sa.Column('max_psf', sa.Float, nullable=False),
|
||||
sa.Column('system_type', sa.Enum('0', '1', name='SystemType'), nullable=False),
|
||||
sa.Column('module_type', sa.Enum('96 Cell', '128 Cell', 'P-Series', name='ModuleType'), nullable=False),
|
||||
sa.Column('anchor_type', sa.Enum('OMG PowerGrip', 'OMG PowerGrip Plus', 'EcoFasten Eco 65', name='AnchorType'), nullable=False),
|
||||
sa.Column('spectral_response', sa.Float, nullable=False),
|
||||
sa.Column('seismic_importance_factor', sa.Float, nullable=False),
|
||||
sa.Column('cad_file', sa.Unicode),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('sites')
|
||||
op.drop_table('users')
|
||||
sa.Enum(name='SystemType').drop(op.get_bind(), checkfirst=False)
|
||||
sa.Enum(name='ModuleType').drop(op.get_bind(), checkfirst=False)
|
||||
sa.Enum(name='AnchorType').drop(op.get_bind(), checkfirst=False)
|
||||
|
||||
Reference in New Issue
Block a user