Skip to content

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

Ghost

Daniel Hougaard6064c393c645
diff --git a/backend/src/db/migrations/20240202093209_ghost_user.ts b/backend/src/db/migrations/20240202093209_ghost_user.ts
index 7fa23d2459..72181cd835 100644
--- a/backend/src/db/migrations/20240202093209_ghost_user.ts
+++ b/backend/src/db/migrations/20240202093209_ghost_user.ts
@@ -1,31 +1,37 @@
import { Knex } from "knex";
-import { TableName } from "../schemas";
+import { ProjectVersion, TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
- if (!(await knex.schema.hasColumn(TableName.Users, "ghost"))) {
+ const hasGhostUserColumn = await knex.schema.hasColumn(TableName.Users, "ghost");
+ const hasProjectVersionColumn = await knex.schema.hasColumn(TableName.Project, "version");
+
+ if (!hasGhostUserColumn) {
await knex.schema.alterTable(TableName.Users, (t) => {
t.boolean("ghost").defaultTo(false).notNullable();
});
}
- if (!(await knex.schema.hasColumn(TableName.Project, "e2ee"))) {
+ if (!hasProjectVersionColumn) {
await knex.schema.alterTable(TableName.Project, (t) => {
- t.boolean("e2ee").defaultTo(true).notNullable();
+ t.string("version").defaultTo(ProjectVersion.V1).notNullable();
});
}
}
export async function down(knex: Knex): Promise<void> {
- if (await knex.schema.hasColumn(TableName.Users, "ghost")) {
+ const hasGhostUserColumn = await knex.schema.hasColumn(TableName.Users, "ghost");
+ const hasProjectVersionColumn = await knex.schema.hasColumn(TableName.Project, "version");
+
+ if (hasGhostUserColumn) {
await knex.schema.alterTable(TableName.Users, (t) => {
t.dropColumn("ghost");
});
}
- if (await knex.schema.hasColumn(TableName.Project, "e2ee")) {
+ if (hasProjectVersionColumn) {
await knex.schema.alterTable(TableName.Project, (t) => {
- t.dropColumn("e2ee");
+ t.dropColumn("version");
});
}
}