add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
exports.up = (knex) => knex.schema.createTable('password_resets', (table) => {
table.increments();
table.string('email').index();
table.string('token').index();
table.timestamp('created_at');
});
exports.down = (knex) => knex.schema.dropTableIfExists('password_resets');

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('tenants', (table) => {
table.bigIncrements();
table.string('organization_id').index();
table.dateTime('under_maintenance_since').nullable();
table.dateTime('initialized_at').nullable();
table.dateTime('seeded_at').nullable();
table.dateTime('built_at').nullable();
table.string('build_job_id');
table.integer('database_batch');
table.string('upgrade_job_id');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('tenants');
};

View File

@@ -0,0 +1,26 @@
exports.up = (knex) => {
return knex.schema.createTable('users', (table) => {
table.increments();
table.string('first_name');
table.string('last_name');
table.string('email').index();
table.string('phone_number').index();
table.string('password');
table.boolean('active').index();
table.string('language');
table
.bigInteger('tenant_id')
.unsigned()
.index()
.references('id')
.inTable('tenants');
table.dateTime('invite_accepted_at').index();
table.dateTime('last_login_at').index();
table.dateTime('deleted_at').index();
table.timestamps();
});
};
exports.down = (knex) => {
return knex.schema.dropTableIfExists('users');
};

View File

@@ -0,0 +1,15 @@
exports.up = function(knex) {
return knex.schema.createTable('user_invites', (table) => {
table.increments();
table.string('email').index();
table.string('token').unique().index();
table.bigInteger('tenant_id').unsigned().index().references('id').inTable('tenants');
table.integer('user_id').unsigned().index().references('id').inTable('users');
table.datetime('created_at');
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('user_invites');
};

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('subscriptions_plans', table => {
table.increments();
table.string('name');
table.string('description');
table.decimal('price');
table.string('currency', 3);
table.integer('trial_period');
table.string('trial_interval');
table.integer('invoice_period');
table.string('invoice_interval');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('subscriptions_plans')
};

View File

@@ -0,0 +1,30 @@
exports.up = function(knex) {
return knex.schema.createTable('subscription_plans', table => {
table.increments();
table.string('slug');
table.string('name');
table.string('desc');
table.boolean('active');
table.decimal('price').unsigned();
table.string('currency', 3);
table.decimal('trial_period').nullable();
table.string('trial_interval').nullable();
table.decimal('invoice_period').nullable();
table.string('invoice_interval').nullable();
table.integer('index').unsigned();
table.timestamps();
}).then(() => {
return knex.seed.run({
specific: 'seed_subscriptions_plans.js',
});
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('subscription_plans')
};

View File

@@ -0,0 +1,15 @@
exports.up = function(knex) {
return knex.schema.createTable('subscription_plan_features', table => {
table.increments();
table.integer('plan_id').unsigned().index().references('id').inTable('subscription_plans');
table.string('slug');
table.string('name');
table.string('description');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('subscription_plan_features');
};

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('subscription_plan_subscriptions', table => {
table.increments('id');
table.string('slug');
table.integer('plan_id').unsigned().index().references('id').inTable('subscription_plans');
table.bigInteger('tenant_id').unsigned().index().references('id').inTable('tenants');
table.dateTime('starts_at').nullable();
table.dateTime('ends_at').nullable();
table.dateTime('cancels_at').nullable();
table.dateTime('canceled_at').nullable();
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('subscription_plan_subscriptions');
};

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('subscription_licenses', (table) => {
table.increments();
table.string('license_code').unique().index();
table.integer('plan_id').unsigned().index().references('id').inTable('subscription_plans');
table.integer('license_period').unsigned();
table.string('period_interval');
table.dateTime('sent_at').index();
table.dateTime('disabled_at').index();
table.dateTime('used_at').index();
table.timestamps();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('subscription_licenses');
};

View File

@@ -0,0 +1,22 @@
exports.up = function (knex) {
return knex.schema.createTable('tenants_metadata', (table) => {
table.bigIncrements();
table.integer('tenant_id').unsigned();
table.string('name');
table.string('industry');
table.string('location');
table.string('base_currency');
table.string('language');
table.string('timezone');
table.string('date_format');
table.string('fiscal_year');
});
};
exports.down = function (knex) {
return knex.schema.dropTableIfExists('tenants_metadata');
};