Migration

This commit is contained in:
Charlotte Van Petegem 2022-05-20 21:34:18 +02:00
parent 8a2b9247e1
commit c43efa4b10
No known key found for this signature in database
GPG key ID: 019E764B7184435A
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,28 @@
"""Add user associations
Revision ID: 5c8378aa4dff
Revises: 55013fe95bea
Create Date: 2022-05-20 21:32:47.786340
"""
# revision identifiers, used by Alembic.
revision = '5c8378aa4dff'
down_revision = '55013fe95bea'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('order', sa.Column('association', sa.String(length=120), nullable=True))
op.add_column('user', sa.Column('associations', sa.String(length=120), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'associations')
op.drop_column('order', 'association')
# ### end Alembic commands ###

View file

@ -27,6 +27,7 @@ class Order(db.Model):
stoptime = db.Column(db.DateTime) stoptime = db.Column(db.DateTime)
public = db.Column(db.Boolean, default=True) public = db.Column(db.Boolean, default=True)
slug = db.Column(db.String(7), default=generate_slug, unique=True) slug = db.Column(db.String(7), default=generate_slug, unique=True)
association = db.Column(db.String(120))
items = db.relationship("OrderItem", backref="order", lazy="dynamic") items = db.relationship("OrderItem", backref="order", lazy="dynamic")