WIP Multi-tenant architecture.

This commit is contained in:
Ahmed Bouhuolia
2020-04-21 22:47:27 +02:00
parent 4e0d3feebe
commit 8f588ffc51
64 changed files with 812 additions and 447 deletions

View File

@@ -0,0 +1,25 @@
exports.up = function (knex) {
return knex.schema.createTable('users', (table) => {
table.increments();
table.string('first_name');
table.string('last_name');
table.string('email').unique();
table.string('phone_number').unique();
table.string('password');
table.boolean('active');
table.integer('role_id').unique();
table.string('language');
table.date('last_login_at');
table.integer('tenant_id').unsigned();
table.timestamps();
}).then(() => {
// knex.seed.run({
// specific: 'seed_users.js',
// })
});
};
exports.down = function (knex) {
return knex.schema.dropTableIfExists('users');
};

View File

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