mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: link pdf template to sales transactions
This commit is contained in:
@@ -3,13 +3,49 @@
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.createTable('pdf_templates', (table) => {
|
||||
table.increments('id').primary();
|
||||
table.text('resource');
|
||||
table.text('template_name');
|
||||
table.json('attributes');
|
||||
table.timestamps();
|
||||
});
|
||||
return knex.schema
|
||||
.createTable('pdf_templates', (table) => {
|
||||
table.increments('id').primary();
|
||||
table.text('resource');
|
||||
table.text('template_name');
|
||||
table.json('attributes');
|
||||
table.timestamps();
|
||||
})
|
||||
.table('sales_invoices', (table) => {
|
||||
table
|
||||
.integer('pdf_template_id')
|
||||
.unsigned()
|
||||
.references('id')
|
||||
.inTable('pdf_templates');
|
||||
})
|
||||
.table('sales_estimates', (table) => {
|
||||
table
|
||||
.integer('pdf_template_id')
|
||||
.unsigned()
|
||||
.references('id')
|
||||
.inTable('pdf_templates');
|
||||
})
|
||||
.table('sales_receipts', (table) => {
|
||||
table
|
||||
.integer('pdf_template_id')
|
||||
.unsigned()
|
||||
.references('id')
|
||||
.inTable('pdf_templates');
|
||||
})
|
||||
.table('credit_notes', (table) => {
|
||||
table
|
||||
.integer('pdf_template_id')
|
||||
.unsigned()
|
||||
.references('id')
|
||||
.inTable('pdf_templates');
|
||||
})
|
||||
.table('payment_receives', (table) => {
|
||||
table
|
||||
.integer('pdf_template_id')
|
||||
.unsigned()
|
||||
.references('id')
|
||||
.inTable('pdf_templates');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -17,5 +53,21 @@ exports.up = function (knex) {
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTableIfExists('pdf_templates');
|
||||
return knex.schema
|
||||
.table('payment_receives', (table) => {
|
||||
table.dropColumn('pdf_template_id');
|
||||
})
|
||||
.table('credit_notes', (table) => {
|
||||
table.dropColumn('pdf_template_id');
|
||||
})
|
||||
.table('sales_receipts', (table) => {
|
||||
table.dropColumn('pdf_template_id');
|
||||
})
|
||||
.table('sales_estimates', (table) => {
|
||||
table.dropColumn('pdf_template_id');
|
||||
})
|
||||
.table('sales_invoices', (table) => {
|
||||
table.dropColumn('pdf_template_id');
|
||||
})
|
||||
.dropTableIfExists('pdf_templates');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user