2019-04-02 18:03:14 +02:00
|
|
|
"""empty message
|
2015-06-04 17:29:37 +02:00
|
|
|
|
2019-04-02 18:03:14 +02:00
|
|
|
Revision ID: 150252c1cdb1
|
2015-06-04 17:29:37 +02:00
|
|
|
Revises: None
|
2019-04-02 18:03:14 +02:00
|
|
|
Create Date: 2019-04-02 18:00:12.618368
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
"""
|
2020-01-26 18:53:14 +01:00
|
|
|
# pylint: disable=invalid-name
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2019-09-05 03:33:29 +02:00
|
|
|
revision = "150252c1cdb1"
|
2015-06-04 17:29:37 +02:00
|
|
|
down_revision = None
|
|
|
|
|
|
|
|
import sqlalchemy as sa
|
2019-09-08 02:02:16 +02:00
|
|
|
from alembic import op
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2019-09-05 03:33:29 +02:00
|
|
|
op.create_table(
|
|
|
|
"location",
|
|
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("name", sa.String(length=120), nullable=False),
|
|
|
|
sa.Column("address", sa.String(length=254), nullable=True),
|
|
|
|
sa.Column("website", sa.String(length=120), nullable=True),
|
|
|
|
sa.Column("telephone", sa.String(length=20), nullable=True),
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
2015-06-04 17:29:37 +02:00
|
|
|
)
|
2019-09-05 03:33:29 +02:00
|
|
|
op.create_table(
|
|
|
|
"user",
|
|
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("username", sa.String(length=80), nullable=False),
|
|
|
|
sa.Column("admin", sa.Boolean(), nullable=True),
|
|
|
|
sa.Column("bias", sa.Integer(), nullable=True),
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
|
sa.UniqueConstraint("username"),
|
2015-06-04 17:29:37 +02:00
|
|
|
)
|
2019-09-05 03:33:29 +02:00
|
|
|
op.create_table(
|
|
|
|
"order",
|
|
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("courrier_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("location_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("starttime", sa.DateTime(), nullable=True),
|
|
|
|
sa.Column("stoptime", sa.DateTime(), nullable=True),
|
|
|
|
sa.Column("public", sa.Boolean(), nullable=True),
|
2023-04-19 23:48:59 +02:00
|
|
|
sa.ForeignKeyConstraint(["location_id"], ["location.id"], name="order_ibfk_1"),
|
2019-09-05 03:33:29 +02:00
|
|
|
sa.PrimaryKeyConstraint("id"),
|
2019-04-02 18:03:14 +02:00
|
|
|
)
|
2019-09-05 03:33:29 +02:00
|
|
|
op.create_table(
|
|
|
|
"product",
|
|
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("location_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("name", sa.String(length=120), nullable=False),
|
|
|
|
sa.Column("price", sa.Integer(), nullable=False),
|
|
|
|
sa.ForeignKeyConstraint(["location_id"], ["location.id"]),
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
2015-06-04 17:29:37 +02:00
|
|
|
)
|
2019-09-05 03:33:29 +02:00
|
|
|
op.create_table(
|
|
|
|
"order_item",
|
|
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("user_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("order_id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("product_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("paid", sa.Boolean(), nullable=True),
|
|
|
|
sa.Column("extra", sa.String(length=254), nullable=True),
|
|
|
|
sa.Column("name", sa.String(length=120), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(["order_id"], ["order.id"]),
|
2023-04-19 23:48:59 +02:00
|
|
|
sa.ForeignKeyConstraint(["product_id"], ["product.id"], name="order_item_ibfk_3"),
|
2019-09-05 03:33:29 +02:00
|
|
|
sa.ForeignKeyConstraint(["user_id"], ["user.id"]),
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
2015-06-04 17:29:37 +02:00
|
|
|
)
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### end Alembic commands ###
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2019-09-05 03:33:29 +02:00
|
|
|
op.drop_table("order_item")
|
|
|
|
op.drop_table("product")
|
|
|
|
op.drop_table("order")
|
|
|
|
op.drop_table("user")
|
|
|
|
op.drop_table("location")
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### end Alembic commands ###
|