@drfed/models 0.0.0-stage → 0.1.0-dev.554

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +230 -2
  3. package/dist/activity-delivery.d.mts +111 -0
  4. package/dist/activity-delivery.d.mts.map +1 -0
  5. package/dist/activity-delivery.mjs +240 -0
  6. package/dist/activity-delivery.mjs.map +1 -0
  7. package/dist/db-DtcLuISw.d.mts +3098 -0
  8. package/dist/db-DtcLuISw.d.mts.map +1 -0
  9. package/dist/db.d.mts +2 -0
  10. package/dist/db.mjs +3 -0
  11. package/dist/email.d.mts +39 -0
  12. package/dist/email.d.mts.map +1 -0
  13. package/dist/email.mjs +12 -0
  14. package/dist/email.mjs.map +1 -0
  15. package/dist/index.d.mts +14 -0
  16. package/dist/index.mjs +18 -0
  17. package/dist/instance.d.mts +11 -0
  18. package/dist/instance.d.mts.map +1 -0
  19. package/dist/instance.mjs +21 -0
  20. package/dist/instance.mjs.map +1 -0
  21. package/dist/key.d.mts +2 -0
  22. package/dist/key.mjs +86 -0
  23. package/dist/key.mjs.map +1 -0
  24. package/dist/login.d.mts +49 -0
  25. package/dist/login.d.mts.map +1 -0
  26. package/dist/login.mjs +71 -0
  27. package/dist/login.mjs.map +1 -0
  28. package/dist/migrate.d.mts +46 -0
  29. package/dist/migrate.d.mts.map +1 -0
  30. package/dist/migrate.mjs +58 -0
  31. package/dist/migrate.mjs.map +1 -0
  32. package/dist/migration-manifest.d.mts +39 -0
  33. package/dist/migration-manifest.d.mts.map +1 -0
  34. package/dist/migration-manifest.mjs +77 -0
  35. package/dist/migration-manifest.mjs.map +1 -0
  36. package/dist/migration-session-B4xHeU_a.d.mts +56 -0
  37. package/dist/migration-session-B4xHeU_a.d.mts.map +1 -0
  38. package/dist/migration-session.d.mts +2 -0
  39. package/dist/migration-session.mjs +204 -0
  40. package/dist/migration-session.mjs.map +1 -0
  41. package/dist/migration-snapshot-OM5jQN1-.mjs +69 -0
  42. package/dist/migration-snapshot-OM5jQN1-.mjs.map +1 -0
  43. package/dist/migration-state.d.mts +41 -0
  44. package/dist/migration-state.d.mts.map +1 -0
  45. package/dist/migration-state.mjs +155 -0
  46. package/dist/migration-state.mjs.map +1 -0
  47. package/dist/migrations-manifest.json +109 -0
  48. package/dist/pglite-preparation.d.mts +23 -0
  49. package/dist/pglite-preparation.d.mts.map +1 -0
  50. package/dist/pglite-preparation.mjs +77 -0
  51. package/dist/pglite-preparation.mjs.map +1 -0
  52. package/dist/pglite-store.d.mts +29 -0
  53. package/dist/pglite-store.d.mts.map +1 -0
  54. package/dist/pglite-store.mjs +117 -0
  55. package/dist/pglite-store.mjs.map +1 -0
  56. package/dist/relations.d.mts +2 -0
  57. package/dist/relations.mjs +307 -0
  58. package/dist/relations.mjs.map +1 -0
  59. package/dist/resource.d.mts +50 -0
  60. package/dist/resource.d.mts.map +1 -0
  61. package/dist/resource.mjs +123 -0
  62. package/dist/resource.mjs.map +1 -0
  63. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  64. package/dist/schema.d.mts +2 -0
  65. package/dist/schema.mjs +495 -0
  66. package/dist/schema.mjs.map +1 -0
  67. package/dist/slug.d.mts +28 -0
  68. package/dist/slug.d.mts.map +1 -0
  69. package/dist/slug.mjs +55 -0
  70. package/dist/slug.mjs.map +1 -0
  71. package/dist/text.d.mts +10 -0
  72. package/dist/text.d.mts.map +1 -0
  73. package/dist/text.mjs +11 -0
  74. package/dist/text.mjs.map +1 -0
  75. package/dist/uuid-CKMzlIND.d.mts +26 -0
  76. package/dist/uuid-CKMzlIND.d.mts.map +1 -0
  77. package/dist/uuid.d.mts +2 -0
  78. package/dist/uuid.mjs +28 -0
  79. package/dist/uuid.mjs.map +1 -0
  80. package/drizzle/20260622021748_init/migration.sql +25 -0
  81. package/drizzle/20260622021748_init/snapshot.json +246 -0
  82. package/drizzle/20260623162238_dear_felicia_hardy/migration.sql +5 -0
  83. package/drizzle/20260623162238_dear_felicia_hardy/snapshot.json +321 -0
  84. package/drizzle/20260624094817_lethal_sinister_six/migration.sql +2 -0
  85. package/drizzle/20260624094817_lethal_sinister_six/snapshot.json +347 -0
  86. package/drizzle/20260716000333_email_auth/migration.sql +20 -0
  87. package/drizzle/20260716000333_email_auth/snapshot.json +575 -0
  88. package/drizzle/20260723065002_chief_colleen_wing/migration.sql +2 -0
  89. package/drizzle/20260723065002_chief_colleen_wing/snapshot.json +595 -0
  90. package/drizzle/20260802205417_separate-instance-local-remote/migration.sql +26 -0
  91. package/drizzle/20260802205417_separate-instance-local-remote/snapshot.json +768 -0
  92. package/drizzle/20260804061119_instances-local-remote-constraint/migration.sql +7 -0
  93. package/drizzle/20260804061119_instances-local-remote-constraint/snapshot.json +843 -0
  94. package/drizzle/20260818080259_dark_night_thrasher/migration.sql +15 -0
  95. package/drizzle/20260818080259_dark_night_thrasher/snapshot.json +722 -0
  96. package/drizzle/20260821072150_merge_remote_actors/migration.sql +54 -0
  97. package/drizzle/20260821072150_merge_remote_actors/snapshot.json +1312 -0
  98. package/drizzle/20260906052949_rename_followees_to_following/migration.sql +2 -0
  99. package/drizzle/20260906052949_rename_followees_to_following/snapshot.json +1315 -0
  100. package/drizzle/20260908062446_rename_login_tokens_to_login_challenges/migration.sql +1 -0
  101. package/drizzle/20260908062446_rename_login_tokens_to_login_challenges/snapshot.json +1312 -0
  102. package/drizzle/20260908065945_simplify_login_challenges/migration.sql +7 -0
  103. package/drizzle/20260908065945_simplify_login_challenges/snapshot.json +1290 -0
  104. package/drizzle/20260915061356_tighten_slug_constraint/migration.sql +12 -0
  105. package/drizzle/20260915061356_tighten_slug_constraint/snapshot.json +1290 -0
  106. package/drizzle/20260915063339_widen_instance_host/migration.sql +1 -0
  107. package/drizzle/20260915063339_widen_instance_host/snapshot.json +1290 -0
  108. package/drizzle/20260916085902_add_objects_activities_and_resources/migration.sql +110 -0
  109. package/drizzle/20260916085902_add_objects_activities_and_resources/snapshot.json +2263 -0
  110. package/drizzle/20260917163517_order_local_outbox_items/migration.sql +22 -0
  111. package/drizzle/20260917163517_order_local_outbox_items/snapshot.json +2263 -0
  112. package/drizzle/20260918071839_add_activity_object_index/migration.sql +1 -0
  113. package/drizzle/20260918071839_add_activity_object_index/snapshot.json +2298 -0
  114. package/drizzle/20261006061745_add_activity_deliveries_and_keys/migration.sql +106 -0
  115. package/drizzle/20261006061745_add_activity_deliveries_and_keys/snapshot.json +3538 -0
  116. package/drizzle/20261006085045_snake_case_columns/migration.sql +42 -0
  117. package/drizzle/20261006085045_snake_case_columns/snapshot.json +3570 -0
  118. package/drizzle/20261006122653_local_actor_keys/migration.sql +11 -0
  119. package/drizzle/20261006122653_local_actor_keys/snapshot.json +3627 -0
  120. package/drizzle/20261010044954_link_activity_deliveries_to_activities/migration.sql +8 -0
  121. package/drizzle/20261010044954_link_activity_deliveries_to_activities/snapshot.json +3714 -0
  122. package/drizzle/20261010073134_check_inbound_activity_link/migration.sql +1 -0
  123. package/drizzle/20261010073134_check_inbound_activity_link/snapshot.json +3721 -0
  124. package/drizzle/20261010104304_record_object_activity/migration.sql +3 -0
  125. package/drizzle/20261010104304_record_object_activity/snapshot.json +3756 -0
  126. package/drizzle/20261010111648_record_delivery_snapshot/migration.sql +29 -0
  127. package/drizzle/20261010111648_record_delivery_snapshot/snapshot.json +3769 -0
  128. package/drizzle/20261011144453_record_object_snapshot/migration.sql +10 -0
  129. package/drizzle/20261011144453_record_object_snapshot/snapshot.json +3808 -0
  130. package/drizzle/20261011192718_record_actor_followers/migration.sql +1 -0
  131. package/drizzle/20261011192718_record_actor_followers/snapshot.json +3821 -0
  132. package/package.json +193 -3
