Merge pull request #52 from ZeusWPI/fix/none-bug
Fixed bug for volunteering closes #44
This commit is contained in:
commit
795746bbd1
2 changed files with 29 additions and 2 deletions
26
app/migrations/versions/42709384216_.py
Normal file
26
app/migrations/versions/42709384216_.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
"""Removed foreign key constraint
|
||||||
|
|
||||||
|
Revision ID: 42709384216
|
||||||
|
Revises: 57a00d0b7bc
|
||||||
|
Create Date: 2015-06-04 22:34:05.237943
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '42709384216'
|
||||||
|
down_revision = '57a00d0b7bc'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint('order_ibfk_1', 'order', type_='foreignkey')
|
||||||
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_foreign_key('order_ibfk_1', 'order', 'user', ['courrier_id'], ['id'])
|
||||||
|
### end Alembic commands ###
|
|
@ -10,7 +10,8 @@ class User(db.Model):
|
||||||
username = db.Column(db.String(80), unique=True, nullable=False)
|
username = db.Column(db.String(80), unique=True, nullable=False)
|
||||||
admin = db.Column(db.Boolean)
|
admin = db.Column(db.Boolean)
|
||||||
bias = db.Column(db.Integer)
|
bias = db.Column(db.Integer)
|
||||||
runs = db.relationship('Order', backref='courrier', lazy='dynamic')
|
runs = db.relation('Order', backref='courrier', primaryjoin='Order.courrier_id==User.id',
|
||||||
|
foreign_keys='Order.courrier_id')
|
||||||
orderItems = db.relationship('OrderItem', backref='user', lazy='dynamic')
|
orderItems = db.relationship('OrderItem', backref='user', lazy='dynamic')
|
||||||
|
|
||||||
def configure(self, username, admin, bias):
|
def configure(self, username, admin, bias):
|
||||||
|
@ -76,7 +77,7 @@ class Product(db.Model):
|
||||||
|
|
||||||
class Order(db.Model):
|
class Order(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
courrier_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
|
courrier_id = db.Column(db.Integer, nullable=True)
|
||||||
location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
|
location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
|
||||||
starttime = db.Column(db.DateTime)
|
starttime = db.Column(db.DateTime)
|
||||||
stoptime = db.Column(db.DateTime)
|
stoptime = db.Column(db.DateTime)
|
||||||
|
|
Loading…
Reference in a new issue