mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
exports.up = (knex) => {
|
|
return knex.schema
|
|
.createTable('warehouses', (table) => {
|
|
table.increments();
|
|
table.string('name');
|
|
table.string('code');
|
|
|
|
table.string('address');
|
|
table.string('city');
|
|
table.string('country');
|
|
|
|
table.string('phone_number');
|
|
table.string('email');
|
|
table.string('website');
|
|
|
|
table.boolean('primary');
|
|
|
|
table.timestamps();
|
|
})
|
|
.createTable('warehouses_transfers', (table) => {
|
|
table.increments();
|
|
table.date('date');
|
|
table
|
|
.integer('to_warehouse_id')
|
|
.unsigned()
|
|
.references('id')
|
|
.inTable('warehouses');
|
|
table
|
|
.integer('from_warehouse_id')
|
|
.unsigned()
|
|
.references('id')
|
|
.inTable('warehouses');
|
|
table.string('transaction_number');
|
|
|
|
table.date('transfer_initiated_at');
|
|
table.date('transfer_delivered_at');
|
|
|
|
table.timestamps();
|
|
})
|
|
.createTable('warehouses_transfers_entries', (table) => {
|
|
table.increments();
|
|
table.integer('index');
|
|
table
|
|
.integer('warehouse_transfer_id')
|
|
.unsigned()
|
|
.references('id')
|
|
.inTable('warehouses_transfers');
|
|
table.integer('item_id').unsigned().references('id').inTable('items');
|
|
table.string('description');
|
|
table.integer('quantity');
|
|
table.decimal('cost');
|
|
});
|
|
};
|
|
|
|
exports.down = (knex) => {
|
|
return knex.schema
|
|
.dropTableIfExists('vendor_credit_applied_bill')
|
|
.dropTableIfExists('credit_note_applied_invoice');
|
|
};
|