a tool for shared writing and social publishing

migration to add created_at fields to domain tables

+25 -14
+8 -8
drizzle/relations.ts
··· 69 }), 70 })); 71 72 export const custom_domain_routesRelations = relations(custom_domain_routes, ({one}) => ({ 73 custom_domain: one(custom_domains, { 74 fields: [custom_domain_routes.domain], ··· 83 fields: [custom_domain_routes.view_permission_token], 84 references: [permission_tokens.id], 85 relationName: "custom_domain_routes_view_permission_token_permission_tokens_id" 86 - }), 87 - })); 88 - 89 - export const custom_domainsRelations = relations(custom_domains, ({one, many}) => ({ 90 - custom_domain_routes: many(custom_domain_routes), 91 - identity: one(identities, { 92 - fields: [custom_domains.identity], 93 - references: [identities.email] 94 }), 95 })); 96
··· 69 }), 70 })); 71 72 + export const custom_domainsRelations = relations(custom_domains, ({one, many}) => ({ 73 + identity: one(identities, { 74 + fields: [custom_domains.identity], 75 + references: [identities.email] 76 + }), 77 + custom_domain_routes: many(custom_domain_routes), 78 + })); 79 + 80 export const custom_domain_routesRelations = relations(custom_domain_routes, ({one}) => ({ 81 custom_domain: one(custom_domains, { 82 fields: [custom_domain_routes.domain], ··· 91 fields: [custom_domain_routes.view_permission_token], 92 references: [permission_tokens.id], 93 relationName: "custom_domain_routes_view_permission_token_permission_tokens_id" 94 }), 95 })); 96
+8 -6
drizzle/schema.ts
··· 88 country_code: text("country_code").notNull(), 89 }); 90 91 export const custom_domain_routes = pgTable("custom_domain_routes", { 92 id: uuid("id").defaultRandom().primaryKey().notNull(), 93 domain: text("domain").notNull().references(() => custom_domains.domain), 94 route: text("route").notNull(), 95 view_permission_token: uuid("view_permission_token").notNull().references(() => permission_tokens.id, { onDelete: "cascade", onUpdate: "cascade" } ), 96 edit_permission_token: uuid("edit_permission_token").notNull().references(() => permission_tokens.id, { onDelete: "cascade", onUpdate: "cascade" } ), 97 }, 98 (table) => { 99 return { 100 custom_domain_routes_domain_route_key: unique("custom_domain_routes_domain_route_key").on(table.domain, table.route), 101 } 102 - }); 103 - 104 - export const custom_domains = pgTable("custom_domains", { 105 - domain: text("domain").primaryKey().notNull(), 106 - identity: text("identity").default('').notNull().references(() => identities.email, { onDelete: "cascade", onUpdate: "cascade" } ), 107 - confirmed: boolean("confirmed").notNull(), 108 }); 109 110 export const phone_rsvps_to_entity = pgTable("phone_rsvps_to_entity", {
··· 88 country_code: text("country_code").notNull(), 89 }); 90 91 + export const custom_domains = pgTable("custom_domains", { 92 + domain: text("domain").primaryKey().notNull(), 93 + identity: text("identity").default('').notNull().references(() => identities.email, { onDelete: "cascade", onUpdate: "cascade" } ), 94 + confirmed: boolean("confirmed").notNull(), 95 + created_at: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), 96 + }); 97 + 98 export const custom_domain_routes = pgTable("custom_domain_routes", { 99 id: uuid("id").defaultRandom().primaryKey().notNull(), 100 domain: text("domain").notNull().references(() => custom_domains.domain), 101 route: text("route").notNull(), 102 view_permission_token: uuid("view_permission_token").notNull().references(() => permission_tokens.id, { onDelete: "cascade", onUpdate: "cascade" } ), 103 edit_permission_token: uuid("edit_permission_token").notNull().references(() => permission_tokens.id, { onDelete: "cascade", onUpdate: "cascade" } ), 104 + created_at: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), 105 }, 106 (table) => { 107 return { 108 custom_domain_routes_domain_route_key: unique("custom_domain_routes_domain_route_key").on(table.domain, table.route), 109 } 110 }); 111 112 export const phone_rsvps_to_entity = pgTable("phone_rsvps_to_entity", {
+6
supabase/database.types.ts
··· 36 Tables: { 37 custom_domain_routes: { 38 Row: { 39 domain: string 40 edit_permission_token: string 41 id: string ··· 43 view_permission_token: string 44 } 45 Insert: { 46 domain: string 47 edit_permission_token: string 48 id?: string ··· 50 view_permission_token: string 51 } 52 Update: { 53 domain?: string 54 edit_permission_token?: string 55 id?: string ··· 83 custom_domains: { 84 Row: { 85 confirmed: boolean 86 domain: string 87 identity: string 88 } 89 Insert: { 90 confirmed: boolean 91 domain: string 92 identity?: string 93 } 94 Update: { 95 confirmed?: boolean 96 domain?: string 97 identity?: string 98 }
··· 36 Tables: { 37 custom_domain_routes: { 38 Row: { 39 + created_at: string 40 domain: string 41 edit_permission_token: string 42 id: string ··· 44 view_permission_token: string 45 } 46 Insert: { 47 + created_at?: string 48 domain: string 49 edit_permission_token: string 50 id?: string ··· 52 view_permission_token: string 53 } 54 Update: { 55 + created_at?: string 56 domain?: string 57 edit_permission_token?: string 58 id?: string ··· 86 custom_domains: { 87 Row: { 88 confirmed: boolean 89 + created_at: string 90 domain: string 91 identity: string 92 } 93 Insert: { 94 confirmed: boolean 95 + created_at?: string 96 domain: string 97 identity?: string 98 } 99 Update: { 100 confirmed?: boolean 101 + created_at?: string 102 domain?: string 103 identity?: string 104 }
+3
supabase/migrations/20250122215946_add_created_at_to_domain_tables.sql
···
··· 1 + alter table "public"."custom_domain_routes" add column "created_at" timestamp with time zone not null default now(); 2 + 3 + alter table "public"."custom_domains" add column "created_at" timestamp with time zone not null default now();