2022-04-02 10:26:19 +00:00
|
|
|
"""create table road
|
|
|
|
|
|
|
|
Revision ID: 35e7f1768f9b
|
|
|
|
Revises: 5d75febe2d59
|
|
|
|
Create Date: 2022-03-30 21:36:48.157457
|
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
|
|
|
|
from migrations.utils import dbtype
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = "35e7f1768f9b"
|
|
|
|
down_revision = "920aed1450c9"
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
op.create_table(
|
|
|
|
"road",
|
|
|
|
sa.Column(
|
2023-03-29 21:35:23 +00:00
|
|
|
"way_id", sa.BIGINT, primary_key=True, index=True, autoincrement=False
|
2022-04-02 10:26:19 +00:00
|
|
|
),
|
|
|
|
sa.Column("zone", dbtype("zone_type")),
|
2023-03-29 21:35:23 +00:00
|
|
|
sa.Column("name", sa.Text),
|
|
|
|
sa.Column("geometry", dbtype("geometry(LINESTRING,3857)")),
|
2022-04-02 10:26:19 +00:00
|
|
|
sa.Column("directionality", sa.Integer),
|
2023-03-28 19:45:28 +00:00
|
|
|
sa.Column("oneway", sa.Boolean),
|
2022-04-02 10:26:19 +00:00
|
|
|
)
|
2023-03-30 11:47:19 +00:00
|
|
|
op.execute(
|
|
|
|
"CREATE INDEX road_geometry_idx ON road USING GIST (geometry) WITH (FILLFACTOR=100);"
|
|
|
|
)
|
2022-04-02 10:26:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
op.drop_table("road")
|