I have an “Invoices” model for my Indico plugin:
class InvoiceItem(db.Model):
__tablename__ = 'invoice_items'
__table_args__ = {'schema': 'plugin_invoices'}
#: Invoice item ID
id = db.Column(db.Integer, primary_key=True)
invoice_id = db.Column(db.Integer, db.ForeignKey('invoices.id'))
item_number = db.Column(db.Integer)
currency = db.Column(db.String(3))
class InvoiceType(db.Model):
__tablename__ = 'invoice_types'
__table_args__ = {'schema': 'plugin_invoices'}
#: Invoice type ID
id = db.Column(db.Integer, primary_key=True)
invoice_id = db.Column(db.Integer, db.ForeignKey('invoices.id'))
class Invoice(db.Model):
__tablename__ = 'invoices'
__table_args__ = {'schema': 'plugin_invoices'}
#: Invoice ID
id = db.Column(db.Integer, primary_key=True)
#: Invoice Number
sequential_number = db.Column(db.Integer, nullable=False)
invoice_items = db.relationship("InvoiceItem", backref="invoices")
invoice_type = db.relationship("InvoiceType", backref="invoices")
created_by_id = db.Column(
db.Integer,
db.ForeignKey('users.users.id'),
index=True,
nullable=False)
created_on = db.Column(UTCDateTime, nullable=False, default=now_utc)
when I run the following command:
, I get the following error:
No idea how to fix it
Please help!