WIP server side.

This commit is contained in:
Ahmed Bouhuolia
2020-01-22 02:09:45 +02:00
parent de905d7e7c
commit 488709088b
123 changed files with 14885 additions and 771 deletions

View File

@@ -7,6 +7,8 @@ exports.up = function (knex) {
table.integer('parent_account_id');
table.string('code', 10);
table.text('description');
table.boolean('active').defaultTo(true);
table.integer('index').unsigned();
table.timestamps();
});
};

View File

@@ -1,11 +1,11 @@
exports.up = function (knex) {
return knex.schema.createTable('account_balance', (table) => {
return knex.schema.createTable('account_balances', (table) => {
table.increments();
table.integer('account_id');
table.decimal('amount');
table.decimal('amount', 15, 5);
table.string('currency_code', 3);
});
};
exports.down = (knex) => knex.schema.dropTableIfExists('account_balance');
exports.down = (knex) => knex.schema.dropTableIfExists('account_balances');

View File

@@ -3,6 +3,9 @@ exports.up = function (knex) {
return knex.schema.createTable('account_types', (table) => {
table.increments();
table.string('name');
table.string('normal');
table.boolean('balance_sheet');
table.boolean('income_sheet');
});
};

View File

@@ -3,11 +3,13 @@ exports.up = function (knex) {
return knex.schema.createTable('resource_fields', (table) => {
table.increments();
table.string('label_name');
table.string('slug');
table.string('data_type');
table.string('help_text');
table.string('default');
table.boolean('active');
table.boolean('predefined');
table.boolean('columnable');
table.json('options');
table.integer('resource_id').unsigned().references('id').inTable('resources');
});

View File

@@ -5,6 +5,7 @@ exports.up = function (knex) {
table.string('name');
table.boolean('predefined');
table.integer('resource_id').unsigned().references('id').inTable('resources');
table.string('roles_logic_expression');
});
};

View File

@@ -0,0 +1,20 @@
exports.up = function(knex) {
return knex.schema.createTable('accounts_transactions', (table) => {
table.increments();
table.decimal('credit');
table.decimal('debit');
table.string('transaction_type');
table.string('reference_type');
table.integer('reference_id');
table.integer('account_id').unsigned().references('id').inTable('accounts');
table.string('note');
table.integer('user_id').unsigned().references('id').inTable('users');
table.date('date');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('accounts_transactions');
};

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('options', (table) => {
table.increments();
table.string('key');
table.string('value');
table.string('group');
table.string('type');
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('options');
};

View File

@@ -0,0 +1,20 @@
exports.up = function(knex) {
return knex.schema.createTable('expenses', (table) => {
table.increments();
table.decimal('amount');
table.string('currency_code');
table.decimal('exchange_rate');
table.text('description');
table.integer('expense_account_id').unsigned().references('id').inTable('accounts');
table.integer('payment_account_id').unsigned().references('id').inTable('accounts');
table.string('reference');
table.integer('user_id').unsigned().references('id').inTable('users');
table.date('date');
// table.timestamps();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('expenses');
};

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('currency_adjustments', (table) => {
table.increments();
table.date('date');
table.string('currency_code');
table.decimal('exchange_rate');
table.string('note');
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('currency_adjustments');
};

View File

@@ -0,0 +1,17 @@
exports.up = function(knex) {
return knex.schema.createTable('manual_journals', (table) => {
table.increments();
table.string('reference');
table.string('transaction_type');
table.decimal('amount');
table.date('date');
table.string('note');
table.integer('user_id').unsigned().references('id').inTable('users');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('manual_journals');
};

View File

@@ -0,0 +1,12 @@
exports.up = function(knex) {
return knex.schema.createTable('recurring_journals', (table) => {
table.increments();
table.string('template_name');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('recurring_journals');
};

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('budgets', (table) => {
table.increments();
table.string('name');
table.string('fiscal_year');
table.string('period');
table.string('account_types');
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('budgets');
};

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('budget_entries', (table) => {
table.increments();
table.integer('budget_id').unsigned().references('id').inTable('budgets');
table.integer('account_id').unsigned().references('id').inTable('accounts');
table.decimal('amount', 15, 5);
table.integer('order');
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('budget_entries');
};