WIP pass the failed tests.

This commit is contained in:
Ahmed Bouhuolia
2020-05-17 07:08:12 +02:00
parent 00de156c9f
commit 10f636d2bc
77 changed files with 2164 additions and 1403 deletions

View File

@@ -5,6 +5,8 @@ exports.up = (knex) => knex.schema.createTable('roles', (table) => {
table.string('description');
table.boolean('predefined').default(false);
table.timestamps();
});
}).raw('ALTER TABLE `ROLES` AUTO_INCREMENT = 1000');
exports.down = (knex) => knex.schema.dropTable('roles');

View File

@@ -13,7 +13,7 @@ exports.up = function (knex) {
table.date('invite_accepted_at');
table.timestamps();
});
}).raw('ALTER TABLE `USERS` AUTO_INCREMENT = 1000');;
};
exports.down = function (knex) {

View File

@@ -1,16 +0,0 @@
exports.up = function(knex) {
return knex.schema.createTable('oauth_tokens', (table) => {
table.increments();
table.string('access_token');
table.date('access_token_expires_on');
table.integer('client_id').unsigned();
table.string('refresh_token');
table.date('refresh_token_expires_on');
table.integer('user_id').unsigned();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('oauth_tokens');
};

View File

@@ -1,11 +0,0 @@
exports.up = function(knex) {
return knex.schema.createTable('oauth_clients', (table) => {
table.increments();
table.integer('client_id').unsigned();
table.string('client_secret');
table.string('redirect_uri');
});
};
exports.down = (knex) => knex.schema.dropTableIfExists('oauth_clients');

View File

@@ -7,7 +7,7 @@ exports.up = function (knex) {
table.string('type');
table.string('key');
table.string('value');
});
}).raw('ALTER TABLE `SETTINGS` AUTO_INCREMENT = 2000');
};
exports.down = (knex) => knex.schema.dropTableIfExists('settings');

View File

@@ -4,6 +4,7 @@ exports.up = function (knex) {
table.increments();
table.string('name');
table.string('type');
table.string('sku');
table.decimal('cost_price').unsigned();
table.decimal('sell_price').unsigned();
table.string('currency_code', 3);
@@ -15,7 +16,7 @@ exports.up = function (knex) {
table.integer('category_id').unsigned();
table.integer('user_id').unsigned();
table.timestamps();
});
}).raw('ALTER TABLE `ITEMS` AUTO_INCREMENT = 1000');;
};
exports.down = (knex) => knex.schema.dropTableIfExists('items');

View File

@@ -1,7 +1,7 @@
exports.up = function (knex) {
return knex.schema.createTable('accounts', (table) => {
table.increments();
table.bigIncrements('id').comment('Auto-generated id');;
table.string('name');
table.integer('account_type_id');
table.integer('parent_account_id');
@@ -11,7 +11,7 @@ exports.up = function (knex) {
table.integer('index').unsigned();
table.boolean('predefined').defaultTo(false);
table.timestamps();
}).then(() => {
}).raw('ALTER TABLE `ACCOUNTS` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({
specific: 'seed_accounts.js',
});

View File

@@ -1,11 +0,0 @@
exports.up = function (knex) {
return knex.schema.createTable('items_metadata', (table) => {
table.increments();
table.string('key');
table.string('value');
table.integer('item_id').unsigned();
});
};
exports.down = (knex) => knex.schema.dropTableIfExists('items_metadata');

View File

@@ -7,7 +7,7 @@ exports.up = (knex) => {
table.string('root_type');
table.boolean('balance_sheet');
table.boolean('income_sheet');
}).then(() => {
}).raw('ALTER TABLE `ACCOUNT_TYPES` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({
specific: 'seed_account_types.js',
});

View File

@@ -14,7 +14,7 @@ exports.up = function (knex) {
table.integer('index');
table.json('options');
table.integer('resource_id').unsigned();
}).then(() => {
}).raw('ALTER TABLE `RESOURCE_FIELDS` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({
specific: 'seed_resources_fields.js',
});

View File

@@ -5,6 +5,8 @@ exports.up = function (knex) {
table.integer('view_id').unsigned();
table.integer('field_id').unsigned();
table.integer('index').unsigned();
}).raw('ALTER TABLE `ITEMS_CATEGORIES` AUTO_INCREMENT = 1000').then(() => {
});
};

View File

@@ -7,7 +7,7 @@ exports.up = function (knex) {
table.string('comparator');
table.string('value');
table.integer('view_id').unsigned();
}).then(() => {
}).raw('ALTER TABLE `VIEW_ROLES` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({
specific: 'seed_views_roles.js',
});

View File

@@ -7,7 +7,7 @@ exports.up = function (knex) {
table.integer('resource_id').unsigned().references('id').inTable('resources');
table.boolean('favourite');
table.string('roles_logic_expression');
}).then(() => {
}).raw('ALTER TABLE `VIEWS` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({
specific: 'seed_views.js',
});

View File

@@ -13,7 +13,7 @@ exports.up = function(knex) {
table.integer('user_id').unsigned();
table.date('date');
table.timestamps();
});
}).raw('ALTER TABLE `ACCOUNTS_TRANSACTIONS` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {

View File

@@ -12,7 +12,7 @@ exports.up = function(knex) {
table.string('attachment_file');
table.integer('user_id').unsigned();
table.timestamps();
});
}).raw('ALTER TABLE `MANUAL_JOURNALS` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {

View File

@@ -4,7 +4,7 @@ exports.up = function(knex) {
table.increments();
table.string('currency_name');
table.string('currency_code', 4);
})
}).raw('ALTER TABLE `CURRENCIES` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {

View File

@@ -5,7 +5,7 @@ exports.up = function(knex) {
table.string('currency_code', 4);
table.decimal('exchange_rate');
table.date('date');
});
}).raw('ALTER TABLE `EXCHANGE_RATES` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {