import {
    pgTable,
    uuid,
    timestamp,
    text,
} from "drizzle-orm/pg-core"

import { checks } from "./checks"

export const checkexecutions = pgTable("checkexecutions", {
    id: uuid("id").primaryKey().defaultRandom(),

    createdAt: timestamp("created_at", { withTimezone: true })
        .notNull()
        .defaultNow(),

    check: uuid("check").references(() => checks.id),

    executedAt: timestamp("executed_at"),

    // ❌ executed_by removed (was 0_profiles)

    description: text("description"),
})

export type CheckExecution = typeof checkexecutions.$inferSelect
export type NewCheckExecution = typeof checkexecutions.$inferInsert
