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