Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add updated at column #66

Merged
merged 14 commits into from
Nov 1, 2024
Binary file modified bun.lockb
Binary file not shown.
12 changes: 12 additions & 0 deletions drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export const organizations = pgTable("organizations", {
dbId: serial("db_id").primaryKey(),
name: text("name").notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at")
.defaultNow()
.notNull()
.$onUpdate(() => new Date()),
});

export const subscriptions = pgTable("subscriptions", {
Expand Down Expand Up @@ -75,6 +79,10 @@ export const teams = pgTable("teams", {
.references(() => organizations.dbId),
name: text("name").notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at")
.defaultNow()
.notNull()
.$onUpdate(() => new Date()),
});

export type UserId = `usr_${string}`;
Expand Down Expand Up @@ -138,6 +146,10 @@ export const agents = pgTable("agents", {
}),
graphHash: text("graph_hash").unique(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at")
.defaultNow()
.notNull()
.$onUpdate(() => new Date()),
});

export const builds = pgTable("builds", {
Expand Down
3 changes: 3 additions & 0 deletions migrations/0005_smart_vapor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "agents" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint
ALTER TABLE "organizations" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint
ALTER TABLE "teams" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;
Loading