diff --git a/api/src/data/migrations/001.create-users-table.ts b/api/src/data/migrations/001.create-users-table.ts index 4df903d..2c786a9 100644 --- a/api/src/data/migrations/001.create-users-table.ts +++ b/api/src/data/migrations/001.create-users-table.ts @@ -1,29 +1,26 @@ import * as knex from "knex"; export async function up(knex: knex.Knex) { - await knex.schema.createTable("users", function(table) { - table.increments("id").notNullable().primary(); - table.string("email", 250).notNullable(); - table.string("auth_subject", 250).notNullable(); - table.string("first_name", 100); - table.string("last_name", 100); - table.string("display_name", 200); - table.string("title", 100); - table.string("department", 100); - table.string("division", 100); - table.string("branch", 100); - table.string("unit", 100); - table.boolean("is_active").defaultTo(true).notNullable(); + await knex.schema.createTable("users", function (table) { + table.increments("id").notNullable().primary(); + table.string("email", 250).notNullable(); + table.string("auth_subject", 250).notNullable(); + table.string("first_name", 100); + table.string("last_name", 100); + table.string("display_name", 200); + table.string("title", 100); + table.string("department", 100); + table.string("division", 100); + table.string("branch", 100); + table.string("unit", 100); + table.boolean("is_active").defaultTo(true).notNullable(); - table.unique(["email"], { - indexName: "unique_users_email", - }); - table.unique(["auth_subject"], { - indexName: "unique_users_auth_subject", - }); + table.unique(["email"], { + indexName: "unique_users_email", }); -}; + }); +} export async function down(knex: knex.Knex) { - await knex.schema.dropTable("users"); -}; + await knex.schema.dropTable("users"); +} diff --git a/api/src/data/migrations/029.drop_auth_index.ts b/api/src/data/migrations/029.drop_auth_index.ts deleted file mode 100644 index 2799dc5..0000000 --- a/api/src/data/migrations/029.drop_auth_index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as knex from "knex"; - -export async function up(knex: knex.Knex) { - return knex.schema.alterTable("users", (table) => { - table.dropChecks("unique_users_auth_subject") - }); -} - -export async function down(knex: knex.Knex) { - return knex.schema.alterTable("users", (table) => { - table.unique(["auth_subject"], { - indexName: "unique_users_auth_subject", - }); - }); -}