Ignore:
Timestamp:
12/20/25 01:31:36 (7 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
0d447f6
Parents:
b69759d
Message:

add constraints

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database/drizzle/schema/builds.ts

    rb69759d rb615094  
    1 import { pgTable, serial, integer, text, numeric, boolean, date, primaryKey } from "drizzle-orm/pg-core";
     1import {pgTable, serial, integer, text, numeric, boolean, date, primaryKey, check} from "drizzle-orm/pg-core";
    22import { usersTable } from "./users";
    33import { componentsTable } from "./components";
     4import {sql} from "drizzle-orm";
    45
    56export const buildsTable = pgTable("build", {
     
    5253    (t) => ({
    5354        pk: primaryKey({ columns: [t.buildId, t.userId] }),
     55        checkValue: check("check_value", sql`${t.value} BETWEEN 1 AND 5`),
    5456    }),
    5557);
Note: See TracChangeset for help on using the changeset viewer.