@@ -0,0 +1,321 @@
1
+ {
2
+ "version": "8",
3
+ "dialect": "postgres",
4
+ "id": "f04d695a-a99e-4bb9-be8d-190f9e7b67dc",
5
+ "prevIds": ["2cffbe98-208b-4301-ad32-8c2e3e74928f"],
6
+ "ddl": [
7
+ {
8
+ "isRlsEnabled": false,
9
+ "name": "accounts",
10
+ "entityType": "tables",
11
+ "schema": "public"
12
+ },
13
+ {
14
+ "isRlsEnabled": false,
15
+ "name": "instance_members",
16
+ "entityType": "tables",
17
+ "schema": "public"
18
+ },
19
+ {
20
+ "isRlsEnabled": false,
21
+ "name": "instances",
22
+ "entityType": "tables",
23
+ "schema": "public"
24
+ },
25
+ {
26
+ "type": "uuid",
27
+ "typeSchema": null,
28
+ "notNull": true,
29
+ "dimensions": 0,
30
+ "default": null,
31
+ "generated": null,
32
+ "identity": null,
33
+ "name": "id",
34
+ "entityType": "columns",
35
+ "schema": "public",
36
+ "table": "accounts"
37
+ },
38
+ {
39
+ "type": "varchar(255)",
40
+ "typeSchema": null,
41
+ "notNull": true,
42
+ "dimensions": 0,
43
+ "default": null,
44
+ "generated": null,
45
+ "identity": null,
46
+ "name": "email",
47
+ "entityType": "columns",
48
+ "schema": "public",
49
+ "table": "accounts"
50
+ },
51
+ {
52
+ "type": "varchar(100)",
53
+ "typeSchema": null,
54
+ "notNull": true,
55
+ "dimensions": 0,
56
+ "default": null,
57
+ "generated": null,
58
+ "identity": null,
59
+ "name": "name",
60
+ "entityType": "columns",
61
+ "schema": "public",
62
+ "table": "accounts"
63
+ },
64
+ {
65
+ "type": "timestamp with time zone",
66
+ "typeSchema": null,
67
+ "notNull": true,
68
+ "dimensions": 0,
69
+ "default": "CURRENT_TIMESTAMP",
70
+ "generated": null,
71
+ "identity": null,
72
+ "name": "created",
73
+ "entityType": "columns",
74
+ "schema": "public",
75
+ "table": "accounts"
76
+ },
77
+ {
78
+ "type": "uuid",
79
+ "typeSchema": null,
80
+ "notNull": true,
81
+ "dimensions": 0,
82
+ "default": null,
83
+ "generated": null,
84
+ "identity": null,
85
+ "name": "accountId",
86
+ "entityType": "columns",
87
+ "schema": "public",
88
+ "table": "instance_members"
89
+ },
90
+ {
91
+ "type": "uuid",
92
+ "typeSchema": null,
93
+ "notNull": true,
94
+ "dimensions": 0,
95
+ "default": null,
96
+ "generated": null,
97
+ "identity": null,
98
+ "name": "instanceId",
99
+ "entityType": "columns",
100
+ "schema": "public",
101
+ "table": "instance_members"
102
+ },
103
+ {
104
+ "type": "timestamp with time zone",
105
+ "typeSchema": null,
106
+ "notNull": false,
107
+ "dimensions": 0,
108
+ "default": null,
109
+ "generated": null,
110
+ "identity": null,
111
+ "name": "accepted",
112
+ "entityType": "columns",
113
+ "schema": "public",
114
+ "table": "instance_members"
115
+ },
116
+ {
117
+ "type": "timestamp with time zone",
118
+ "typeSchema": null,
119
+ "notNull": true,
120
+ "dimensions": 0,
121
+ "default": "CURRENT_TIMESTAMP",
122
+ "generated": null,
123
+ "identity": null,
124
+ "name": "created",
125
+ "entityType": "columns",
126
+ "schema": "public",
127
+ "table": "instance_members"
128
+ },
129
+ {
130
+ "type": "uuid",
131
+ "typeSchema": null,
132
+ "notNull": true,
133
+ "dimensions": 0,
134
+ "default": null,
135
+ "generated": null,
136
+ "identity": null,
137
+ "name": "id",
138
+ "entityType": "columns",
139
+ "schema": "public",
140
+ "table": "instances"
141
+ },
142
+ {
143
+ "type": "varchar(100)",
144
+ "typeSchema": null,
145
+ "notNull": true,
146
+ "dimensions": 0,
147
+ "default": null,
148
+ "generated": null,
149
+ "identity": null,
150
+ "name": "slug",
151
+ "entityType": "columns",
152
+ "schema": "public",
153
+ "table": "instances"
154
+ },
155
+ {
156
+ "type": "timestamp with time zone",
157
+ "typeSchema": null,
158
+ "notNull": true,
159
+ "dimensions": 0,
160
+ "default": null,
161
+ "generated": null,
162
+ "identity": null,
163
+ "name": "expires",
164
+ "entityType": "columns",
165
+ "schema": "public",
166
+ "table": "instances"
167
+ },
168
+ {
169
+ "type": "timestamp with time zone",
170
+ "typeSchema": null,
171
+ "notNull": true,
172
+ "dimensions": 0,
173
+ "default": "CURRENT_TIMESTAMP",
174
+ "generated": null,
175
+ "identity": null,
176
+ "name": "created",
177
+ "entityType": "columns",
178
+ "schema": "public",
179
+ "table": "instances"
180
+ },
181
+ {
182
+ "nameExplicit": false,
183
+ "columns": [
184
+ {
185
+ "value": "accountId",
186
+ "isExpression": false,
187
+ "asc": true,
188
+ "nullsFirst": false,
189
+ "opclass": null
190
+ }
191
+ ],
192
+ "isUnique": false,
193
+ "where": "\"accepted\" IS NOT NULL",
194
+ "with": "",
195
+ "method": "btree",
196
+ "concurrently": false,
197
+ "name": "instance_members_accountId_index",
198
+ "entityType": "indexes",
199
+ "schema": "public",
200
+ "table": "instance_members"
201
+ },
202
+ {
203
+ "nameExplicit": false,
204
+ "columns": [
205
+ {
206
+ "value": "instanceId",
207
+ "isExpression": false,
208
+ "asc": true,
209
+ "nullsFirst": false,
210
+ "opclass": null
211
+ }
212
+ ],
213
+ "isUnique": false,
214
+ "where": "\"accepted\" IS NOT NULL",
215
+ "with": "",
216
+ "method": "btree",
217
+ "concurrently": false,
218
+ "name": "instance_members_instanceId_index",
219
+ "entityType": "indexes",
220
+ "schema": "public",
221
+ "table": "instance_members"
222
+ },
223
+ {
224
+ "nameExplicit": false,
225
+ "columns": ["accountId"],
226
+ "schemaTo": "public",
227
+ "tableTo": "accounts",
228
+ "columnsTo": ["id"],
229
+ "onUpdate": "NO ACTION",
230
+ "onDelete": "NO ACTION",
231
+ "name": "instance_members_accountId_accounts_id_fkey",
232
+ "entityType": "fks",
233
+ "schema": "public",
234
+ "table": "instance_members"
235
+ },
236
+ {
237
+ "nameExplicit": false,
238
+ "columns": ["instanceId"],
239
+ "schemaTo": "public",
240
+ "tableTo": "instances",
241
+ "columnsTo": ["id"],
242
+ "onUpdate": "NO ACTION",
243
+ "onDelete": "NO ACTION",
244
+ "name": "instance_members_instanceId_instances_id_fkey",
245
+ "entityType": "fks",
246
+ "schema": "public",
247
+ "table": "instance_members"
248
+ },
249
+ {
250
+ "columns": ["instanceId", "accountId"],
251
+ "nameExplicit": false,
252
+ "name": "instance_members_pkey",
253
+ "entityType": "pks",
254
+ "schema": "public",
255
+ "table": "instance_members"
256
+ },
257
+ {
258
+ "columns": ["id"],
259
+ "nameExplicit": false,
260
+ "name": "accounts_pkey",
261
+ "schema": "public",
262
+ "table": "accounts",
263
+ "entityType": "pks"
264
+ },
265
+ {
266
+ "columns": ["id"],
267
+ "nameExplicit": false,
268
+ "name": "instances_pkey",
269
+ "schema": "public",
270
+ "table": "instances",
271
+ "entityType": "pks"
272
+ },
273
+ {
274
+ "nameExplicit": false,
275
+ "columns": ["email"],
276
+ "nullsNotDistinct": false,
277
+ "name": "accounts_email_key",
278
+ "schema": "public",
279
+ "table": "accounts",
280
+ "entityType": "uniques"
281
+ },
282
+ {
283
+ "nameExplicit": false,
284
+ "columns": ["slug"],
285
+ "nullsNotDistinct": false,
286
+ "name": "instances_slug_key",
287
+ "schema": "public",
288
+ "table": "instances",
289
+ "entityType": "uniques"
290
+ },
291
+ {
292
+ "value": "\"email\" ~ '^[^@]+@[^@]+\\.[^@]+$'",
293
+ "name": "accounts_email_check",
294
+ "entityType": "checks",
295
+ "schema": "public",
296
+ "table": "accounts"
297
+ },
298
+ {
299
+ "value": "trim(both from \"name\") <> ''",
300
+ "name": "accounts_name_check",
301
+ "entityType": "checks",
302
+ "schema": "public",
303
+ "table": "accounts"
304
+ },
305
+ {
306
+ "value": "\"slug\" ~ '^[a-z0-9-]{4,100}$'",
307
+ "name": "instances_slug_check",
308
+ "entityType": "checks",
309
+ "schema": "public",
310
+ "table": "instances"
311
+ },
312
+ {
313
+ "value": "\"expires\" < (\"created\" + INTERVAL '1 year')",
314
+ "name": "instances_expires_check",
315
+ "entityType": "checks",
316
+ "schema": "public",
317
+ "table": "instances"
318
+ }
319
+ ],
320
+ "renames": []
321
+ }
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "accounts" ADD COLUMN "admin" boolean DEFAULT false NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "instance_members" ADD COLUMN "admin" boolean DEFAULT false NOT NULL;
@@ -0,0 +1,347 @@
1
+ {
2
+ "version": "8",
3
+ "dialect": "postgres",
4
+ "id": "15845826-f718-42c3-85f2-fed368f261f4",
5
+ "prevIds": ["f04d695a-a99e-4bb9-be8d-190f9e7b67dc"],
6
+ "ddl": [
7
+ {
8
+ "isRlsEnabled": false,
9
+ "name": "accounts",
10
+ "entityType": "tables",
11
+ "schema": "public"
12
+ },
13
+ {
14
+ "isRlsEnabled": false,
15
+ "name": "instance_members",
16
+ "entityType": "tables",
17
+ "schema": "public"
18
+ },
19
+ {
20
+ "isRlsEnabled": false,
21
+ "name": "instances",
22
+ "entityType": "tables",
23
+ "schema": "public"
24
+ },
25
+ {
26
+ "type": "uuid",
27
+ "typeSchema": null,
28
+ "notNull": true,
29
+ "dimensions": 0,
30
+ "default": null,
31
+ "generated": null,
32
+ "identity": null,
33
+ "name": "id",
34
+ "entityType": "columns",
35
+ "schema": "public",
36
+ "table": "accounts"
37
+ },
38
+ {
39
+ "type": "varchar(255)",
40
+ "typeSchema": null,
41
+ "notNull": true,
42
+ "dimensions": 0,
43
+ "default": null,
44
+ "generated": null,
45
+ "identity": null,
46
+ "name": "email",
47
+ "entityType": "columns",
48
+ "schema": "public",
49
+ "table": "accounts"
50
+ },
51
+ {
52
+ "type": "varchar(100)",
53
+ "typeSchema": null,
54
+ "notNull": true,
55
+ "dimensions": 0,
56
+ "default": null,
57
+ "generated": null,
58
+ "identity": null,
59
+ "name": "name",
60
+ "entityType": "columns",
61
+ "schema": "public",
62
+ "table": "accounts"
63
+ },
64
+ {
65
+ "type": "boolean",
66
+ "typeSchema": null,
67
+ "notNull": true,
68
+ "dimensions": 0,
69
+ "default": "false",
70
+ "generated": null,
71
+ "identity": null,
72
+ "name": "admin",
73
+ "entityType": "columns",
74
+ "schema": "public",
75
+ "table": "accounts"
76
+ },
77
+ {
78
+ "type": "timestamp with time zone",
79
+ "typeSchema": null,
80
+ "notNull": true,
81
+ "dimensions": 0,
82
+ "default": "CURRENT_TIMESTAMP",
83
+ "generated": null,
84
+ "identity": null,
85
+ "name": "created",
86
+ "entityType": "columns",
87
+ "schema": "public",
88
+ "table": "accounts"
89
+ },
90
+ {
91
+ "type": "uuid",
92
+ "typeSchema": null,
93
+ "notNull": true,
94
+ "dimensions": 0,
95
+ "default": null,
96
+ "generated": null,
97
+ "identity": null,
98
+ "name": "accountId",
99
+ "entityType": "columns",
100
+ "schema": "public",
101
+ "table": "instance_members"
102
+ },
103
+ {
104
+ "type": "uuid",
105
+ "typeSchema": null,
106
+ "notNull": true,
107
+ "dimensions": 0,
108
+ "default": null,
109
+ "generated": null,
110
+ "identity": null,
111
+ "name": "instanceId",
112
+ "entityType": "columns",
113
+ "schema": "public",
114
+ "table": "instance_members"
115
+ },
116
+ {
117
+ "type": "boolean",
118
+ "typeSchema": null,
119
+ "notNull": true,
120
+ "dimensions": 0,
121
+ "default": "false",
122
+ "generated": null,
123
+ "identity": null,
124
+ "name": "admin",
125
+ "entityType": "columns",
126
+ "schema": "public",
127
+ "table": "instance_members"
128
+ },
129
+ {
130
+ "type": "timestamp with time zone",
131
+ "typeSchema": null,
132
+ "notNull": false,
133
+ "dimensions": 0,
134
+ "default": null,
135
+ "generated": null,
136
+ "identity": null,
137
+ "name": "accepted",
138
+ "entityType": "columns",
139
+ "schema": "public",
140
+ "table": "instance_members"
141
+ },
142
+ {
143
+ "type": "timestamp with time zone",
144
+ "typeSchema": null,
145
+ "notNull": true,
146
+ "dimensions": 0,
147
+ "default": "CURRENT_TIMESTAMP",
148
+ "generated": null,
149
+ "identity": null,
150
+ "name": "created",
151
+ "entityType": "columns",
152
+ "schema": "public",
153
+ "table": "instance_members"
154
+ },
155
+ {
156
+ "type": "uuid",
157
+ "typeSchema": null,
158
+ "notNull": true,
159
+ "dimensions": 0,
160
+ "default": null,
161
+ "generated": null,
162
+ "identity": null,
163
+ "name": "id",
164
+ "entityType": "columns",
165
+ "schema": "public",
166
+ "table": "instances"
167
+ },
168
+ {
169
+ "type": "varchar(100)",
170
+ "typeSchema": null,
171
+ "notNull": true,
172
+ "dimensions": 0,
173
+ "default": null,
174
+ "generated": null,
175
+ "identity": null,
176
+ "name": "slug",
177
+ "entityType": "columns",
178
+ "schema": "public",
179
+ "table": "instances"
180
+ },
181
+ {
182
+ "type": "timestamp with time zone",
183
+ "typeSchema": null,
184
+ "notNull": true,
185
+ "dimensions": 0,
186
+ "default": null,
187
+ "generated": null,
188
+ "identity": null,
189
+ "name": "expires",
190
+ "entityType": "columns",
191
+ "schema": "public",
192
+ "table": "instances"
193
+ },
194
+ {
195
+ "type": "timestamp with time zone",
196
+ "typeSchema": null,
197
+ "notNull": true,
198
+ "dimensions": 0,
199
+ "default": "CURRENT_TIMESTAMP",
200
+ "generated": null,
201
+ "identity": null,
202
+ "name": "created",
203
+ "entityType": "columns",
204
+ "schema": "public",
205
+ "table": "instances"
206
+ },
207
+ {
208
+ "nameExplicit": false,
209
+ "columns": [
210
+ {
211
+ "value": "accountId",
212
+ "isExpression": false,
213
+ "asc": true,
214
+ "nullsFirst": false,
215
+ "opclass": null
216
+ }
217
+ ],
218
+ "isUnique": false,
219
+ "where": "\"accepted\" IS NOT NULL",
220
+ "with": "",
221
+ "method": "btree",
222
+ "concurrently": false,
223
+ "name": "instance_members_accountId_index",
224
+ "entityType": "indexes",
225
+ "schema": "public",
226
+ "table": "instance_members"
227
+ },
228
+ {
229
+ "nameExplicit": false,
230
+ "columns": [
231
+ {
232
+ "value": "instanceId",
233
+ "isExpression": false,
234
+ "asc": true,
235
+ "nullsFirst": false,
236
+ "opclass": null
237
+ }
238
+ ],
239
+ "isUnique": false,
240
+ "where": "\"accepted\" IS NOT NULL",
241
+ "with": "",
242
+ "method": "btree",
243
+ "concurrently": false,
244
+ "name": "instance_members_instanceId_index",
245
+ "entityType": "indexes",
246
+ "schema": "public",
247
+ "table": "instance_members"
248
+ },
249
+ {
250
+ "nameExplicit": false,
251
+ "columns": ["accountId"],
252
+ "schemaTo": "public",
253
+ "tableTo": "accounts",
254
+ "columnsTo": ["id"],
255
+ "onUpdate": "NO ACTION",
256
+ "onDelete": "NO ACTION",
257
+ "name": "instance_members_accountId_accounts_id_fkey",
258
+ "entityType": "fks",
259
+ "schema": "public",
260
+ "table": "instance_members"
261
+ },
262
+ {
263
+ "nameExplicit": false,
264
+ "columns": ["instanceId"],
265
+ "schemaTo": "public",
266
+ "tableTo": "instances",
267
+ "columnsTo": ["id"],
268
+ "onUpdate": "NO ACTION",
269
+ "onDelete": "NO ACTION",
270
+ "name": "instance_members_instanceId_instances_id_fkey",
271
+ "entityType": "fks",
272
+ "schema": "public",
273
+ "table": "instance_members"
274
+ },
275
+ {
276
+ "columns": ["instanceId", "accountId"],
277
+ "nameExplicit": false,
278
+ "name": "instance_members_pkey",
279
+ "entityType": "pks",
280
+ "schema": "public",
281
+ "table": "instance_members"
282
+ },
283
+ {
284
+ "columns": ["id"],
285
+ "nameExplicit": false,
286
+ "name": "accounts_pkey",
287
+ "schema": "public",
288
+ "table": "accounts",
289
+ "entityType": "pks"
290
+ },
291
+ {
292
+ "columns": ["id"],
293
+ "nameExplicit": false,
294
+ "name": "instances_pkey",
295
+ "schema": "public",
296
+ "table": "instances",
297
+ "entityType": "pks"
298
+ },
299
+ {
300
+ "nameExplicit": false,
301
+ "columns": ["email"],
302
+ "nullsNotDistinct": false,
303
+ "name": "accounts_email_key",
304
+ "schema": "public",
305
+ "table": "accounts",
306
+ "entityType": "uniques"
307
+ },
308
+ {
309
+ "nameExplicit": false,
310
+ "columns": ["slug"],
311
+ "nullsNotDistinct": false,
312
+ "name": "instances_slug_key",
313
+ "schema": "public",
314
+ "table": "instances",
315
+ "entityType": "uniques"
316
+ },
317
+ {
318
+ "value": "\"email\" ~ '^[^@]+@[^@]+\\.[^@]+$'",
319
+ "name": "accounts_email_check",
320
+ "entityType": "checks",
321
+ "schema": "public",
322
+ "table": "accounts"
323
+ },
324
+ {
325
+ "value": "trim(both from \"name\") <> ''",
326
+ "name": "accounts_name_check",
327
+ "entityType": "checks",
328
+ "schema": "public",
329
+ "table": "accounts"
330
+ },
331
+ {
332
+ "value": "\"slug\" ~ '^[a-z0-9-]{4,100}$'",
333
+ "name": "instances_slug_check",
334
+ "entityType": "checks",
335
+ "schema": "public",
336
+ "table": "instances"
337
+ },
338
+ {
339
+ "value": "\"expires\" < (\"created\" + INTERVAL '1 year')",
340
+ "name": "instances_expires_check",
341
+ "entityType": "checks",
342
+ "schema": "public",
343
+ "table": "instances"
344
+ }
345
+ ],
346
+ "renames": []
347
+ }
@@ -0,0 +1,20 @@
1
+ CREATE TABLE "login_tokens" (
2
+ "id" uuid PRIMARY KEY,
3
+ "accountId" uuid NOT NULL,
4
+ "tokenHash" varchar(64) NOT NULL UNIQUE,
5
+ "codeHash" varchar(64) NOT NULL,
6
+ "created" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
7
+ "expires" timestamp with time zone DEFAULT CURRENT_TIMESTAMP + INTERVAL '15 minutes' NOT NULL,
8
+ "consumed" timestamp with time zone
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE "sessions" (
12
+ "id" uuid PRIMARY KEY,
13
+ "accountId" uuid NOT NULL,
14
+ "tokenHash" varchar(64) NOT NULL UNIQUE,
15
+ "created" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
16
+ "expires" timestamp with time zone DEFAULT CURRENT_TIMESTAMP + INTERVAL '1 month' NOT NULL
17
+ );
18
+ --> statement-breakpoint
19
+ ALTER TABLE "login_tokens" ADD CONSTRAINT "login_tokens_accountId_accounts_id_fkey" FOREIGN KEY ("accountId") REFERENCES "accounts"("id") ON DELETE CASCADE;--> statement-breakpoint
20
+ ALTER TABLE "sessions" ADD CONSTRAINT "sessions_accountId_accounts_id_fkey" FOREIGN KEY ("accountId") REFERENCES "accounts"("id") ON DELETE CASCADE;