mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Ghost user migration
This commit is contained in:
31
backend/src/db/migrations/20240202093209_ghost_user.ts
Normal file
31
backend/src/db/migrations/20240202093209_ghost_user.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Knex } from "knex";
|
||||
|
||||
import { TableName } from "../schemas";
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
if (!(await knex.schema.hasColumn(TableName.Users, "ghost"))) {
|
||||
await knex.schema.alterTable(TableName.Users, (t) => {
|
||||
t.boolean("ghost").defaultTo(false).notNullable();
|
||||
});
|
||||
}
|
||||
|
||||
if (!(await knex.schema.hasColumn(TableName.Project, "e2ee"))) {
|
||||
await knex.schema.alterTable(TableName.Project, (t) => {
|
||||
t.boolean("e2ee").defaultTo(true).notNullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
if (await knex.schema.hasColumn(TableName.Users, "ghost")) {
|
||||
await knex.schema.alterTable(TableName.Users, (t) => {
|
||||
t.dropColumn("ghost");
|
||||
});
|
||||
}
|
||||
|
||||
if (await knex.schema.hasColumn(TableName.Project, "e2ee")) {
|
||||
await knex.schema.alterTable(TableName.Project, (t) => {
|
||||
t.dropColumn("e2ee");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user