Skip to content

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

Ghost

Daniel Hougaard8fd99855bdaa
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");
});
}
}
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.ts
index e817d6ed04..4109c516ce 100644
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@ -112,6 +112,11 @@ export enum SecretType {
Personal = "personal"
}
+export enum ProjectVersion {
+ V1 = "v1",
+ V2 = "v2"
+}
+
export enum IdentityAuthMethod {
Univeral = "universal-auth"
}
diff --git a/backend/src/db/schemas/projects.ts b/backend/src/db/schemas/projects.ts
index 8c20ca7033..fceb183886 100644
--- a/backend/src/db/schemas/projects.ts
+++ b/backend/src/db/schemas/projects.ts
@@ -15,7 +15,7 @@ export const ProjectsSchema = z.object({
orgId: z.string().uuid(),
createdAt: z.date(),
updatedAt: z.date(),
- e2ee: z.boolean().default(true)
+ version: z.string().default("v1")
});
export type TProjects = z.infer<typeof ProjectsSchema>;