fix: database migrations FK relations.

fix: database columns indexing.
This commit is contained in:
Ahmed Bouhuolia
2020-10-03 12:08:11 +02:00
parent 1250eccc0d
commit 0114ed9f8b
86 changed files with 788 additions and 801 deletions

View File

@@ -4,17 +4,17 @@ exports.up = function(knex) {
table.increments();
table.decimal('credit', 13, 3);
table.decimal('debit', 13, 3);
table.string('transaction_type');
table.string('reference_type');
table.integer('reference_id');
table.integer('account_id').unsigned();
table.string('contact_type').nullable();
table.integer('contact_id').unsigned().nullable();
table.string('transaction_type').index();
table.string('reference_type').index();
table.integer('reference_id').index();
table.integer('account_id').unsigned().index().references('id').inTable('accounts');
table.string('contact_type').nullable().index();
table.integer('contact_id').unsigned().nullable().index().references('id').inTable('contacts');
table.string('note');
table.boolean('draft').defaultTo(false);
table.integer('user_id').unsigned();
table.integer('user_id').unsigned().index();
table.integer('index').unsigned();
table.date('date');
table.date('date').index();
table.timestamps();
}).raw('ALTER TABLE `ACCOUNTS_TRANSACTIONS` AUTO_INCREMENT = 1000');
};