Files
bigcapital/server/src/database/migrations/20200104232647_create_accounts_transactions_table.js
Ahmed Bouhuolia 0114ed9f8b fix: database migrations FK relations.
fix: database columns indexing.
2020-10-03 12:08:11 +02:00

25 lines
962 B
JavaScript

exports.up = function(knex) {
return knex.schema.createTable('accounts_transactions', (table) => {
table.increments();
table.decimal('credit', 13, 3);
table.decimal('debit', 13, 3);
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().index();
table.integer('index').unsigned();
table.date('date').index();
table.timestamps();
}).raw('ALTER TABLE `ACCOUNTS_TRANSACTIONS` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('accounts_transactions');
};