I am trying to create a connection between merchants
and transaction
I am bookshelf.
- There may be several vouchers in one transaction
- A voucher has a transaction key and a merchant key
- being able to pull the dealer out All exclusive transactions
My models are defined below:
var voucher = Bookshelf.Model.extend ({tableName: 'voucher', transaction : Work () {Return to this.Belongus (Transaction);}, Merchant: Function () Return to {Belguns To (Trader)}}}); Var Transactions = Bookshelf.Model.extend ({tableName: 'Transactions', Vouchers: Function ()} Return to this. Many (vouchers);}}); Var Merchant = Bookshelf.Model.extend ({tableName: 'merchants', voucher: function ()} this return.Hom many (voucher);}, transaction: function () {// ???}});
schema
var schema = {merchants: {id: {type: 'increments', nullable: false, primary: true}, category_id: { Type: 'string', type: 'integer', empty: false, unsigned: true, context: 'categories.id'}, name: {type: 'string', max length: 150, faucet: incorrect}, slug : {Type: 'string' Maxlength: 150, nullable: false, unique: true}, email: {type: 'string', maxlength: 254, nullable: false}, tel: {type: 'string', maxlength: 64 {Type: 'string', maxlength: 64, nullable: false}, city: {type: 'string'}, type: 'string', maxlength: 150, nullable: false}, province: , Maxlength: 254, nullable: {type: 'str Maximum length: 254, Fable: true}, Address: {type: 'text', maximum length: 2000, false: false}, created_a: {type: 'datetime', blueberry: false}, updated_at: { Type: 'DateTime', False: True}}, Transactions: {id: {type: 'increments', nullable: false, primary: true}, User_id: {type: 'integer', nullable: false, unsigned: true Reference: 'users.id'}, UUID: {type: 'string', maximum loudth: 128, empty: wrong}, raw: {type: 'integer, faucet: incorrect}, total_postage: {type: Integer ', empty : True}, made_at: {type: 'dateTime', nullable: false}, updated_at: {type: 'dateTime', nullable: true}}, voucher: {id: {type: 'increments', nullable: false, primary : True}, transaction_id: {type: 'integer', nullable: false, unsigned: true, context: 'transaction.id'}, merchant_id: {type: 'integer', nullable: false, unsigned: true, references: merchants 'User.id'}, vouchertemplate_id: {type: 'integer', nullable: false, unsigned: true, references: .id '}, user_id: {type:' integer ', nullable: false, unsigned: true, 'Vouchertemplates.id'}, voucher_number: {type: 'string', max (type: 'integer', faucet: wrong, default: 0}, message: Type: 'Integer' Maxlength: 254, nullable: false}, recipient_name: 'string', length: 254, fable: incorrect}, value: {type: 'integer', faucet: incorrect}, redeem_evalu: {Type: 'string', maxlength: 254, nullable: false}, created_at: {type: 'dateTime', nullable: false}, updated_at: {type: 'dateTime' faucet: true}}};
I think the problem is in your schema, any dealer or transaction You can not even take the id one or the other, you can not currently join them. Probably modify schema in a while?
No comments:
Post a Comment