🗃️ finish db schemas for blueprints

This commit is contained in:
Fred KISSIE
2025-10-22 23:49:13 +02:00
parent 6521b66b7c
commit 9024b2a974
2 changed files with 22 additions and 4 deletions

View File

@@ -671,6 +671,17 @@ export const setupTokens = pgTable("setupTokens", {
dateUsed: varchar("dateUsed") 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<typeof orgs>; export type Org = InferSelectModel<typeof orgs>;
export type User = InferSelectModel<typeof users>; export type User = InferSelectModel<typeof users>;
export type Site = InferSelectModel<typeof sites>; export type Site = InferSelectModel<typeof sites>;
@@ -722,3 +733,4 @@ export type SetupToken = InferSelectModel<typeof setupTokens>;
export type HostMeta = InferSelectModel<typeof hostMeta>; export type HostMeta = InferSelectModel<typeof hostMeta>;
export type TargetHealthCheck = InferSelectModel<typeof targetHealthCheck>; export type TargetHealthCheck = InferSelectModel<typeof targetHealthCheck>;
export type IdpOidcConfig = InferSelectModel<typeof idpOidcConfig>; export type IdpOidcConfig = InferSelectModel<typeof idpOidcConfig>;
export type Blueprint = InferSelectModel<typeof blueprints>;

View File

@@ -717,13 +717,18 @@ export const idpOrg = sqliteTable("idpOrg", {
}); });
// Blueprint runs // Blueprint runs
export const blueprintRuns = sqliteTable("blueprintRuns", { export const blueprints = sqliteTable("blueprints", {
blueprintRunId: integer("blueprintRunId").primaryKey({ blueprintId: integer("blueprintId").primaryKey({
autoIncrement: true autoIncrement: true
}), }),
orgId: text("orgId")
.references(() => orgs.orgId, {
onDelete: "cascade"
})
.notNull(),
name: text("name").notNull(), name: text("name").notNull(),
source: text("source", { enum: ["WEB", "CLI", "API"] }), source: text("source"),
createdAt: integer("createdAt", { mode: "timestamp" }).notNull(), createdAt: integer("createdAt").notNull(),
succeeded: integer("succeeded", { mode: "boolean" }).notNull(), succeeded: integer("succeeded", { mode: "boolean" }).notNull(),
contents: text("contents").notNull(), contents: text("contents").notNull(),
message: text("message") message: text("message")
@@ -780,3 +785,4 @@ export type SetupToken = InferSelectModel<typeof setupTokens>;
export type HostMeta = InferSelectModel<typeof hostMeta>; export type HostMeta = InferSelectModel<typeof hostMeta>;
export type TargetHealthCheck = InferSelectModel<typeof targetHealthCheck>; export type TargetHealthCheck = InferSelectModel<typeof targetHealthCheck>;
export type IdpOidcConfig = InferSelectModel<typeof idpOidcConfig>; export type IdpOidcConfig = InferSelectModel<typeof idpOidcConfig>;
export type Blueprint = InferSelectModel<typeof blueprints>;