Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Ghost user migration

Daniel Hougaard3612e5834cba
diff --git a/backend/src/db/migrations/20240202093209_ghost_user.ts b/backend/src/db/migrations/20240202093209_ghost_user.ts
new file mode 100644
index 0000000000..7fa23d2459
--- /dev/null
+++ b/backend/src/db/migrations/20240202093209_ghost_user.ts
@@ -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");
+ });
+ }
+}