Error creating DB migration for Plugin model

You forgot the schema:

invoice_id = db.Column(db.ForeignKey('plugin_invoices.invoices.id'))

General advice:

  • You can omit te type (first argument) for FK columns, since SA can automatically use the target column’s type.
  • Providing a length indicator for db.String() is Postgres is not necessary and usualy not particularly useful.
  • depending on how the sequential_number works (why can’t you use the ID) you may be able to use logic similar to what we do for friendly_id (sequential numbers scoped to something else, like the event) in the core to auto-generate it
  • I’d rename created_by_id to creator_id (and the relationship which you probably have from created_by to creator). Using *_by_id for FKs/relationships is a weird naming scheme we only used for a very short time in the core and then ditched it in favor of less awkward-sounding names.