diff --git a/server/db/pg/schema/schema.ts b/server/db/pg/schema/schema.ts index 4bed23f8..2d05fcd1 100644 --- a/server/db/pg/schema/schema.ts +++ b/server/db/pg/schema/schema.ts @@ -671,6 +671,17 @@ export const setupTokens = pgTable("setupTokens", { dateUsed: varchar("dateUsed") }); +// Blueprint runs +export const blueprints = pgTable("blueprints", { + blueprintId: serial("blueprintId").primaryKey(), + name: varchar("name").notNull(), + source: varchar("source"), + createdAt: integer("createdAt").notNull(), + succeeded: boolean("succeeded").notNull(), + contents: text("contents").notNull(), + message: text("message") +}); + export type Org = InferSelectModel; export type User = InferSelectModel; export type Site = InferSelectModel; @@ -722,3 +733,4 @@ export type SetupToken = InferSelectModel; export type HostMeta = InferSelectModel; export type TargetHealthCheck = InferSelectModel; export type IdpOidcConfig = InferSelectModel; +export type Blueprint = InferSelectModel; diff --git a/server/db/sqlite/schema/schema.ts b/server/db/sqlite/schema/schema.ts index e15f8166..ba6baebc 100644 --- a/server/db/sqlite/schema/schema.ts +++ b/server/db/sqlite/schema/schema.ts @@ -717,13 +717,18 @@ export const idpOrg = sqliteTable("idpOrg", { }); // Blueprint runs -export const blueprintRuns = sqliteTable("blueprintRuns", { - blueprintRunId: integer("blueprintRunId").primaryKey({ +export const blueprints = sqliteTable("blueprints", { + blueprintId: integer("blueprintId").primaryKey({ autoIncrement: true }), + orgId: text("orgId") + .references(() => orgs.orgId, { + onDelete: "cascade" + }) + .notNull(), name: text("name").notNull(), - source: text("source", { enum: ["WEB", "CLI", "API"] }), - createdAt: integer("createdAt", { mode: "timestamp" }).notNull(), + source: text("source"), + createdAt: integer("createdAt").notNull(), succeeded: integer("succeeded", { mode: "boolean" }).notNull(), contents: text("contents").notNull(), message: text("message") @@ -780,3 +785,4 @@ export type SetupToken = InferSelectModel; export type HostMeta = InferSelectModel; export type TargetHealthCheck = InferSelectModel; export type IdpOidcConfig = InferSelectModel; +export type Blueprint = InferSelectModel;