eventcally/migrations/versions/091deace5f08_.py
Daniel Grams d63f340384 Internal/modules (#1)
* Restructured app
* Added Travis CI
* Added 'Deploy to heroku' button
2020-11-13 12:24:26 +01:00

47 lines
1.6 KiB
Python

"""empty message
Revision ID: 091deace5f08
Revises: 6b7016f73688
Create Date: 2020-10-02 09:29:12.932229
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
import sqlalchemy_utils
from project import dbtypes
from geoalchemy2.types import Geometry
# revision identifiers, used by Alembic.
revision = '091deace5f08'
down_revision = '6b7016f73688'
branch_labels = None
depends_on = None
def upgrade():
bind = op.get_bind()
bind.execute(text("create extension if not exists postgis;"))
# ### commands auto generated by Alembic - please adjust! ###
#op.drop_table('spatial_ref_sys')
op.add_column('location', sa.Column('coordinate', Geometry(geometry_type='POINT', from_text='ST_GeomFromEWKT', name='geometry'), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('location', 'coordinate')
op.create_table('spatial_ref_sys',
sa.Column('srid', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('auth_name', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
sa.Column('auth_srid', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('srtext', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.Column('proj4text', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.CheckConstraint('(srid > 0) AND (srid <= 998999)', name='spatial_ref_sys_srid_check'),
sa.PrimaryKeyConstraint('srid', name='spatial_ref_sys_pkey')
)
# ### end Alembic commands ###