The best way to control Claude Code, Codex and more from any computer or phone

main
ts 65 lines 1.96 KB
Raw
1 #!/usr/bin/env -S node
2 import { Migration, MigrationCLI, col, fn, primaryKey } from "@internal/postgres/migration";
3 import type { Contract as End } from "../../snapshots/7de60ab4aee8baa42480f8a2d3559ff4027deae801de73c6a93c9eeb4170f558/contract";
4 import endContract from "../../snapshots/7de60ab4aee8baa42480f8a2d3559ff4027deae801de73c6a93c9eeb4170f558/contract.json" with { type: "json" };
5
6 export default class M extends Migration<never, End> {
7 override readonly endContractJson = endContract;
8
9 override get operations() {
10 return [
11 this.createSchema({ schema: "public" }),
12 this.createTable({
13 schema: "public",
14 table: "Post",
15 columns: [
16 col("authorId", "uuid", {
17 notNull: true,
18 codecRef: { codecId: "pg/uuid@1" },
19 }),
20 col("id", "uuid", {
21 notNull: true,
22 codecRef: { codecId: "pg/uuid@1" },
23 }),
24 col("title", "text", {
25 notNull: true,
26 codecRef: { codecId: "pg/text@1" },
27 }),
28 ],
29 constraints: [primaryKey(["id"])],
30 }),
31 this.createTable({
32 schema: "public",
33 table: "User",
34 columns: [
35 col("createdAt", "timestamptz", {
36 notNull: true,
37 default: fn("now()"),
38 codecRef: { codecId: "pg/timestamptz-string@1" },
39 }),
40 col("email", "text", {
41 notNull: true,
42 codecRef: { codecId: "pg/text@1" },
43 }),
44 col("id", "uuid", {
45 notNull: true,
46 codecRef: { codecId: "pg/uuid@1" },
47 }),
48 col("name", "text", {
49 notNull: true,
50 codecRef: { codecId: "pg/text@1" },
51 }),
52 ],
53 constraints: [primaryKey(["id"])],
54 }),
55 this.addUnique({
56 schema: "public",
57 table: "User",
58 constraint: "User_email_key",
59 columns: ["email"],
60 }),
61 ];
62 }
63 }
64
65 MigrationCLI.run(import.meta.url, M);