@snolla/data 0.0.0-stage → 1.0.7

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 (67) hide show
  1. package/dist/actor.d.ts +28 -0
  2. package/dist/actor.js +63 -0
  3. package/dist/audit.d.ts +36 -0
  4. package/dist/audit.js +198 -0
  5. package/dist/dataProvider.d.ts +41 -0
  6. package/dist/dataProvider.js +148 -0
  7. package/dist/dataSource.d.ts +4 -0
  8. package/dist/dataSource.js +65 -0
  9. package/dist/dbProvider.d.ts +1261 -0
  10. package/dist/dbProvider.js +1898 -0
  11. package/dist/freeze.d.ts +29 -0
  12. package/dist/freeze.js +69 -0
  13. package/dist/guard.d.ts +53 -0
  14. package/dist/guard.js +397 -0
  15. package/dist/insert.d.ts +9 -0
  16. package/dist/insert.js +44 -0
  17. package/dist/migrations/siteid.d.mts +738 -0
  18. package/dist/migrations/siteid.mjs +512 -0
  19. package/dist/publish.d.ts +1 -0
  20. package/dist/publish.js +1 -0
  21. package/dist/schema/dsl.d.ts +64 -0
  22. package/dist/schema/dsl.js +28 -0
  23. package/dist/schema/generate.d.mts +14 -0
  24. package/dist/schema/generate.mjs +282 -0
  25. package/dist/schema/generated/ddl.d.ts +7 -0
  26. package/dist/schema/generated/ddl.js +11 -0
  27. package/dist/schema/generated/kysely-types.d.ts +1988 -0
  28. package/dist/schema/generated/kysely-types.js +5 -0
  29. package/dist/schema/index.d.ts +2 -0
  30. package/dist/schema/index.js +7 -0
  31. package/dist/schema/provision.d.mts +11 -0
  32. package/dist/schema/provision.mjs +111 -0
  33. package/dist/schema/tables.d.ts +2 -0
  34. package/dist/schema/tables.js +3301 -0
  35. package/dist/scripts/canon-audit.d.mts +25 -0
  36. package/dist/scripts/canon-audit.mjs +213 -0
  37. package/dist/scripts/canon-smoke.d.mts +1 -0
  38. package/dist/scripts/canon-smoke.mjs +44 -0
  39. package/dist/scripts/dialect-ddl-stand.d.mts +1 -0
  40. package/dist/scripts/dialect-ddl-stand.mjs +136 -0
  41. package/dist/scripts/owner-spec-check.d.mts +1 -0
  42. package/dist/scripts/owner-spec-check.mjs +166 -0
  43. package/dist/scripts/owners/owner-resolve-spec.json +540 -0
  44. package/dist/scripts/owners-audit.d.mts +60 -0
  45. package/dist/scripts/owners-audit.mjs +443 -0
  46. package/dist/scripts/owners-fixture.d.mts +20 -0
  47. package/dist/scripts/owners-fixture.mjs +192 -0
  48. package/dist/scripts/schema-lengths-audit.d.mts +22 -0
  49. package/dist/scripts/schema-lengths-audit.mjs +146 -0
  50. package/dist/scripts/siteid-migrate.d.mts +7 -0
  51. package/dist/scripts/siteid-migrate.mjs +260 -0
  52. package/dist/scripts/tenant-invariant-audit.d.mts +1 -0
  53. package/dist/scripts/tenant-invariant-audit.mjs +34 -0
  54. package/dist/singleMode.d.ts +5 -0
  55. package/dist/singleMode.js +23 -0
  56. package/dist/sqliteDialect.d.ts +6 -0
  57. package/dist/sqliteDialect.js +92 -0
  58. package/dist/templateDefs.d.ts +38 -0
  59. package/dist/templateDefs.js +163 -0
  60. package/dist/test/fixtures/broken-driver/index.d.ts +3 -0
  61. package/dist/test/fixtures/broken-driver/index.js +5 -0
  62. package/dist/test/support/dialect-stand.d.ts +37 -0
  63. package/dist/test/support/dialect-stand.js +162 -0
  64. package/dist/test/support/render-parity.d.ts +44 -0
  65. package/dist/test/support/render-parity.js +262 -0
  66. package/package.json +50 -5
  67. package/README.md +0 -3
@@ -0,0 +1,3301 @@
1
+ const col = (c) => c;
2
+ const fk = (f) => f;
3
+ const ix = (i) => i;
4
+ export const canonicalSchema = {
5
+ version: 1,
6
+ tables: [
7
+ {
8
+ name: 'Accounts',
9
+ scope: 'control',
10
+ columns: {
11
+ AccountId: col({ type: 'uuid', pk: true }),
12
+ Title: col({ type: 'string', length: 100 }),
13
+ DateCreated: col({ type: 'datetime' }),
14
+ UtcDateCreated: col({ type: 'datetime' }),
15
+ CreatedById: col({ type: 'uuid' }),
16
+ DateUpdated: col({ type: 'datetime', nullable: true }),
17
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
18
+ UpdatedById: col({ type: 'uuid', nullable: true }),
19
+ },
20
+ fks: [
21
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
22
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
23
+ ],
24
+ },
25
+ {
26
+ name: 'AdministratorAccounts',
27
+ scope: 'control',
28
+ columns: {
29
+ Administrator_Id: col({ type: 'uuid', pk: true }),
30
+ Account_Id: col({ type: 'uuid', pk: true }),
31
+ },
32
+ fks: [
33
+ fk({ columns: ['Administrator_Id'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
34
+ fk({ columns: ['Account_Id'], ref: 'Accounts', refColumns: ['AccountId'] }),
35
+ ],
36
+ },
37
+ {
38
+ name: 'AdministratorBlogs',
39
+ scope: 'site',
40
+ siteIdAdded: true,
41
+ columns: {
42
+ Administrator_Id: col({ type: 'uuid', pk: true }),
43
+ Blog_Id: col({ type: 'uuid', pk: true }),
44
+ SiteId: col({ type: 'uuid' }),
45
+ },
46
+ indexes: [
47
+ ix({ columns: ['SiteId'] }),
48
+ ],
49
+ fks: [
50
+ fk({ columns: ['Blog_Id'], ref: 'Blogs', refColumns: ['BlogId'] }),
51
+ fk({ columns: ['Administrator_Id'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
52
+ ],
53
+ },
54
+ {
55
+ name: 'AdministratorSites',
56
+ scope: 'control',
57
+ columns: {
58
+ Administrator_Id: col({ type: 'uuid', pk: true }),
59
+ Site_Id: col({ type: 'uuid', pk: true }),
60
+ },
61
+ fks: [
62
+ fk({ columns: ['Administrator_Id'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
63
+ fk({ columns: ['Site_Id'], ref: 'Sites', refColumns: ['SiteId'] }),
64
+ ],
65
+ },
66
+ {
67
+ name: 'AdministratorStores',
68
+ scope: 'control',
69
+ columns: {
70
+ Administrator_Id: col({ type: 'uuid', pk: true }),
71
+ Store_Id: col({ type: 'uuid', pk: true }),
72
+ },
73
+ fks: [
74
+ fk({ columns: ['Store_Id'], ref: 'Stores', refColumns: ['StoreId'] }),
75
+ fk({ columns: ['Administrator_Id'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
76
+ ],
77
+ },
78
+ {
79
+ name: 'Administrators',
80
+ scope: 'control',
81
+ columns: {
82
+ AdministratorId: col({ type: 'uuid', pk: true }),
83
+ Username: col({ type: 'string', length: 256, nullable: true }),
84
+ FirstName: col({ type: 'string', length: 50, nullable: true }),
85
+ LastName: col({ type: 'string', length: 50, nullable: true }),
86
+ Email: col({ type: 'string', length: 256, nullable: true }),
87
+ // The credential of this database's administrators (task:3957, design
88
+ // wiki:3874 §5): our `pbkdf2:sha256:<iter>:<salt>:<hash>` string, or a
89
+ // legacy ASP.NET Identity hash kept as-is until the first login rehashes
90
+ // it. NULL = the row cannot log in (an identity without a credential).
91
+ PasswordHash: col({ type: 'string', length: 512, nullable: true }),
92
+ DateCreated: col({ type: 'datetime' }),
93
+ UtcDateCreated: col({ type: 'datetime' }),
94
+ DateUpdated: col({ type: 'datetime', nullable: true }),
95
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
96
+ UpdatedById: col({ type: 'uuid', nullable: true }),
97
+ },
98
+ fks: [
99
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
100
+ ],
101
+ },
102
+ {
103
+ name: 'ApiKeys',
104
+ scope: 'control',
105
+ columns: {
106
+ ApiKeyId: col({ type: 'uuid', pk: true }),
107
+ AdministratorId: col({ type: 'uuid' }),
108
+ Name: col({ type: 'string', length: 200 }),
109
+ KeyPrefix: col({ type: 'string', length: 8 }),
110
+ KeyHash: col({ type: 'string', length: 64 }),
111
+ Scope: col({ type: 'string', length: 500, nullable: true }),
112
+ ExpiresAt: col({ type: 'datetime', nullable: true }),
113
+ RevokedAt: col({ type: 'datetime', nullable: true }),
114
+ DateCreated: col({ type: 'datetime' }),
115
+ UtcDateCreated: col({ type: 'datetime' }),
116
+ DateUpdated: col({ type: 'datetime', nullable: true }),
117
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
118
+ CreatedById: col({ type: 'uuid' }),
119
+ UpdatedById: col({ type: 'uuid', nullable: true }),
120
+ },
121
+ fks: [
122
+ fk({ columns: ['AdministratorId'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
123
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
124
+ ],
125
+ },
126
+ {
127
+ name: 'BlackList',
128
+ scope: 'site',
129
+ columns: {
130
+ Id: col({ type: 'uuid', pk: true }),
131
+ SiteId: col({ type: 'uuid' }),
132
+ IpAddress: col({ type: 'string', length: 50 }),
133
+ Reason: col({ type: 'string', length: 255, nullable: true }),
134
+ DateCreated: col({ type: 'datetime' }),
135
+ UtcDateCreated: col({ type: 'datetime' }),
136
+ CreatedById: col({ type: 'uuid' }),
137
+ DateUpdated: col({ type: 'datetime', nullable: true }),
138
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
139
+ UpdatedById: col({ type: 'uuid', nullable: true }),
140
+ },
141
+ indexes: [
142
+ ix({ columns: ['SiteId'] }),
143
+ ],
144
+ fks: [
145
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
146
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
147
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
148
+ ],
149
+ },
150
+ {
151
+ name: 'BlogAuthors',
152
+ scope: 'site',
153
+ siteIdAdded: true,
154
+ columns: {
155
+ AuthorId: col({ type: 'uuid', pk: true }),
156
+ Title: col({ type: 'string', length: 100 }),
157
+ Slug: col({ type: 'string', length: 100 }),
158
+ BlogId: col({ type: 'uuid' }),
159
+ AdministratorId: col({ type: 'uuid' }),
160
+ Content: col({ type: 'text', nullable: true }),
161
+ DateCreated: col({ type: 'datetime' }),
162
+ UtcDateCreated: col({ type: 'datetime' }),
163
+ DateUpdated: col({ type: 'datetime', nullable: true }),
164
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
165
+ CreatedById: col({ type: 'uuid' }),
166
+ UpdatedById: col({ type: 'uuid', nullable: true }),
167
+ SiteId: col({ type: 'uuid' }),
168
+ },
169
+ indexes: [
170
+ ix({ columns: ['SiteId'] }),
171
+ ],
172
+ fks: [
173
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
174
+ fk({ columns: ['AdministratorId'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
175
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
176
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
177
+ ],
178
+ },
179
+ {
180
+ name: 'BlogCategories',
181
+ scope: 'site',
182
+ siteIdAdded: true,
183
+ columns: {
184
+ CategoryId: col({ type: 'uuid', pk: true }),
185
+ BlogId: col({ type: 'uuid' }),
186
+ Title: col({ type: 'string', length: 100 }),
187
+ Description: col({ type: 'string', length: 256, nullable: true }),
188
+ Alias: col({ type: 'string', length: 100, nullable: true }),
189
+ DateCreated: col({ type: 'datetime' }),
190
+ UtcDateCreated: col({ type: 'datetime' }),
191
+ CreatedById: col({ type: 'uuid' }),
192
+ Published: col({ type: 'bool', nullable: true }),
193
+ DateUpdated: col({ type: 'datetime', nullable: true }),
194
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
195
+ UpdatedById: col({ type: 'uuid', nullable: true }),
196
+ Content: col({ type: 'text', nullable: true }),
197
+ SiteId: col({ type: 'uuid' }),
198
+ },
199
+ indexes: [
200
+ ix({ columns: ['SiteId'] }),
201
+ ],
202
+ fks: [
203
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
204
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
205
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
206
+ ],
207
+ },
208
+ {
209
+ name: 'BlogCategoryPosts',
210
+ scope: 'site',
211
+ siteIdAdded: true,
212
+ columns: {
213
+ BlogCategory_Id: col({ type: 'uuid', pk: true }),
214
+ Post_Id: col({ type: 'uuid', pk: true }),
215
+ SiteId: col({ type: 'uuid' }),
216
+ },
217
+ indexes: [
218
+ ix({ columns: ['SiteId'] }),
219
+ ],
220
+ fks: [
221
+ fk({ columns: ['BlogCategory_Id'], ref: 'BlogCategories', refColumns: ['CategoryId'] }),
222
+ fk({ columns: ['Post_Id'], ref: 'Posts', refColumns: ['PostId'] }),
223
+ ],
224
+ },
225
+ {
226
+ name: 'BlogPostModuleTemplates',
227
+ scope: 'site',
228
+ siteIdAdded: true,
229
+ columns: {
230
+ TemplateId: col({ type: 'uuid', pk: true }),
231
+ BlogId: col({ type: 'uuid' }),
232
+ Name: col({ type: 'string', length: 100 }),
233
+ Alias: col({ type: 'string', length: 100 }),
234
+ Description: col({ type: 'text', nullable: true }),
235
+ Content: col({ type: 'text', nullable: true }),
236
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
237
+ Layouts: col({ type: 'text', nullable: true }),
238
+ DateCreated: col({ type: 'datetime' }),
239
+ UtcDateCreated: col({ type: 'datetime' }),
240
+ CreatedById: col({ type: 'uuid' }),
241
+ DateUpdated: col({ type: 'datetime', nullable: true }),
242
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
243
+ UpdatedById: col({ type: 'uuid', nullable: true }),
244
+ SiteId: col({ type: 'uuid' }),
245
+ },
246
+ indexes: [
247
+ ix({ columns: ['SiteId'] }),
248
+ ],
249
+ fks: [
250
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
251
+ ],
252
+ },
253
+ {
254
+ name: 'BlogPostPartTemplates',
255
+ scope: 'site',
256
+ siteIdAdded: true,
257
+ columns: {
258
+ TemplateId: col({ type: 'uuid', pk: true }),
259
+ BlogId: col({ type: 'uuid' }),
260
+ Name: col({ type: 'string', length: 100 }),
261
+ Alias: col({ type: 'string', length: 100 }),
262
+ Description: col({ type: 'text', nullable: true }),
263
+ Content: col({ type: 'text', nullable: true }),
264
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
265
+ Layouts: col({ type: 'text', nullable: true }),
266
+ DateCreated: col({ type: 'datetime' }),
267
+ UtcDateCreated: col({ type: 'datetime' }),
268
+ CreatedById: col({ type: 'uuid' }),
269
+ DateUpdated: col({ type: 'datetime', nullable: true }),
270
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
271
+ UpdatedById: col({ type: 'uuid', nullable: true }),
272
+ SiteId: col({ type: 'uuid' }),
273
+ },
274
+ indexes: [
275
+ ix({ columns: ['SiteId'] }),
276
+ ],
277
+ fks: [
278
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
279
+ ],
280
+ },
281
+ {
282
+ name: 'BlogPostTemplates',
283
+ scope: 'site',
284
+ siteIdAdded: true,
285
+ columns: {
286
+ TemplateId: col({ type: 'uuid', pk: true }),
287
+ BlogId: col({ type: 'uuid' }),
288
+ Name: col({ type: 'string', length: 100 }),
289
+ Alias: col({ type: 'string', length: 100 }),
290
+ Description: col({ type: 'text', nullable: true }),
291
+ Content: col({ type: 'text', nullable: true }),
292
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
293
+ Layouts: col({ type: 'text', nullable: true }),
294
+ DateCreated: col({ type: 'datetime' }),
295
+ UtcDateCreated: col({ type: 'datetime' }),
296
+ CreatedById: col({ type: 'uuid' }),
297
+ DateUpdated: col({ type: 'datetime', nullable: true }),
298
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
299
+ UpdatedById: col({ type: 'uuid', nullable: true }),
300
+ SiteId: col({ type: 'uuid' }),
301
+ },
302
+ indexes: [
303
+ ix({ columns: ['SiteId'] }),
304
+ ],
305
+ fks: [
306
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
307
+ ],
308
+ },
309
+ {
310
+ name: 'BlogTagPosts',
311
+ scope: 'site',
312
+ siteIdAdded: true,
313
+ columns: {
314
+ BlogTag_Id: col({ type: 'uuid', pk: true }),
315
+ Post_Id: col({ type: 'uuid', pk: true }),
316
+ SiteId: col({ type: 'uuid' }),
317
+ },
318
+ indexes: [
319
+ ix({ columns: ['SiteId'] }),
320
+ ],
321
+ fks: [
322
+ fk({ columns: ['BlogTag_Id'], ref: 'BlogTags', refColumns: ['TagId'] }),
323
+ fk({ columns: ['Post_Id'], ref: 'Posts', refColumns: ['PostId'] }),
324
+ ],
325
+ },
326
+ {
327
+ name: 'BlogTags',
328
+ scope: 'site',
329
+ siteIdAdded: true,
330
+ columns: {
331
+ TagId: col({ type: 'uuid', pk: true }),
332
+ BlogId: col({ type: 'uuid' }),
333
+ Title: col({ type: 'string', length: 100 }),
334
+ Description: col({ type: 'string', length: 256, nullable: true }),
335
+ Alias: col({ type: 'string', length: 100, nullable: true }),
336
+ DateCreated: col({ type: 'datetime' }),
337
+ UtcDateCreated: col({ type: 'datetime' }),
338
+ CreatedById: col({ type: 'uuid' }),
339
+ Published: col({ type: 'bool', nullable: true }),
340
+ DateUpdated: col({ type: 'datetime', nullable: true }),
341
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
342
+ UpdatedById: col({ type: 'uuid', nullable: true }),
343
+ Content: col({ type: 'text', nullable: true }),
344
+ SiteId: col({ type: 'uuid' }),
345
+ },
346
+ indexes: [
347
+ ix({ columns: ['SiteId'] }),
348
+ ],
349
+ fks: [
350
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
351
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
352
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
353
+ ],
354
+ },
355
+ {
356
+ name: 'Blogs',
357
+ scope: 'site',
358
+ columns: {
359
+ BlogId: col({ type: 'uuid', pk: true }),
360
+ SiteId: col({ type: 'uuid' }),
361
+ Title: col({ type: 'string', length: 256 }),
362
+ Alias: col({ type: 'string', length: 256 }),
363
+ Content: col({ type: 'text', nullable: true }),
364
+ Subtitle: col({ type: 'string', length: 256, nullable: true }),
365
+ About: col({ type: 'text', nullable: true }),
366
+ AboutType: col({ type: 'int', nullable: true }),
367
+ TemplateSuffix: col({ type: 'string', length: 50, nullable: true }),
368
+ PostContent: col({ type: 'text', nullable: true }),
369
+ ImageModuleContent: col({ type: 'text', nullable: true }),
370
+ GalleryModuleContent: col({ type: 'text', nullable: true }),
371
+ DateCreated: col({ type: 'datetime' }),
372
+ UtcDateCreated: col({ type: 'datetime' }),
373
+ DateUpdated: col({ type: 'datetime', nullable: true }),
374
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
375
+ CreatedById: col({ type: 'uuid' }),
376
+ UpdatedById: col({ type: 'uuid', nullable: true }),
377
+ IncludeInSitemap: col({ type: 'bool' }),
378
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
379
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
380
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
381
+ MaxReplyCommentsLevels: col({ type: 'int' }),
382
+ AllowedCommentTags: col({ type: 'string', length: 255, nullable: true }),
383
+ YearFormat: col({ type: 'string', length: 255, nullable: true }),
384
+ MonthFormat: col({ type: 'string', length: 255, nullable: true }),
385
+ DayFormat: col({ type: 'string', length: 255, nullable: true }),
386
+ PostNumberFormat: col({ type: 'string', length: 255, nullable: true }),
387
+ FeedPath: col({ type: 'string', length: 255, nullable: true }),
388
+ CategoriesPath: col({ type: 'string', length: 255, nullable: true }),
389
+ TagsPath: col({ type: 'string', length: 255, nullable: true }),
390
+ ArchivesPath: col({ type: 'string', length: 255, nullable: true }),
391
+ PostPath: col({ type: 'string', length: 255, nullable: true }),
392
+ AuthorsPath: col({ type: 'string', length: 255, nullable: true }),
393
+ BlogLayout: col({ type: 'string', length: 100, nullable: true }),
394
+ ArchiveLayout: col({ type: 'string', length: 100, nullable: true }),
395
+ AuthorLayout: col({ type: 'string', length: 100, nullable: true }),
396
+ CategoryLayout: col({ type: 'string', length: 100, nullable: true }),
397
+ TagLayout: col({ type: 'string', length: 100, nullable: true }),
398
+ ArchivesLayout: col({ type: 'string', length: 100, nullable: true }),
399
+ AuthorsLayout: col({ type: 'string', length: 100, nullable: true }),
400
+ CategoriesLayout: col({ type: 'string', length: 100, nullable: true }),
401
+ TagsLayout: col({ type: 'string', length: 100, nullable: true }),
402
+ BlogFields: col({ type: 'text', nullable: true }),
403
+ CategoryFields: col({ type: 'text', nullable: true }),
404
+ TagFields: col({ type: 'text', nullable: true }),
405
+ AuthorFields: col({ type: 'text', nullable: true }),
406
+ FeedFormat: col({ type: 'string', length: 10 }),
407
+ FeedLayout: col({ type: 'string', length: 100, nullable: true }),
408
+ LastDateUpdated: col({ type: 'datetime' }),
409
+ UtcLastDateUpdated: col({ type: 'datetime' }),
410
+ BlogLayouts: col({ type: 'text', nullable: true }),
411
+ CategoryLayouts: col({ type: 'text', nullable: true }),
412
+ TagLayouts: col({ type: 'text', nullable: true }),
413
+ AuthorLayouts: col({ type: 'text', nullable: true }),
414
+ PostLayout: col({ type: 'string', length: 100, nullable: true }),
415
+ CommentsAllowed: col({ type: 'bool' }),
416
+ YearFields: col({ type: 'text', nullable: true }),
417
+ YearLayouts: col({ type: 'text', nullable: true }),
418
+ MonthFields: col({ type: 'text', nullable: true }),
419
+ MonthLayouts: col({ type: 'text', nullable: true }),
420
+ DayFields: col({ type: 'text', nullable: true }),
421
+ DayLayouts: col({ type: 'text', nullable: true }),
422
+ CommentsCaptchaEnabled: col({ type: 'bool' }),
423
+ RecentlyViewedEnabled: col({ type: 'bool' }),
424
+ RecentlyViewedStorage: col({ type: 'int' }),
425
+ RecentlyViewedExpires: col({ type: 'int', nullable: true }),
426
+ RecentlyViewedListCapacity: col({ type: 'int' }),
427
+ Path: col({ type: 'string', length: 256, nullable: true }),
428
+ MonthLayout: col({ type: 'string', length: 100, nullable: true }),
429
+ DayLayout: col({ type: 'string', length: 100, nullable: true }),
430
+ DefaultCorsPolicy: col({ type: 'text', nullable: true }),
431
+ },
432
+ indexes: [
433
+ ix({ columns: ['SiteId'] }),
434
+ ],
435
+ fks: [
436
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
437
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
438
+ ],
439
+ },
440
+ {
441
+ name: 'CatalogCategories',
442
+ scope: 'site',
443
+ siteIdAdded: true,
444
+ columns: {
445
+ CategoryId: col({ type: 'uuid', pk: true }),
446
+ CatalogId: col({ type: 'uuid' }),
447
+ Title: col({ type: 'string', length: 255 }),
448
+ Slug: col({ type: 'string', length: 255 }),
449
+ Content: col({ type: 'text', nullable: true }),
450
+ IncludeInSitemap: col({ type: 'bool' }),
451
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
452
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
453
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
454
+ DateCreated: col({ type: 'datetime' }),
455
+ UtcDateCreated: col({ type: 'datetime' }),
456
+ CreatedById: col({ type: 'uuid' }),
457
+ DateUpdated: col({ type: 'datetime', nullable: true }),
458
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
459
+ UpdatedById: col({ type: 'uuid', nullable: true }),
460
+ SiteId: col({ type: 'uuid' }),
461
+ },
462
+ indexes: [
463
+ ix({ columns: ['SiteId'] }),
464
+ ],
465
+ fks: [
466
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
467
+ ],
468
+ },
469
+ {
470
+ name: 'CatalogProductModuleTemplates',
471
+ scope: 'site',
472
+ siteIdAdded: true,
473
+ columns: {
474
+ TemplateId: col({ type: 'uuid', pk: true }),
475
+ CatalogId: col({ type: 'uuid' }),
476
+ Name: col({ type: 'string', length: 100 }),
477
+ Alias: col({ type: 'string', length: 100 }),
478
+ Description: col({ type: 'text', nullable: true }),
479
+ Content: col({ type: 'text', nullable: true }),
480
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
481
+ Layouts: col({ type: 'text', nullable: true }),
482
+ DateCreated: col({ type: 'datetime' }),
483
+ UtcDateCreated: col({ type: 'datetime' }),
484
+ CreatedById: col({ type: 'uuid' }),
485
+ DateUpdated: col({ type: 'datetime', nullable: true }),
486
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
487
+ UpdatedById: col({ type: 'uuid', nullable: true }),
488
+ SiteId: col({ type: 'uuid' }),
489
+ },
490
+ indexes: [
491
+ ix({ columns: ['SiteId'] }),
492
+ ],
493
+ fks: [
494
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
495
+ ],
496
+ },
497
+ {
498
+ name: 'CatalogProductPartTemplates',
499
+ scope: 'site',
500
+ siteIdAdded: true,
501
+ columns: {
502
+ TemplateId: col({ type: 'uuid', pk: true }),
503
+ CatalogId: col({ type: 'uuid' }),
504
+ Name: col({ type: 'string', length: 100 }),
505
+ Alias: col({ type: 'string', length: 100 }),
506
+ Description: col({ type: 'text', nullable: true }),
507
+ Content: col({ type: 'text', nullable: true }),
508
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
509
+ Layouts: col({ type: 'text', nullable: true }),
510
+ DateCreated: col({ type: 'datetime' }),
511
+ UtcDateCreated: col({ type: 'datetime' }),
512
+ CreatedById: col({ type: 'uuid' }),
513
+ DateUpdated: col({ type: 'datetime', nullable: true }),
514
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
515
+ UpdatedById: col({ type: 'uuid', nullable: true }),
516
+ SiteId: col({ type: 'uuid' }),
517
+ },
518
+ indexes: [
519
+ ix({ columns: ['SiteId'] }),
520
+ ],
521
+ fks: [
522
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
523
+ ],
524
+ },
525
+ {
526
+ name: 'CatalogProductTemplates',
527
+ scope: 'site',
528
+ siteIdAdded: true,
529
+ columns: {
530
+ TemplateId: col({ type: 'uuid', pk: true }),
531
+ CatalogId: col({ type: 'uuid' }),
532
+ Name: col({ type: 'string', length: 100 }),
533
+ Alias: col({ type: 'string', length: 100 }),
534
+ Description: col({ type: 'text', nullable: true }),
535
+ Content: col({ type: 'text', nullable: true }),
536
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
537
+ Layouts: col({ type: 'text', nullable: true }),
538
+ DateCreated: col({ type: 'datetime' }),
539
+ UtcDateCreated: col({ type: 'datetime' }),
540
+ CreatedById: col({ type: 'uuid' }),
541
+ DateUpdated: col({ type: 'datetime', nullable: true }),
542
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
543
+ UpdatedById: col({ type: 'uuid', nullable: true }),
544
+ SiteId: col({ type: 'uuid' }),
545
+ },
546
+ indexes: [
547
+ ix({ columns: ['SiteId'] }),
548
+ ],
549
+ fks: [
550
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
551
+ ],
552
+ },
553
+ {
554
+ name: 'CatalogProducts',
555
+ scope: 'site',
556
+ siteIdAdded: true,
557
+ columns: {
558
+ ProductId: col({ type: 'uuid', pk: true }),
559
+ CatalogId: col({ type: 'uuid' }),
560
+ TemplateId: col({ type: 'uuid' }),
561
+ Number: col({ type: 'int' }),
562
+ Title: col({ type: 'string', length: 255 }),
563
+ Slug: col({ type: 'string', length: 255 }),
564
+ Content: col({ type: 'text', nullable: true }),
565
+ Published: col({ type: 'bool' }),
566
+ IncludeInSitemap: col({ type: 'bool' }),
567
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
568
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
569
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
570
+ DateCreated: col({ type: 'datetime' }),
571
+ UtcDateCreated: col({ type: 'datetime' }),
572
+ CreatedById: col({ type: 'uuid' }),
573
+ DateUpdated: col({ type: 'datetime', nullable: true }),
574
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
575
+ UpdatedById: col({ type: 'uuid', nullable: true }),
576
+ SiteId: col({ type: 'uuid' }),
577
+ },
578
+ indexes: [
579
+ ix({ columns: ['SiteId'] }),
580
+ ],
581
+ fks: [
582
+ fk({ columns: ['TemplateId'], ref: 'CatalogProductTemplates', refColumns: ['TemplateId'] }),
583
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
584
+ // legacy has no DB constraint on this edge and real rows violate it (CatalogProducts
585
+ // extends Products logically); kept as a soft reference so a cutover can ingest the data
586
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'], soft: true }),
587
+ ],
588
+ },
589
+ {
590
+ name: 'CatalogProductsCategories',
591
+ scope: 'site',
592
+ siteIdAdded: true,
593
+ columns: {
594
+ ProductId: col({ type: 'uuid', pk: true }),
595
+ CategoryId: col({ type: 'uuid', pk: true }),
596
+ SiteId: col({ type: 'uuid' }),
597
+ },
598
+ indexes: [
599
+ ix({ columns: ['SiteId'] }),
600
+ ],
601
+ fks: [
602
+ fk({ columns: ['CategoryId'], ref: 'CatalogCategories', refColumns: ['CategoryId'] }),
603
+ fk({ columns: ['ProductId'], ref: 'CatalogProducts', refColumns: ['ProductId'] }),
604
+ ],
605
+ },
606
+ {
607
+ name: 'CatalogProductsTags',
608
+ scope: 'site',
609
+ siteIdAdded: true,
610
+ columns: {
611
+ ProductId: col({ type: 'uuid', pk: true }),
612
+ TagId: col({ type: 'uuid', pk: true }),
613
+ SiteId: col({ type: 'uuid' }),
614
+ },
615
+ indexes: [
616
+ ix({ columns: ['SiteId'] }),
617
+ ],
618
+ fks: [
619
+ fk({ columns: ['ProductId'], ref: 'CatalogProducts', refColumns: ['ProductId'] }),
620
+ fk({ columns: ['TagId'], ref: 'CatalogTags', refColumns: ['TagId'] }),
621
+ ],
622
+ },
623
+ {
624
+ name: 'CatalogTags',
625
+ scope: 'site',
626
+ siteIdAdded: true,
627
+ columns: {
628
+ TagId: col({ type: 'uuid', pk: true }),
629
+ CatalogId: col({ type: 'uuid' }),
630
+ Title: col({ type: 'string', length: 255 }),
631
+ Slug: col({ type: 'string', length: 255 }),
632
+ Content: col({ type: 'text', nullable: true }),
633
+ IncludeInSitemap: col({ type: 'bool' }),
634
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
635
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
636
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
637
+ DateCreated: col({ type: 'datetime' }),
638
+ UtcDateCreated: col({ type: 'datetime' }),
639
+ CreatedById: col({ type: 'uuid' }),
640
+ DateUpdated: col({ type: 'datetime', nullable: true }),
641
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
642
+ UpdatedById: col({ type: 'uuid', nullable: true }),
643
+ SiteId: col({ type: 'uuid' }),
644
+ },
645
+ indexes: [
646
+ ix({ columns: ['SiteId'] }),
647
+ ],
648
+ fks: [
649
+ fk({ columns: ['CatalogId'], ref: 'Catalogs', refColumns: ['CatalogId'] }),
650
+ ],
651
+ },
652
+ {
653
+ name: 'Catalogs',
654
+ scope: 'site',
655
+ columns: {
656
+ CatalogId: col({ type: 'uuid', pk: true }),
657
+ SiteId: col({ type: 'uuid' }),
658
+ Title: col({ type: 'string', length: 255 }),
659
+ Path: col({ type: 'string', length: 255 }),
660
+ Alias: col({ type: 'string', length: 255 }),
661
+ Content: col({ type: 'text', nullable: true }),
662
+ CatalogLayout: col({ type: 'string', length: 100, nullable: true }),
663
+ CatalogLayouts: col({ type: 'text', nullable: true }),
664
+ CatalogFields: col({ type: 'text', nullable: true }),
665
+ CategoriesLayout: col({ type: 'string', length: 100, nullable: true }),
666
+ CategoryLayout: col({ type: 'string', length: 100, nullable: true }),
667
+ CategoryLayouts: col({ type: 'text', nullable: true }),
668
+ CategoryFields: col({ type: 'text', nullable: true }),
669
+ CategoriesPath: col({ type: 'string', length: 255, nullable: true }),
670
+ TagsLayout: col({ type: 'string', length: 100, nullable: true }),
671
+ TagLayout: col({ type: 'string', length: 100, nullable: true }),
672
+ TagLayouts: col({ type: 'text', nullable: true }),
673
+ TagFields: col({ type: 'text', nullable: true }),
674
+ TagsPath: col({ type: 'string', length: 255, nullable: true }),
675
+ ProductLayout: col({ type: 'string', length: 100, nullable: true }),
676
+ ProductPath: col({ type: 'string', length: 255, nullable: true }),
677
+ ProductsPath: col({ type: 'string', length: 255, nullable: true }),
678
+ ProductNumberFormat: col({ type: 'string', length: 50, nullable: true }),
679
+ IncludeInSitemap: col({ type: 'bool' }),
680
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
681
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
682
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
683
+ RecentlyViewedEnabled: col({ type: 'bool' }),
684
+ RecentlyViewedStorage: col({ type: 'int' }),
685
+ RecentlyViewedExpires: col({ type: 'int', nullable: true }),
686
+ RecentlyViewedListCapacity: col({ type: 'int' }),
687
+ DefaultCorsPolicy: col({ type: 'text', nullable: true }),
688
+ DateCreated: col({ type: 'datetime' }),
689
+ UtcDateCreated: col({ type: 'datetime' }),
690
+ CreatedById: col({ type: 'uuid' }),
691
+ DateUpdated: col({ type: 'datetime', nullable: true }),
692
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
693
+ UpdatedById: col({ type: 'uuid', nullable: true }),
694
+ },
695
+ indexes: [
696
+ ix({ columns: ['SiteId'] }),
697
+ ],
698
+ },
699
+ {
700
+ name: 'ContentPageItems',
701
+ scope: 'site',
702
+ siteIdAdded: true,
703
+ columns: {
704
+ ItemId: col({ type: 'uuid', pk: true }),
705
+ PageId: col({ type: 'uuid', nullable: true }),
706
+ PostId: col({ type: 'uuid', nullable: true }),
707
+ ProductId: col({ type: 'uuid', nullable: true }),
708
+ ProjectId: col({ type: 'uuid', nullable: true }),
709
+ ContentId: col({ type: 'string', length: 100 }),
710
+ Content: col({ type: 'text', nullable: true }),
711
+ Discriminator: col({ type: 'string', length: 256, nullable: true }),
712
+ SiteId: col({ type: 'uuid' }),
713
+ },
714
+ indexes: [
715
+ ix({ columns: ['SiteId'] }),
716
+ ],
717
+ fks: [
718
+ fk({ columns: ['PostId'], ref: 'Posts', refColumns: ['PostId'] }),
719
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'] }),
720
+ fk({ columns: ['PageId'], ref: 'ContentPageParts', refColumns: ['PageId'] }),
721
+ ],
722
+ },
723
+ {
724
+ name: 'ContentPageParts',
725
+ scope: 'site',
726
+ columns: {
727
+ PageId: col({ type: 'uuid', pk: true }),
728
+ Alias: col({ type: 'string', length: 256 }),
729
+ Title: col({ type: 'string', length: 256 }),
730
+ ParentPageId: col({ type: 'uuid', nullable: true }),
731
+ Index: col({ type: 'int', nullable: true }),
732
+ PartId: col({ type: 'string', length: 100, nullable: true }),
733
+ TemplateName: col({ type: 'string', length: 100 }),
734
+ SiteId: col({ type: 'uuid' }),
735
+ MetaKeywords: col({ type: 'string', length: 256, nullable: true }),
736
+ MetaDescription: col({ type: 'string', length: 256, nullable: true }),
737
+ IncludeInSitemap: col({ type: 'bool', nullable: true }),
738
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
739
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
740
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
741
+ DateCreated: col({ type: 'datetime', nullable: true }),
742
+ UtcDateCreated: col({ type: 'datetime', nullable: true }),
743
+ CreatedById: col({ type: 'uuid', nullable: true }),
744
+ Discriminator: col({ type: 'string', length: 128 }),
745
+ },
746
+ indexes: [
747
+ ix({ columns: ['SiteId'] }),
748
+ ],
749
+ fks: [
750
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
751
+ fk({ columns: ['ParentPageId'], ref: 'ContentPageParts', refColumns: ['PageId'] }),
752
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
753
+ // legacy has no DB constraint; orphan parts exist in production data
754
+ fk({ columns: ['PageId'], ref: 'Pages', refColumns: ['PageId'], soft: true }),
755
+ ],
756
+ },
757
+ {
758
+ name: 'CustomCategories',
759
+ scope: 'site',
760
+ siteIdAdded: true,
761
+ columns: {
762
+ CategoryId: col({ type: 'uuid', pk: true }),
763
+ TypeId: col({ type: 'uuid' }),
764
+ Title: col({ type: 'string', length: 50 }),
765
+ Slug: col({ type: 'string', length: 50 }),
766
+ Description: col({ type: 'string', length: 256, nullable: true }),
767
+ DateCreated: col({ type: 'datetime' }),
768
+ UtcDateCreated: col({ type: 'datetime' }),
769
+ DateUpdated: col({ type: 'datetime', nullable: true }),
770
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
771
+ CreatedById: col({ type: 'uuid' }),
772
+ UpdatedById: col({ type: 'uuid', nullable: true }),
773
+ Content: col({ type: 'text', nullable: true }),
774
+ SiteId: col({ type: 'uuid' }),
775
+ },
776
+ indexes: [
777
+ ix({ columns: ['SiteId'] }),
778
+ ],
779
+ fks: [
780
+ fk({ columns: ['TypeId'], ref: 'CustomCategoryTypes', refColumns: ['TypeId'] }),
781
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
782
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
783
+ ],
784
+ },
785
+ {
786
+ name: 'CustomCategoryContentPages',
787
+ scope: 'site',
788
+ siteIdAdded: true,
789
+ columns: {
790
+ CustomCategory_Id: col({ type: 'uuid', pk: true }),
791
+ Page_Id: col({ type: 'uuid', pk: true }),
792
+ SiteId: col({ type: 'uuid' }),
793
+ },
794
+ indexes: [
795
+ ix({ columns: ['SiteId'] }),
796
+ ],
797
+ fks: [
798
+ fk({ columns: ['Page_Id'], ref: 'ContentPageParts', refColumns: ['PageId'] }),
799
+ fk({ columns: ['CustomCategory_Id'], ref: 'CustomCategories', refColumns: ['CategoryId'] }),
800
+ ],
801
+ },
802
+ {
803
+ name: 'CustomCategoryPages',
804
+ scope: 'site',
805
+ siteIdAdded: true,
806
+ columns: {
807
+ CustomCategory_Id: col({ type: 'uuid', pk: true }),
808
+ Page_Id: col({ type: 'uuid', pk: true }),
809
+ SiteId: col({ type: 'uuid' }),
810
+ },
811
+ indexes: [
812
+ ix({ columns: ['SiteId'] }),
813
+ ],
814
+ fks: [
815
+ fk({ columns: ['CustomCategory_Id'], ref: 'CustomCategories', refColumns: ['CategoryId'] }),
816
+ fk({ columns: ['Page_Id'], ref: 'Pages', refColumns: ['PageId'] }),
817
+ ],
818
+ },
819
+ {
820
+ name: 'CustomCategoryPosts',
821
+ scope: 'site',
822
+ siteIdAdded: true,
823
+ columns: {
824
+ CustomCategory_Id: col({ type: 'uuid', pk: true }),
825
+ Post_Id: col({ type: 'uuid', pk: true }),
826
+ SiteId: col({ type: 'uuid' }),
827
+ },
828
+ indexes: [
829
+ ix({ columns: ['SiteId'] }),
830
+ ],
831
+ fks: [
832
+ fk({ columns: ['CustomCategory_Id'], ref: 'CustomCategories', refColumns: ['CategoryId'] }),
833
+ fk({ columns: ['Post_Id'], ref: 'Posts', refColumns: ['PostId'] }),
834
+ ],
835
+ },
836
+ {
837
+ name: 'CustomCategoryProducts',
838
+ scope: 'site',
839
+ siteIdAdded: true,
840
+ columns: {
841
+ CustomCategory_Id: col({ type: 'uuid', pk: true }),
842
+ Product_Id: col({ type: 'uuid', pk: true }),
843
+ SiteId: col({ type: 'uuid' }),
844
+ },
845
+ indexes: [
846
+ ix({ columns: ['SiteId'] }),
847
+ ],
848
+ fks: [
849
+ fk({ columns: ['CustomCategory_Id'], ref: 'CustomCategories', refColumns: ['CategoryId'] }),
850
+ fk({ columns: ['Product_Id'], ref: 'Products', refColumns: ['ProductId'] }),
851
+ ],
852
+ },
853
+ {
854
+ name: 'CustomCategoryProjects',
855
+ scope: 'site',
856
+ siteIdAdded: true,
857
+ columns: {
858
+ CustomCategory_Id: col({ type: 'uuid', pk: true }),
859
+ Project_Id: col({ type: 'uuid', pk: true }),
860
+ SiteId: col({ type: 'uuid' }),
861
+ },
862
+ indexes: [
863
+ ix({ columns: ['SiteId'] }),
864
+ ],
865
+ fks: [
866
+ fk({ columns: ['CustomCategory_Id'], ref: 'CustomCategories', refColumns: ['CategoryId'] }),
867
+ ],
868
+ },
869
+ {
870
+ name: 'CustomCategoryTypes',
871
+ scope: 'site',
872
+ columns: {
873
+ TypeId: col({ type: 'uuid', pk: true }),
874
+ SiteId: col({ type: 'uuid' }),
875
+ BlogId: col({ type: 'uuid', nullable: true }),
876
+ PortfolioId: col({ type: 'uuid', nullable: true }),
877
+ StoreId: col({ type: 'uuid', nullable: true }),
878
+ Seq: col({ type: 'int', nullable: true }),
879
+ Path: col({ type: 'string', length: 100, nullable: true }),
880
+ Title: col({ type: 'string', length: 50 }),
881
+ Slug: col({ type: 'string', length: 50 }),
882
+ Description: col({ type: 'string', length: 256, nullable: true }),
883
+ TemplateName: col({ type: 'string', length: 50, nullable: true }),
884
+ DateCreated: col({ type: 'datetime' }),
885
+ UtcDateCreated: col({ type: 'datetime' }),
886
+ DateUpdated: col({ type: 'datetime', nullable: true }),
887
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
888
+ CreatedById: col({ type: 'uuid' }),
889
+ UpdatedById: col({ type: 'uuid', nullable: true }),
890
+ Discriminator: col({ type: 'string', length: 50, nullable: true }),
891
+ CategoryFields: col({ type: 'text', nullable: true }),
892
+ Page_SiteId: col({ type: 'uuid', nullable: true }),
893
+ CategoryLayouts: col({ type: 'text', nullable: true }),
894
+ Alias: col({ type: 'string', length: 100, nullable: true }),
895
+ CategoryLayout: col({ type: 'string', length: 50, nullable: true }),
896
+ },
897
+ indexes: [
898
+ ix({ columns: ['SiteId'] }),
899
+ ],
900
+ fks: [
901
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
902
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
903
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
904
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
905
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
906
+ ],
907
+ },
908
+ {
909
+ name: 'Domains',
910
+ scope: 'site',
911
+ columns: {
912
+ DomainId: col({ type: 'uuid', pk: true }),
913
+ Name: col({ type: 'string', length: 255 }),
914
+ PrefixAction: col({ type: 'int' }),
915
+ Public: col({ type: 'bool' }),
916
+ SiteId: col({ type: 'uuid' }),
917
+ ThemeId: col({ type: 'uuid', nullable: true }),
918
+ DateCreated: col({ type: 'datetime' }),
919
+ UtcDateCreated: col({ type: 'datetime' }),
920
+ CreatedById: col({ type: 'uuid' }),
921
+ DateUpdated: col({ type: 'datetime', nullable: true }),
922
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
923
+ UpdatedById: col({ type: 'uuid', nullable: true }),
924
+ SettingsData: col({ type: 'text', nullable: true }),
925
+ RobotsTxt: col({ type: 'text', nullable: true }),
926
+ },
927
+ indexes: [
928
+ ix({ columns: ['SiteId'] }),
929
+ ],
930
+ fks: [
931
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
932
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
933
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
934
+ fk({ columns: ['ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
935
+ ],
936
+ },
937
+ {
938
+ name: 'EmailTemplates',
939
+ scope: 'site',
940
+ siteIdAdded: true,
941
+ columns: {
942
+ TemplateId: col({ type: 'uuid', pk: true }),
943
+ Name: col({ type: 'string', length: 100 }),
944
+ LoweredName: col({ type: 'string', length: 100 }),
945
+ Description: col({ type: 'text', nullable: true }),
946
+ From: col({ type: 'string', length: 255, nullable: true }),
947
+ To: col({ type: 'string', length: 255, nullable: true }),
948
+ Subject: col({ type: 'string', length: 255, nullable: true }),
949
+ HtmlEnabled: col({ type: 'bool' }),
950
+ PlainText: col({ type: 'text', nullable: true }),
951
+ Html: col({ type: 'text', nullable: true }),
952
+ DateCreated: col({ type: 'datetime' }),
953
+ UtcDateCreated: col({ type: 'datetime' }),
954
+ CreatedById: col({ type: 'uuid' }),
955
+ DateUpdated: col({ type: 'datetime', nullable: true }),
956
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
957
+ UpdatedById: col({ type: 'uuid', nullable: true }),
958
+ Discriminator: col({ type: 'string', length: 255, nullable: true }),
959
+ BlogId: col({ type: 'uuid', nullable: true }),
960
+ StoreId: col({ type: 'uuid', nullable: true }),
961
+ Cc: col({ type: 'string', length: 255, nullable: true }),
962
+ Bcc: col({ type: 'string', length: 255, nullable: true }),
963
+ FromDisplayName: col({ type: 'string', length: 255, nullable: true }),
964
+ SiteId: col({ type: 'uuid' }),
965
+ },
966
+ indexes: [
967
+ ix({ columns: ['SiteId'] }),
968
+ ],
969
+ fks: [
970
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
971
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
972
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
973
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
974
+ ],
975
+ },
976
+ {
977
+ name: 'FeedPageParams',
978
+ scope: 'site',
979
+ siteIdAdded: true,
980
+ columns: {
981
+ ParamId: col({ type: 'uuid', pk: true }),
982
+ Seq: col({ type: 'int' }),
983
+ Name: col({ type: 'string', length: 50, nullable: true }),
984
+ PageId: col({ type: 'uuid' }),
985
+ SiteId: col({ type: 'uuid' }),
986
+ },
987
+ indexes: [
988
+ ix({ columns: ['SiteId'] }),
989
+ ],
990
+ fks: [
991
+ fk({ columns: ['PageId'], ref: 'FeedPages', refColumns: ['PageId'] }),
992
+ ],
993
+ },
994
+ {
995
+ name: 'FeedPages',
996
+ scope: 'site',
997
+ columns: {
998
+ PageId: col({ type: 'uuid', pk: true }),
999
+ Title: col({ type: 'string', length: 100 }),
1000
+ Path: col({ type: 'string', length: 100, nullable: true }),
1001
+ SiteId: col({ type: 'uuid' }),
1002
+ Slug: col({ type: 'string', length: 50, nullable: true }),
1003
+ ParentPageId: col({ type: 'uuid', nullable: true }),
1004
+ FeedId: col({ type: 'uuid' }),
1005
+ TemplateName: col({ type: 'string', length: 50, nullable: true }),
1006
+ PageContent: col({ type: 'text', nullable: true }),
1007
+ PageNumberParamName: col({ type: 'string', length: 50, nullable: true }),
1008
+ PageSizeParamName: col({ type: 'string', length: 50, nullable: true }),
1009
+ PageSize: col({ type: 'int', nullable: true }),
1010
+ Level: col({ type: 'int' }),
1011
+ DateCreated: col({ type: 'datetime' }),
1012
+ UtcDateCreated: col({ type: 'datetime' }),
1013
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1014
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1015
+ CreatedById: col({ type: 'uuid' }),
1016
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1017
+ IncludeInSitemap: col({ type: 'bool' }),
1018
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
1019
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
1020
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
1021
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
1022
+ Params: col({ type: 'text', nullable: true }),
1023
+ },
1024
+ indexes: [
1025
+ ix({ columns: ['SiteId'] }),
1026
+ ],
1027
+ fks: [
1028
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1029
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1030
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1031
+ fk({ columns: ['FeedId'], ref: 'Feeds', refColumns: ['FeedId'] }),
1032
+ fk({ columns: ['ParentPageId'], ref: 'FeedPages', refColumns: ['PageId'] }),
1033
+ // legacy has no DB constraint; orphan feed pages exist in production data
1034
+ fk({ columns: ['PageId'], ref: 'Pages', refColumns: ['PageId'], soft: true }),
1035
+ ],
1036
+ },
1037
+ {
1038
+ name: 'FeedParams',
1039
+ scope: 'site',
1040
+ siteIdAdded: true,
1041
+ columns: {
1042
+ ParamId: col({ type: 'uuid', pk: true }),
1043
+ Key: col({ type: 'string', length: 100 }),
1044
+ Value: col({ type: 'text', nullable: true }),
1045
+ FeedId: col({ type: 'uuid' }),
1046
+ Liquidizable: col({ type: 'bool' }),
1047
+ SiteId: col({ type: 'uuid' }),
1048
+ },
1049
+ indexes: [
1050
+ ix({ columns: ['SiteId'] }),
1051
+ ],
1052
+ fks: [
1053
+ fk({ columns: ['FeedId'], ref: 'Feeds', refColumns: ['FeedId'] }),
1054
+ ],
1055
+ },
1056
+ {
1057
+ name: 'Feeds',
1058
+ scope: 'site',
1059
+ columns: {
1060
+ FeedId: col({ type: 'uuid', pk: true }),
1061
+ Title: col({ type: 'string', length: 100 }),
1062
+ Alias: col({ type: 'string', length: 100 }),
1063
+ LoweredAlias: col({ type: 'string', length: 100 }),
1064
+ Content: col({ type: 'text', nullable: true }),
1065
+ FetchedAt: col({ type: 'datetime', nullable: true }),
1066
+ UtcFetchedAt: col({ type: 'datetime', nullable: true }),
1067
+ SiteId: col({ type: 'uuid' }),
1068
+ DateCreated: col({ type: 'datetime' }),
1069
+ UtcDateCreated: col({ type: 'datetime' }),
1070
+ CreatedById: col({ type: 'uuid' }),
1071
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1072
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1073
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1074
+ Discriminator: col({ type: 'string', length: 128 }),
1075
+ FetchInterval: col({ type: 'int', nullable: true }),
1076
+ },
1077
+ indexes: [
1078
+ ix({ columns: ['SiteId'] }),
1079
+ ],
1080
+ fks: [
1081
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1082
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1083
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1084
+ ],
1085
+ },
1086
+ {
1087
+ name: 'Files',
1088
+ scope: 'site',
1089
+ siteIdAdded: true,
1090
+ columns: {
1091
+ FileId: col({ type: 'uuid', pk: true }),
1092
+ FolderId: col({ type: 'uuid' }),
1093
+ Filename: col({ type: 'string', length: 100 }),
1094
+ LoweredFilename: col({ type: 'string', length: 100 }),
1095
+ ContentType: col({ type: 'string', length: 50 }),
1096
+ Size: col({ type: 'int' }),
1097
+ StorageClient: col({ type: 'string', length: 50, nullable: true }),
1098
+ StorageFilename: col({ type: 'string', length: 256 }),
1099
+ DateCreated: col({ type: 'datetime' }),
1100
+ UtcDateCreated: col({ type: 'datetime' }),
1101
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1102
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1103
+ CreatedById: col({ type: 'uuid' }),
1104
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1105
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
1106
+ Hash: col({ type: 'string', length: 50, nullable: true }),
1107
+ SiteId: col({ type: 'uuid' }),
1108
+ },
1109
+ indexes: [
1110
+ ix({ columns: ['SiteId'] }),
1111
+ ],
1112
+ fks: [
1113
+ fk({ columns: ['FolderId'], ref: 'Folders', refColumns: ['FolderId'] }),
1114
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1115
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1116
+ ],
1117
+ },
1118
+ {
1119
+ name: 'Folders',
1120
+ scope: 'site',
1121
+ siteIdAdded: true,
1122
+ columns: {
1123
+ FolderId: col({ type: 'uuid', pk: true }),
1124
+ OwnerId: col({ type: 'uuid', nullable: true }),
1125
+ ImagesFolder_ThemeId: col({ type: 'uuid', nullable: true }),
1126
+ ScriptsFolder_ThemeId: col({ type: 'uuid', nullable: true }),
1127
+ StylesheetsFolder_ThemeId: col({ type: 'uuid', nullable: true }),
1128
+ Path: col({ type: 'string', length: 256 }),
1129
+ LoweredPath: col({ type: 'string', length: 256 }),
1130
+ ImageSettingsProviderType: col({ type: 'string', length: 256, nullable: true }),
1131
+ ImageSettingsProviderParams: col({ type: 'string', length: 256, nullable: true }),
1132
+ ImageSettings: col({ type: 'text', nullable: true }),
1133
+ DateCreated: col({ type: 'datetime' }),
1134
+ UtcDateCreated: col({ type: 'datetime' }),
1135
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1136
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1137
+ CreatedById: col({ type: 'uuid' }),
1138
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1139
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
1140
+ ImagesFolder_Id: col({ type: 'uuid', nullable: true }),
1141
+ SiteId: col({ type: 'uuid' }),
1142
+ },
1143
+ indexes: [
1144
+ ix({ columns: ['SiteId'] }),
1145
+ ],
1146
+ fks: [
1147
+ fk({ columns: ['ImagesFolder_ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
1148
+ fk({ columns: ['ScriptsFolder_ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
1149
+ fk({ columns: ['StylesheetsFolder_ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
1150
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1151
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1152
+ ],
1153
+ },
1154
+ {
1155
+ name: 'FormAdministrators',
1156
+ scope: 'site',
1157
+ siteIdAdded: true,
1158
+ columns: {
1159
+ Form_Id: col({ type: 'uuid', pk: true }),
1160
+ Administrator_Id: col({ type: 'uuid', pk: true }),
1161
+ SiteId: col({ type: 'uuid' }),
1162
+ },
1163
+ indexes: [
1164
+ ix({ columns: ['SiteId'] }),
1165
+ ],
1166
+ fks: [
1167
+ fk({ columns: ['Administrator_Id'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1168
+ fk({ columns: ['Form_Id'], ref: 'Forms', refColumns: ['FormId'] }),
1169
+ ],
1170
+ },
1171
+ {
1172
+ name: 'FormRecipients',
1173
+ scope: 'site',
1174
+ siteIdAdded: true,
1175
+ columns: {
1176
+ RecipientId: col({ type: 'uuid', pk: true }),
1177
+ FormId: col({ type: 'uuid' }),
1178
+ AdministratorId: col({ type: 'uuid' }),
1179
+ DateCreated: col({ type: 'datetime' }),
1180
+ UtcDateCreated: col({ type: 'datetime' }),
1181
+ CreatedById: col({ type: 'uuid' }),
1182
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1183
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1184
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1185
+ SiteId: col({ type: 'uuid' }),
1186
+ },
1187
+ indexes: [
1188
+ ix({ columns: ['SiteId'] }),
1189
+ ],
1190
+ fks: [
1191
+ fk({ columns: ['AdministratorId'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1192
+ fk({ columns: ['FormId'], ref: 'Forms', refColumns: ['FormId'] }),
1193
+ ],
1194
+ },
1195
+ {
1196
+ name: 'FormSubmissionFields',
1197
+ scope: 'site',
1198
+ siteIdAdded: true,
1199
+ columns: {
1200
+ FieldId: col({ type: 'uuid', pk: true }),
1201
+ SubmissionId: col({ type: 'uuid' }),
1202
+ Seq: col({ type: 'int' }),
1203
+ Title: col({ type: 'string', length: 100, nullable: true }),
1204
+ Value: col({ type: 'text', nullable: true }),
1205
+ DataType: col({ type: 'int' }),
1206
+ Name: col({ type: 'string', length: 100, nullable: true }),
1207
+ SiteId: col({ type: 'uuid' }),
1208
+ },
1209
+ indexes: [
1210
+ ix({ columns: ['SiteId'] }),
1211
+ ],
1212
+ fks: [
1213
+ fk({ columns: ['SubmissionId'], ref: 'FormSubmissions', refColumns: ['SubmissionId'] }),
1214
+ ],
1215
+ },
1216
+ {
1217
+ name: 'FormSubmissionFieldsOld',
1218
+ scope: 'site',
1219
+ siteIdAdded: true,
1220
+ columns: {
1221
+ FieldId: col({ type: 'uuid', pk: true }),
1222
+ SubmissionId: col({ type: 'uuid' }),
1223
+ Seq: col({ type: 'int' }),
1224
+ Title: col({ type: 'string', length: 100, nullable: true }),
1225
+ Value: col({ type: 'string', length: 4000, nullable: true }),
1226
+ DataType: col({ type: 'int' }),
1227
+ Name: col({ type: 'string', length: 100, nullable: true }),
1228
+ SiteId: col({ type: 'uuid' }),
1229
+ },
1230
+ indexes: [
1231
+ ix({ columns: ['SiteId'] }),
1232
+ ],
1233
+ fks: [
1234
+ fk({ columns: ['SubmissionId'], ref: 'FormSubmissions', refColumns: ['SubmissionId'] }),
1235
+ ],
1236
+ },
1237
+ {
1238
+ name: 'FormSubmissions',
1239
+ scope: 'site',
1240
+ siteIdAdded: true,
1241
+ columns: {
1242
+ SubmissionId: col({ type: 'uuid', pk: true }),
1243
+ FormId: col({ type: 'uuid' }),
1244
+ Date: col({ type: 'datetime' }),
1245
+ UtcDate: col({ type: 'datetime' }),
1246
+ Number: col({ type: 'int' }),
1247
+ IpAddress: col({ type: 'string', length: 100, nullable: true }),
1248
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
1249
+ IsSpam: col({ type: 'bool' }),
1250
+ Content: col({ type: 'text', nullable: true }),
1251
+ SiteId: col({ type: 'uuid' }),
1252
+ },
1253
+ indexes: [
1254
+ ix({ columns: ['SiteId'] }),
1255
+ ],
1256
+ fks: [
1257
+ fk({ columns: ['FormId'], ref: 'Forms', refColumns: ['FormId'] }),
1258
+ ],
1259
+ },
1260
+ {
1261
+ name: 'FormTemplates',
1262
+ scope: 'site',
1263
+ columns: {
1264
+ TemplateId: col({ type: 'uuid', pk: true }),
1265
+ SiteId: col({ type: 'uuid' }),
1266
+ Name: col({ type: 'string', length: 100 }),
1267
+ Alias: col({ type: 'string', length: 100 }),
1268
+ Description: col({ type: 'text', nullable: true }),
1269
+ Content: col({ type: 'text', nullable: true }),
1270
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
1271
+ Layouts: col({ type: 'text', nullable: true }),
1272
+ DateCreated: col({ type: 'datetime' }),
1273
+ UtcDateCreated: col({ type: 'datetime' }),
1274
+ CreatedById: col({ type: 'uuid' }),
1275
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1276
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1277
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1278
+ ConfirmationEmailTemplate: col({ type: 'string', length: 255, nullable: true }),
1279
+ SubmissionEmailTemplate: col({ type: 'string', length: 255, nullable: true }),
1280
+ },
1281
+ indexes: [
1282
+ ix({ columns: ['SiteId'] }),
1283
+ ],
1284
+ fks: [
1285
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1286
+ ],
1287
+ },
1288
+ {
1289
+ name: 'Forms',
1290
+ scope: 'site',
1291
+ columns: {
1292
+ FormId: col({ type: 'uuid', pk: true }),
1293
+ Name: col({ type: 'string', length: 100, nullable: true }),
1294
+ Content: col({ type: 'text', nullable: true }),
1295
+ SubmissionAction: col({ type: 'int' }),
1296
+ RedirectUrl: col({ type: 'string', length: 256, nullable: true }),
1297
+ SuccessMessage: col({ type: 'string', length: 256, nullable: true }),
1298
+ SiteId: col({ type: 'uuid' }),
1299
+ DateCreated: col({ type: 'datetime' }),
1300
+ UtcDateCreated: col({ type: 'datetime' }),
1301
+ CreatedById: col({ type: 'uuid' }),
1302
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1303
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1304
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1305
+ Path: col({ type: 'string', length: 256, nullable: true }),
1306
+ TemplateId: col({ type: 'uuid', nullable: true }),
1307
+ },
1308
+ indexes: [
1309
+ ix({ columns: ['SiteId'] }),
1310
+ ],
1311
+ fks: [
1312
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1313
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1314
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1315
+ ],
1316
+ },
1317
+ {
1318
+ name: 'Gallery',
1319
+ scope: 'site',
1320
+ siteIdAdded: true,
1321
+ columns: {
1322
+ IdGallery: col({ type: 'uuid', pk: true }),
1323
+ OwnerName: col({ type: 'string', length: 50, nullable: true }),
1324
+ IdOwner: col({ type: 'uuid', nullable: true }),
1325
+ Name: col({ type: 'string', length: 100 }),
1326
+ Title: col({ type: 'string', length: 255, nullable: true }),
1327
+ Description: col({ type: 'text', nullable: true }),
1328
+ OriginalFilenames: col({ type: 'bool' }),
1329
+ MaxUploadFileSize: col({ type: 'int', nullable: true }),
1330
+ ThumbnailImageSize: col({ type: 'string', length: 20 }),
1331
+ DefaultImageSize: col({ type: 'string', length: 20 }),
1332
+ SeqFilenameFormat: col({ type: 'string', length: 50, nullable: true }),
1333
+ TemplateId: col({ type: 'uuid', nullable: true }),
1334
+ SiteId: col({ type: 'uuid' }),
1335
+ },
1336
+ indexes: [
1337
+ ix({ columns: ['SiteId'] }),
1338
+ ],
1339
+ fks: [
1340
+ fk({ columns: ['TemplateId'], ref: 'GalleryImagesTemplates', refColumns: ['TemplateId'] }),
1341
+ ],
1342
+ },
1343
+ {
1344
+ name: 'GalleryImage',
1345
+ scope: 'site',
1346
+ siteIdAdded: true,
1347
+ columns: {
1348
+ IdImage: col({ type: 'uuid', pk: true }),
1349
+ IdGallery: col({ type: 'uuid' }),
1350
+ Seq: col({ type: 'int' }),
1351
+ Title: col({ type: 'string', length: 255, nullable: true }),
1352
+ Alt: col({ type: 'string', length: 255, nullable: true }),
1353
+ Description: col({ type: 'text', nullable: true }),
1354
+ Visible: col({ type: 'bool' }),
1355
+ OriginalFilename: col({ type: 'string', length: 255 }),
1356
+ Author: col({ type: 'string', length: 100, nullable: true }),
1357
+ Copyright: col({ type: 'string', length: 100, nullable: true }),
1358
+ StorageClient: col({ type: 'string', length: 255 }),
1359
+ StorageFilename: col({ type: 'string', length: 255 }),
1360
+ MimeType: col({ type: 'string', length: 50 }),
1361
+ Width: col({ type: 'int' }),
1362
+ Height: col({ type: 'int' }),
1363
+ FileSize: col({ type: 'int' }),
1364
+ DateCreated: col({ type: 'datetime' }),
1365
+ UtcDateCreated: col({ type: 'datetime' }),
1366
+ CreatedById: col({ type: 'uuid' }),
1367
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1368
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1369
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1370
+ Content: col({ type: 'text', nullable: true }),
1371
+ Hash: col({ type: 'string', length: 50, nullable: true }),
1372
+ SiteId: col({ type: 'uuid' }),
1373
+ },
1374
+ indexes: [
1375
+ ix({ columns: ['SiteId'] }),
1376
+ ],
1377
+ fks: [
1378
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1379
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1380
+ fk({ columns: ['IdGallery'], ref: 'Gallery', refColumns: ['IdGallery'] }),
1381
+ ],
1382
+ },
1383
+ {
1384
+ name: 'GalleryImageFile',
1385
+ scope: 'site',
1386
+ siteIdAdded: true,
1387
+ columns: {
1388
+ IdImage: col({ type: 'uuid', pk: true }),
1389
+ SizeLabel: col({ type: 'string', length: 20, pk: true }),
1390
+ StorageClient: col({ type: 'string', length: 255 }),
1391
+ StorageFilename: col({ type: 'string', length: 255 }),
1392
+ StaticLink: col({ type: 'string', length: 255, nullable: true }),
1393
+ UseStaticLink: col({ type: 'bool' }),
1394
+ MimeType: col({ type: 'string', length: 50 }),
1395
+ Width: col({ type: 'int', nullable: true }),
1396
+ Height: col({ type: 'int', nullable: true }),
1397
+ FileSize: col({ type: 'int', nullable: true }),
1398
+ Original: col({ type: 'bool' }),
1399
+ SiteId: col({ type: 'uuid' }),
1400
+ },
1401
+ indexes: [
1402
+ ix({ columns: ['SiteId'] }),
1403
+ ],
1404
+ fks: [
1405
+ fk({ columns: ['IdImage'], ref: 'GalleryImage', refColumns: ['IdImage'] }),
1406
+ ],
1407
+ },
1408
+ {
1409
+ name: 'GalleryImageSize',
1410
+ scope: 'site',
1411
+ siteIdAdded: true,
1412
+ columns: {
1413
+ IdSize: col({ type: 'uuid', pk: true }),
1414
+ IdGallery: col({ type: 'uuid' }),
1415
+ Label: col({ type: 'string', length: 20 }),
1416
+ MaxWidth: col({ type: 'int' }),
1417
+ MaxHeight: col({ type: 'int' }),
1418
+ Quality: col({ type: 'int' }),
1419
+ SiteId: col({ type: 'uuid' }),
1420
+ },
1421
+ indexes: [
1422
+ ix({ columns: ['SiteId'] }),
1423
+ ],
1424
+ fks: [
1425
+ fk({ columns: ['IdGallery'], ref: 'Gallery', refColumns: ['IdGallery'] }),
1426
+ ],
1427
+ },
1428
+ {
1429
+ name: 'GalleryImageSizeWatermark',
1430
+ scope: 'site',
1431
+ siteIdAdded: true,
1432
+ columns: {
1433
+ GalleryImageSize_IdSize: col({ type: 'uuid', pk: true }),
1434
+ Watermark_IdWatermark: col({ type: 'uuid', pk: true }),
1435
+ SiteId: col({ type: 'uuid' }),
1436
+ },
1437
+ indexes: [
1438
+ ix({ columns: ['SiteId'] }),
1439
+ ],
1440
+ },
1441
+ {
1442
+ name: 'GalleryImagesTemplates',
1443
+ scope: 'site',
1444
+ siteIdAdded: true,
1445
+ columns: {
1446
+ TemplateId: col({ type: 'uuid', pk: true }),
1447
+ Content: col({ type: 'text', nullable: true }),
1448
+ Layouts: col({ type: 'text', nullable: true }),
1449
+ OwnerTemplateId: col({ type: 'uuid' }),
1450
+ TemplateName: col({ type: 'string', length: 100 }),
1451
+ FieldName: col({ type: 'string', length: 100 }),
1452
+ DateCreated: col({ type: 'datetime' }),
1453
+ UtcDateCreated: col({ type: 'datetime' }),
1454
+ CreatedById: col({ type: 'uuid' }),
1455
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1456
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1457
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1458
+ Alias: col({ type: 'string', length: 100, nullable: true }),
1459
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
1460
+ SiteId: col({ type: 'uuid' }),
1461
+ },
1462
+ indexes: [
1463
+ ix({ columns: ['SiteId'] }),
1464
+ ],
1465
+ fks: [
1466
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1467
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1468
+ ],
1469
+ },
1470
+ {
1471
+ name: 'InventoryPolicies',
1472
+ scope: 'dictionary',
1473
+ columns: {
1474
+ InventoryPolicyId: col({ type: 'int', pk: true }),
1475
+ Name: col({ type: 'string', length: 100 }),
1476
+ EnumLabel: col({ type: 'string', length: 30, nullable: true }),
1477
+ },
1478
+ },
1479
+ {
1480
+ name: 'Layouts',
1481
+ scope: 'site',
1482
+ siteIdAdded: true,
1483
+ columns: {
1484
+ LayoutId: col({ type: 'uuid', pk: true }),
1485
+ ThemeId: col({ type: 'uuid' }),
1486
+ Name: col({ type: 'string', length: 100, nullable: true }),
1487
+ LoweredName: col({ type: 'string', length: 100, nullable: true }),
1488
+ Content: col({ type: 'text', nullable: true }),
1489
+ ViewEngineId: col({ type: 'int' }),
1490
+ UtcDateCreated: col({ type: 'datetime' }),
1491
+ DateCreated: col({ type: 'datetime' }),
1492
+ CreatedById: col({ type: 'uuid' }),
1493
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1494
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1495
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1496
+ ContentType: col({ type: 'string', length: 50, nullable: true }),
1497
+ Encoding: col({ type: 'string', length: 50, nullable: true }),
1498
+ Hash: col({ type: 'string', length: 50, nullable: true }),
1499
+ SiteId: col({ type: 'uuid' }),
1500
+ },
1501
+ indexes: [
1502
+ ix({ columns: ['SiteId'] }),
1503
+ ],
1504
+ fks: [
1505
+ fk({ columns: ['ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
1506
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1507
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1508
+ ],
1509
+ },
1510
+ {
1511
+ name: 'LinkGroups',
1512
+ scope: 'site',
1513
+ columns: {
1514
+ GroupId: col({ type: 'uuid', pk: true }),
1515
+ Title: col({ type: 'string', length: 100 }),
1516
+ Slug: col({ type: 'string', length: 100 }),
1517
+ SiteId: col({ type: 'uuid' }),
1518
+ TemplateId: col({ type: 'uuid' }),
1519
+ DateCreated: col({ type: 'datetime' }),
1520
+ UtcDateCreated: col({ type: 'datetime' }),
1521
+ CreatedById: col({ type: 'uuid' }),
1522
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1523
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1524
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1525
+ },
1526
+ indexes: [
1527
+ ix({ columns: ['SiteId'] }),
1528
+ ],
1529
+ fks: [
1530
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1531
+ fk({ columns: ['TemplateId'], ref: 'LinkTemplates', refColumns: ['TemplateId'] }),
1532
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1533
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1534
+ ],
1535
+ },
1536
+ {
1537
+ name: 'LinkTemplates',
1538
+ scope: 'site',
1539
+ columns: {
1540
+ TemplateId: col({ type: 'uuid', pk: true }),
1541
+ Name: col({ type: 'string', length: 100 }),
1542
+ Description: col({ type: 'string', length: 1000, nullable: true }),
1543
+ Content: col({ type: 'text', nullable: true }),
1544
+ Layouts: col({ type: 'text', nullable: true }),
1545
+ SiteId: col({ type: 'uuid' }),
1546
+ DateCreated: col({ type: 'datetime' }),
1547
+ UtcDateCreated: col({ type: 'datetime' }),
1548
+ CreatedById: col({ type: 'uuid' }),
1549
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1550
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1551
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1552
+ Alias: col({ type: 'string', length: 100, nullable: true }),
1553
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
1554
+ },
1555
+ indexes: [
1556
+ ix({ columns: ['SiteId'] }),
1557
+ ],
1558
+ fks: [
1559
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1560
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1561
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1562
+ ],
1563
+ },
1564
+ {
1565
+ name: 'Links',
1566
+ scope: 'site',
1567
+ siteIdAdded: true,
1568
+ columns: {
1569
+ LinkId: col({ type: 'uuid', pk: true }),
1570
+ Title: col({ type: 'string', length: 100 }),
1571
+ Slug: col({ type: 'string', length: 100 }),
1572
+ Url: col({ type: 'string', length: 1000 }),
1573
+ GroupId: col({ type: 'uuid' }),
1574
+ Content: col({ type: 'text', nullable: true }),
1575
+ DateCreated: col({ type: 'datetime' }),
1576
+ UtcDateCreated: col({ type: 'datetime' }),
1577
+ CreatedById: col({ type: 'uuid' }),
1578
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1579
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1580
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1581
+ SiteId: col({ type: 'uuid' }),
1582
+ },
1583
+ indexes: [
1584
+ ix({ columns: ['SiteId'] }),
1585
+ ],
1586
+ fks: [
1587
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1588
+ fk({ columns: ['GroupId'], ref: 'LinkGroups', refColumns: ['GroupId'] }),
1589
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1590
+ ],
1591
+ },
1592
+ {
1593
+ name: 'ModuleProperties',
1594
+ scope: 'site',
1595
+ siteIdAdded: true,
1596
+ columns: {
1597
+ PropertyId: col({ type: 'uuid', pk: true }),
1598
+ ModuleId: col({ type: 'uuid' }),
1599
+ PropertyKey: col({ type: 'string', length: 100 }),
1600
+ PropertyValue: col({ type: 'text', nullable: true }),
1601
+ SiteId: col({ type: 'uuid' }),
1602
+ },
1603
+ indexes: [
1604
+ ix({ columns: ['SiteId'] }),
1605
+ ],
1606
+ fks: [
1607
+ fk({ columns: ['ModuleId'], ref: '_Modules', refColumns: ['ModuleId'] }),
1608
+ ],
1609
+ },
1610
+ {
1611
+ name: 'Modules',
1612
+ scope: 'site',
1613
+ siteIdAdded: true,
1614
+ columns: {
1615
+ ModuleId: col({ type: 'uuid', pk: true }),
1616
+ TemplateId: col({ type: 'uuid', nullable: true }),
1617
+ PostId: col({ type: 'uuid', nullable: true }),
1618
+ Index: col({ type: 'int' }),
1619
+ Content: col({ type: 'text', nullable: true }),
1620
+ VisibleInList: col({ type: 'bool' }),
1621
+ VisibleInDetails: col({ type: 'bool' }),
1622
+ VisibleInFeed: col({ type: 'bool' }),
1623
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
1624
+ PageId: col({ type: 'uuid', nullable: true }),
1625
+ Page_TemplateId: col({ type: 'uuid', nullable: true }),
1626
+ SiteId: col({ type: 'uuid' }),
1627
+ },
1628
+ indexes: [
1629
+ ix({ columns: ['SiteId'] }),
1630
+ ],
1631
+ fks: [
1632
+ fk({ columns: ['PostId'], ref: 'Posts', refColumns: ['PostId'] }),
1633
+ fk({ columns: ['ModuleId'], ref: 'Modules', refColumns: ['ModuleId'] }),
1634
+ fk({ columns: ['PageId'], ref: 'Pages', refColumns: ['PageId'] }),
1635
+ ],
1636
+ },
1637
+ {
1638
+ name: 'NumberingCounters',
1639
+ scope: 'site',
1640
+ siteIdAdded: true,
1641
+ columns: {
1642
+ CounterId: col({ type: 'uuid', pk: true }),
1643
+ TaskId: col({ type: 'uuid' }),
1644
+ OwnerId: col({ type: 'uuid' }),
1645
+ Date: col({ type: 'datetime' }),
1646
+ LastNumber: col({ type: 'int' }),
1647
+ SiteId: col({ type: 'uuid' }),
1648
+ },
1649
+ indexes: [
1650
+ ix({ columns: ['SiteId'] }),
1651
+ ],
1652
+ fks: [
1653
+ // SOFT since NumberingTasks became a dictionary (task:3876). A bundle carries the
1654
+ // site tables and the control slice — never a dictionary (plan:50 Q4,
1655
+ // packages/transfer/control.js) — so a movable table may only keep a hard edge
1656
+ // to what actually travels. Same shape as `ProductVariants.InventoryPolicies`:
1657
+ // the cutover provisions the 4 task rows in the target cell and the transfer
1658
+ // reports them as a provisioning requirement instead of landing a dangling
1659
+ // reference nobody audits.
1660
+ fk({ columns: ['TaskId'], ref: 'NumberingTasks', refColumns: ['TaskId'], soft: true }),
1661
+ ],
1662
+ },
1663
+ {
1664
+ name: 'NumberingTasks',
1665
+ // A DICTIONARY, not site data (task:3876, operator verdict after the Q1 grilling):
1666
+ // the live table never carried SiteId, the engine addresses a numbering task by the
1667
+ // GUID its callers hold (`numberingProvider.getNextNumber(taskId)`, forms-core's
1668
+ // DEFAULT_FORM_NUMBERING_TYPE_ID), and `NumberingCounters.TaskId` points at it.
1669
+ // Per-site copies would have required a fresh id per site plus a rewrite of every
1670
+ // counter and every config that stores an id — for a table whose 4 rows are
1671
+ // identical across the whole database.
1672
+ scope: 'dictionary',
1673
+ columns: {
1674
+ TaskId: col({ type: 'uuid', pk: true }),
1675
+ Label: col({ type: 'string', length: 255 }),
1676
+ Name: col({ type: 'string', length: 255 }),
1677
+ Commentary: col({ type: 'string', length: 4000, nullable: true }),
1678
+ PeriodTypeId: col({ type: 'int' }),
1679
+ MinNumber: col({ type: 'int' }),
1680
+ MaxNumber: col({ type: 'int' }),
1681
+ },
1682
+ },
1683
+ {
1684
+ name: 'PageModuleTemplates',
1685
+ scope: 'site',
1686
+ columns: {
1687
+ TemplateId: col({ type: 'uuid', pk: true }),
1688
+ SiteId: col({ type: 'uuid' }),
1689
+ Name: col({ type: 'string', length: 100 }),
1690
+ Alias: col({ type: 'string', length: 100 }),
1691
+ Description: col({ type: 'text', nullable: true }),
1692
+ Content: col({ type: 'text', nullable: true }),
1693
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
1694
+ Layouts: col({ type: 'text', nullable: true }),
1695
+ DateCreated: col({ type: 'datetime' }),
1696
+ UtcDateCreated: col({ type: 'datetime' }),
1697
+ CreatedById: col({ type: 'uuid' }),
1698
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1699
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1700
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1701
+ },
1702
+ indexes: [
1703
+ ix({ columns: ['SiteId'] }),
1704
+ ],
1705
+ fks: [
1706
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1707
+ ],
1708
+ },
1709
+ {
1710
+ name: 'PagePartTemplates',
1711
+ scope: 'site',
1712
+ columns: {
1713
+ TemplateId: col({ type: 'uuid', pk: true }),
1714
+ SiteId: col({ type: 'uuid' }),
1715
+ Name: col({ type: 'string', length: 100 }),
1716
+ Alias: col({ type: 'string', length: 100 }),
1717
+ Description: col({ type: 'text', nullable: true }),
1718
+ Content: col({ type: 'text', nullable: true }),
1719
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
1720
+ Layouts: col({ type: 'text', nullable: true }),
1721
+ DateCreated: col({ type: 'datetime' }),
1722
+ UtcDateCreated: col({ type: 'datetime' }),
1723
+ CreatedById: col({ type: 'uuid' }),
1724
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1725
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1726
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1727
+ },
1728
+ indexes: [
1729
+ ix({ columns: ['SiteId'] }),
1730
+ ],
1731
+ fks: [
1732
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1733
+ ],
1734
+ },
1735
+ {
1736
+ name: 'PageTemplates',
1737
+ scope: 'site',
1738
+ columns: {
1739
+ TemplateId: col({ type: 'uuid', pk: true }),
1740
+ SiteId: col({ type: 'uuid' }),
1741
+ Name: col({ type: 'string', length: 100 }),
1742
+ Alias: col({ type: 'string', length: 100 }),
1743
+ Description: col({ type: 'text', nullable: true }),
1744
+ Content: col({ type: 'text', nullable: true }),
1745
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
1746
+ Layouts: col({ type: 'text', nullable: true }),
1747
+ DateCreated: col({ type: 'datetime' }),
1748
+ UtcDateCreated: col({ type: 'datetime' }),
1749
+ CreatedById: col({ type: 'uuid' }),
1750
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1751
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1752
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1753
+ },
1754
+ indexes: [
1755
+ ix({ columns: ['SiteId'] }),
1756
+ ],
1757
+ fks: [
1758
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1759
+ ],
1760
+ },
1761
+ {
1762
+ name: 'Pages',
1763
+ scope: 'site',
1764
+ columns: {
1765
+ PageId: col({ type: 'uuid', pk: true }),
1766
+ SiteId: col({ type: 'uuid' }),
1767
+ Path: col({ type: 'string', length: 256 }),
1768
+ Title: col({ type: 'string', length: 256 }),
1769
+ Content: col({ type: 'text', nullable: true }),
1770
+ TemplateId: col({ type: 'uuid' }),
1771
+ Published: col({ type: 'bool' }),
1772
+ DatePublished: col({ type: 'datetime', nullable: true }),
1773
+ UtcDatePublished: col({ type: 'datetime', nullable: true }),
1774
+ IncludeInSitemap: col({ type: 'bool' }),
1775
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
1776
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
1777
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
1778
+ FormId: col({ type: 'uuid', nullable: true }),
1779
+ ViewsCount: col({ type: 'int' }),
1780
+ DateCreated: col({ type: 'datetime' }),
1781
+ UtcDateCreated: col({ type: 'datetime' }),
1782
+ CreatedById: col({ type: 'uuid' }),
1783
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1784
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1785
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1786
+ },
1787
+ indexes: [
1788
+ ix({ columns: ['SiteId'] }),
1789
+ ],
1790
+ fks: [
1791
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
1792
+ fk({ columns: ['FormId'], ref: 'Forms', refColumns: ['FormId'] }),
1793
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1794
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1795
+ ],
1796
+ },
1797
+ {
1798
+ name: 'PostComments',
1799
+ scope: 'site',
1800
+ siteIdAdded: true,
1801
+ columns: {
1802
+ CommentId: col({ type: 'uuid', pk: true }),
1803
+ PostId: col({ type: 'uuid' }),
1804
+ DateCreated: col({ type: 'datetime' }),
1805
+ UtcDateCreated: col({ type: 'datetime' }),
1806
+ AuthorName: col({ type: 'string', length: 256 }),
1807
+ AuthorEmail: col({ type: 'string', length: 256 }),
1808
+ Title: col({ type: 'string', length: 256, nullable: true }),
1809
+ Content: col({ type: 'text' }),
1810
+ ContentType: col({ type: 'int', nullable: true }),
1811
+ Published: col({ type: 'bool' }),
1812
+ IsSpam: col({ type: 'bool' }),
1813
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
1814
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
1815
+ AuthorUrl: col({ type: 'string', length: 256, nullable: true }),
1816
+ ReplyOnCommentId: col({ type: 'uuid', nullable: true }),
1817
+ Level: col({ type: 'int' }),
1818
+ SiteId: col({ type: 'uuid' }),
1819
+ },
1820
+ indexes: [
1821
+ ix({ columns: ['SiteId'] }),
1822
+ ],
1823
+ fks: [
1824
+ fk({ columns: ['ReplyOnCommentId'], ref: 'PostComments', refColumns: ['CommentId'] }),
1825
+ fk({ columns: ['PostId'], ref: 'Posts', refColumns: ['PostId'] }),
1826
+ ],
1827
+ },
1828
+ {
1829
+ name: 'PostModuleTemplates',
1830
+ scope: 'site',
1831
+ siteIdAdded: true,
1832
+ columns: {
1833
+ TemplateId: col({ type: 'uuid', pk: true }),
1834
+ BlogId: col({ type: 'uuid' }),
1835
+ Name: col({ type: 'string', length: 50 }),
1836
+ Description: col({ type: 'text', nullable: true }),
1837
+ DateCreated: col({ type: 'datetime' }),
1838
+ UtcDateCreated: col({ type: 'datetime' }),
1839
+ CreatedById: col({ type: 'uuid' }),
1840
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1841
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1842
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1843
+ Content: col({ type: 'text', nullable: true }),
1844
+ SiteId: col({ type: 'uuid' }),
1845
+ },
1846
+ indexes: [
1847
+ ix({ columns: ['SiteId'] }),
1848
+ ],
1849
+ fks: [
1850
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
1851
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1852
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1853
+ ],
1854
+ },
1855
+ {
1856
+ name: 'PostTemplates',
1857
+ scope: 'site',
1858
+ siteIdAdded: true,
1859
+ columns: {
1860
+ TemplateId: col({ type: 'uuid', pk: true }),
1861
+ BlogId: col({ type: 'uuid' }),
1862
+ Name: col({ type: 'string', length: 50 }),
1863
+ Description: col({ type: 'text', nullable: true }),
1864
+ Modules: col({ type: 'bool' }),
1865
+ DateCreated: col({ type: 'datetime' }),
1866
+ UtcDateCreated: col({ type: 'datetime' }),
1867
+ CreatedById: col({ type: 'uuid' }),
1868
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1869
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1870
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1871
+ Content: col({ type: 'text', nullable: true }),
1872
+ SiteId: col({ type: 'uuid' }),
1873
+ },
1874
+ indexes: [
1875
+ ix({ columns: ['SiteId'] }),
1876
+ ],
1877
+ fks: [
1878
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
1879
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1880
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1881
+ ],
1882
+ },
1883
+ {
1884
+ name: 'Posts',
1885
+ scope: 'site',
1886
+ siteIdAdded: true,
1887
+ columns: {
1888
+ PostId: col({ type: 'uuid', pk: true }),
1889
+ BlogId: col({ type: 'uuid' }),
1890
+ AuthorId: col({ type: 'uuid' }),
1891
+ DateCreated: col({ type: 'datetime' }),
1892
+ UtcDateCreated: col({ type: 'datetime' }),
1893
+ Number: col({ type: 'int' }),
1894
+ Title: col({ type: 'string', length: 256 }),
1895
+ Excerpt: col({ type: 'text', nullable: true }),
1896
+ ExcerptType: col({ type: 'int', nullable: true }),
1897
+ Content: col({ type: 'text', nullable: true }),
1898
+ ContentType: col({ type: 'int', nullable: true }),
1899
+ Alias: col({ type: 'string', length: 256, nullable: true }),
1900
+ Published: col({ type: 'bool' }),
1901
+ DatePublished: col({ type: 'datetime', nullable: true }),
1902
+ UtcDatePublished: col({ type: 'datetime', nullable: true }),
1903
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1904
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1905
+ ViewsCount: col({ type: 'int' }),
1906
+ Rating: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
1907
+ VotesCount: col({ type: 'int' }),
1908
+ CommentsAllowed: col({ type: 'bool' }),
1909
+ CommentsCount: col({ type: 'int' }),
1910
+ ShortUrl: col({ type: 'string', length: 255, nullable: true }),
1911
+ IncludeInSitemap: col({ type: 'bool' }),
1912
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
1913
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
1914
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
1915
+ TemplateId: col({ type: 'uuid', nullable: true }),
1916
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1917
+ CreatedById: col({ type: 'uuid' }),
1918
+ SiteId: col({ type: 'uuid' }),
1919
+ },
1920
+ indexes: [
1921
+ ix({ columns: ['SiteId'] }),
1922
+ ],
1923
+ fks: [
1924
+ // the OWNER first (task:4092): the blog owns the post. An author writes for more
1925
+ // than one site, so `AuthorId` is the weaker parent and must not outrank `BlogId`
1926
+ // (one post on the live copy took its author's site instead of its blog's).
1927
+ fk({ columns: ['BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
1928
+ fk({ columns: ['AuthorId'], ref: 'BlogAuthors', refColumns: ['AuthorId'] }),
1929
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1930
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1931
+ ],
1932
+ },
1933
+ {
1934
+ name: 'ProductPartTemplates',
1935
+ scope: 'site',
1936
+ siteIdAdded: true,
1937
+ columns: {
1938
+ TemplateId: col({ type: 'uuid', pk: true }),
1939
+ StoreId: col({ type: 'uuid' }),
1940
+ Name: col({ type: 'string', length: 100 }),
1941
+ Alias: col({ type: 'string', length: 100 }),
1942
+ Description: col({ type: 'text', nullable: true }),
1943
+ Content: col({ type: 'text', nullable: true }),
1944
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
1945
+ Layouts: col({ type: 'text', nullable: true }),
1946
+ DateCreated: col({ type: 'datetime' }),
1947
+ UtcDateCreated: col({ type: 'datetime' }),
1948
+ CreatedById: col({ type: 'uuid' }),
1949
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1950
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1951
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1952
+ SiteId: col({ type: 'uuid' }),
1953
+ },
1954
+ indexes: [
1955
+ ix({ columns: ['SiteId'] }),
1956
+ ],
1957
+ fks: [
1958
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
1959
+ ],
1960
+ },
1961
+ {
1962
+ name: 'ProductProperties',
1963
+ scope: 'site',
1964
+ siteIdAdded: true,
1965
+ columns: {
1966
+ PropertyId: col({ type: 'uuid', pk: true }),
1967
+ ProductId: col({ type: 'uuid' }),
1968
+ Name: col({ type: 'string', length: 100 }),
1969
+ Value: col({ type: 'text' }),
1970
+ ValueType: col({ type: 'int' }),
1971
+ Description: col({ type: 'text', nullable: true }),
1972
+ DateCreated: col({ type: 'datetime' }),
1973
+ UtcDateCreated: col({ type: 'datetime' }),
1974
+ DateUpdated: col({ type: 'datetime', nullable: true }),
1975
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
1976
+ CreatedById: col({ type: 'uuid' }),
1977
+ UpdatedById: col({ type: 'uuid', nullable: true }),
1978
+ SiteId: col({ type: 'uuid' }),
1979
+ },
1980
+ indexes: [
1981
+ ix({ columns: ['SiteId'] }),
1982
+ ],
1983
+ fks: [
1984
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1985
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
1986
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'] }),
1987
+ ],
1988
+ },
1989
+ {
1990
+ name: 'ProductPropertyValues',
1991
+ scope: 'site',
1992
+ siteIdAdded: true,
1993
+ columns: {
1994
+ ValueId: col({ type: 'uuid', pk: true }),
1995
+ ProductId: col({ type: 'uuid' }),
1996
+ PropertyId: col({ type: 'uuid' }),
1997
+ Value: col({ type: 'text', nullable: true }),
1998
+ Description: col({ type: 'text', nullable: true }),
1999
+ DateCreated: col({ type: 'datetime' }),
2000
+ UtcDateCreated: col({ type: 'datetime' }),
2001
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2002
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2003
+ CreatedById: col({ type: 'uuid' }),
2004
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2005
+ SiteId: col({ type: 'uuid' }),
2006
+ },
2007
+ indexes: [
2008
+ ix({ columns: ['SiteId'] }),
2009
+ ],
2010
+ fks: [
2011
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'] }),
2012
+ fk({ columns: ['PropertyId'], ref: 'ProductTypeProperties', refColumns: ['PropertyId'] }),
2013
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2014
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2015
+ ],
2016
+ },
2017
+ {
2018
+ name: 'ProductReviewRatings',
2019
+ scope: 'site',
2020
+ siteIdAdded: true,
2021
+ columns: {
2022
+ Id: col({ type: 'uuid', pk: true }),
2023
+ ReviewId: col({ type: 'uuid' }),
2024
+ RatingId: col({ type: 'uuid' }),
2025
+ Rating: col({ type: 'decimal', precision: 18, scale: 1 }),
2026
+ SiteId: col({ type: 'uuid' }),
2027
+ },
2028
+ indexes: [
2029
+ ix({ columns: ['SiteId'] }),
2030
+ ],
2031
+ fks: [
2032
+ fk({ columns: ['ReviewId'], ref: 'ProductReviews', refColumns: ['ReviewId'] }),
2033
+ fk({ columns: ['RatingId'], ref: 'ProductTypeRatings', refColumns: ['RatingId'] }),
2034
+ ],
2035
+ },
2036
+ {
2037
+ name: 'ProductReviewVotes',
2038
+ scope: 'site',
2039
+ siteIdAdded: true,
2040
+ columns: {
2041
+ VoteId: col({ type: 'uuid', pk: true }),
2042
+ ReviewId: col({ type: 'uuid' }),
2043
+ Helpful: col({ type: 'bool' }),
2044
+ Timestamp: col({ type: 'datetime' }),
2045
+ UtcTimestamp: col({ type: 'datetime' }),
2046
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
2047
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
2048
+ SiteId: col({ type: 'uuid' }),
2049
+ },
2050
+ indexes: [
2051
+ ix({ columns: ['SiteId'] }),
2052
+ ],
2053
+ fks: [
2054
+ fk({ columns: ['ReviewId'], ref: 'ProductReviews', refColumns: ['ReviewId'] }),
2055
+ // legacy has no DB constraint on either edge; vote rows get pruned independently
2056
+ fk({ columns: ['VoteId'], ref: 'Votes', refColumns: ['VoteId'], soft: true }),
2057
+ ],
2058
+ },
2059
+ {
2060
+ name: 'ProductReviews',
2061
+ scope: 'site',
2062
+ siteIdAdded: true,
2063
+ columns: {
2064
+ ReviewId: col({ type: 'uuid', pk: true }),
2065
+ ProductId: col({ type: 'uuid' }),
2066
+ DateCreated: col({ type: 'datetime' }),
2067
+ UtcDateCreated: col({ type: 'datetime' }),
2068
+ AuthorName: col({ type: 'string', length: 256 }),
2069
+ AuthorEmail: col({ type: 'string', length: 256 }),
2070
+ Public: col({ type: 'bool' }),
2071
+ Rating: col({ type: 'decimal', precision: 18, scale: 1, nullable: true }),
2072
+ Title: col({ type: 'string', length: 256, nullable: true }),
2073
+ Pros: col({ type: 'text' }),
2074
+ Cons: col({ type: 'text' }),
2075
+ Notes: col({ type: 'text' }),
2076
+ HelpfulVotesCount: col({ type: 'int', nullable: true }),
2077
+ NotHelpfulVotesCount: col({ type: 'int', nullable: true }),
2078
+ Published: col({ type: 'bool' }),
2079
+ IsSpam: col({ type: 'bool' }),
2080
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
2081
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
2082
+ SiteId: col({ type: 'uuid' }),
2083
+ },
2084
+ indexes: [
2085
+ ix({ columns: ['SiteId'] }),
2086
+ ],
2087
+ fks: [
2088
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'] }),
2089
+ // legacy has no DB constraint; a review aggregate can outlive its item row
2090
+ fk({ columns: ['ReviewId'], ref: 'Reviews', refColumns: ['ReviewId'], soft: true }),
2091
+ ],
2092
+ },
2093
+ {
2094
+ name: 'ProductStoreCategories',
2095
+ scope: 'site',
2096
+ siteIdAdded: true,
2097
+ columns: {
2098
+ Product_Id: col({ type: 'uuid', pk: true }),
2099
+ ProductCategory_Id: col({ type: 'uuid', pk: true }),
2100
+ SiteId: col({ type: 'uuid' }),
2101
+ },
2102
+ indexes: [
2103
+ ix({ columns: ['SiteId'] }),
2104
+ ],
2105
+ fks: [
2106
+ fk({ columns: ['ProductCategory_Id'], ref: 'StoreCategories', refColumns: ['CategoryId'] }),
2107
+ fk({ columns: ['Product_Id'], ref: 'Products', refColumns: ['ProductId'] }),
2108
+ ],
2109
+ },
2110
+ {
2111
+ name: 'ProductStoreTags',
2112
+ scope: 'site',
2113
+ siteIdAdded: true,
2114
+ columns: {
2115
+ Product_Id: col({ type: 'uuid', pk: true }),
2116
+ ProductTag_Id: col({ type: 'uuid', pk: true }),
2117
+ SiteId: col({ type: 'uuid' }),
2118
+ },
2119
+ indexes: [
2120
+ ix({ columns: ['SiteId'] }),
2121
+ ],
2122
+ fks: [
2123
+ fk({ columns: ['ProductTag_Id'], ref: 'StoreTags', refColumns: ['TagId'] }),
2124
+ fk({ columns: ['Product_Id'], ref: 'Products', refColumns: ['ProductId'] }),
2125
+ ],
2126
+ },
2127
+ {
2128
+ name: 'ProductTypeProperties',
2129
+ scope: 'site',
2130
+ siteIdAdded: true,
2131
+ columns: {
2132
+ PropertyId: col({ type: 'uuid', pk: true }),
2133
+ CategoryId: col({ type: 'uuid' }),
2134
+ Name: col({ type: 'string', length: 100 }),
2135
+ ValueType: col({ type: 'int' }),
2136
+ Description: col({ type: 'text', nullable: true }),
2137
+ Main: col({ type: 'bool' }),
2138
+ DisplayEmpty: col({ type: 'bool' }),
2139
+ Seq: col({ type: 'int' }),
2140
+ DateCreated: col({ type: 'datetime', nullable: true }),
2141
+ UtcDateCreated: col({ type: 'datetime', nullable: true }),
2142
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2143
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2144
+ CreatedById: col({ type: 'uuid', nullable: true }),
2145
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2146
+ SiteId: col({ type: 'uuid' }),
2147
+ },
2148
+ indexes: [
2149
+ ix({ columns: ['SiteId'] }),
2150
+ ],
2151
+ fks: [
2152
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2153
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2154
+ fk({ columns: ['CategoryId'], ref: 'ProductTypePropertyCategories', refColumns: ['CategoryId'] }),
2155
+ ],
2156
+ },
2157
+ {
2158
+ name: 'ProductTypePropertyCategories',
2159
+ scope: 'site',
2160
+ siteIdAdded: true,
2161
+ columns: {
2162
+ CategoryId: col({ type: 'uuid', pk: true }),
2163
+ ProductTypeId: col({ type: 'uuid' }),
2164
+ Name: col({ type: 'string', length: 100 }),
2165
+ Main: col({ type: 'bool' }),
2166
+ DisplayEmpty: col({ type: 'bool' }),
2167
+ Seq: col({ type: 'int' }),
2168
+ DateCreated: col({ type: 'datetime', nullable: true }),
2169
+ UtcDateCreated: col({ type: 'datetime', nullable: true }),
2170
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2171
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2172
+ CreatedById: col({ type: 'uuid', nullable: true }),
2173
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2174
+ SiteId: col({ type: 'uuid' }),
2175
+ },
2176
+ indexes: [
2177
+ ix({ columns: ['SiteId'] }),
2178
+ ],
2179
+ fks: [
2180
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2181
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2182
+ fk({ columns: ['ProductTypeId'], ref: 'ProductTypes', refColumns: ['TypeId'] }),
2183
+ ],
2184
+ },
2185
+ {
2186
+ name: 'ProductTypeRatings',
2187
+ scope: 'site',
2188
+ siteIdAdded: true,
2189
+ columns: {
2190
+ RatingId: col({ type: 'uuid', pk: true }),
2191
+ ProductTypeId: col({ type: 'uuid' }),
2192
+ Name: col({ type: 'string', length: 100 }),
2193
+ Weight: col({ type: 'int', nullable: true }),
2194
+ Main: col({ type: 'bool' }),
2195
+ DisplayEmpty: col({ type: 'bool' }),
2196
+ Seq: col({ type: 'int' }),
2197
+ DateCreated: col({ type: 'datetime', nullable: true }),
2198
+ UtcDateCreated: col({ type: 'datetime', nullable: true }),
2199
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2200
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2201
+ CreatedById: col({ type: 'uuid', nullable: true }),
2202
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2203
+ SiteId: col({ type: 'uuid' }),
2204
+ },
2205
+ indexes: [
2206
+ ix({ columns: ['SiteId'] }),
2207
+ ],
2208
+ fks: [
2209
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2210
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2211
+ fk({ columns: ['ProductTypeId'], ref: 'ProductTypes', refColumns: ['TypeId'] }),
2212
+ ],
2213
+ },
2214
+ {
2215
+ name: 'ProductTypes',
2216
+ scope: 'site',
2217
+ siteIdAdded: true,
2218
+ columns: {
2219
+ TypeId: col({ type: 'uuid', pk: true }),
2220
+ Name: col({ type: 'string', length: 100 }),
2221
+ Description: col({ type: 'text', nullable: true }),
2222
+ StoreId: col({ type: 'uuid' }),
2223
+ TemplateName: col({ type: 'string', length: 100, nullable: true }),
2224
+ DateCreated: col({ type: 'datetime' }),
2225
+ UtcDateCreated: col({ type: 'datetime' }),
2226
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2227
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2228
+ CreatedById: col({ type: 'uuid' }),
2229
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2230
+ IntId: col({ type: 'int' }),
2231
+ YmlExport: col({ type: 'bool' }),
2232
+ ProductPrefix: col({ type: 'string', length: 50, nullable: true }),
2233
+ Content: col({ type: 'text', nullable: true }),
2234
+ Properties: col({ type: 'text', nullable: true }),
2235
+ ListLayout: col({ type: 'string', length: 100, nullable: true }),
2236
+ DetailsLayout: col({ type: 'string', length: 100, nullable: true }),
2237
+ Layouts: col({ type: 'text', nullable: true }),
2238
+ VariantTemplateId: col({ type: 'uuid' }),
2239
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2240
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
2241
+ SiteId: col({ type: 'uuid' }),
2242
+ },
2243
+ indexes: [
2244
+ ix({ columns: ['SiteId'] }),
2245
+ ],
2246
+ fks: [
2247
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2248
+ fk({ columns: ['VariantTemplateId'], ref: 'ProductVariantTemplates', refColumns: ['TemplateId'] }),
2249
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2250
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2251
+ ],
2252
+ },
2253
+ {
2254
+ name: 'ProductVariantTemplates',
2255
+ scope: 'site',
2256
+ siteIdAdded: true,
2257
+ columns: {
2258
+ TemplateId: col({ type: 'uuid', pk: true }),
2259
+ Name: col({ type: 'string', length: 100 }),
2260
+ Description: col({ type: 'string', length: 1000, nullable: true }),
2261
+ Content: col({ type: 'text', nullable: true }),
2262
+ Layouts: col({ type: 'text', nullable: true }),
2263
+ StoreId: col({ type: 'uuid' }),
2264
+ DateCreated: col({ type: 'datetime' }),
2265
+ UtcDateCreated: col({ type: 'datetime' }),
2266
+ CreatedById: col({ type: 'uuid' }),
2267
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2268
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2269
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2270
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2271
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
2272
+ SiteId: col({ type: 'uuid' }),
2273
+ },
2274
+ indexes: [
2275
+ ix({ columns: ['SiteId'] }),
2276
+ ],
2277
+ fks: [
2278
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2279
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2280
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2281
+ ],
2282
+ },
2283
+ {
2284
+ name: 'ProductVariants',
2285
+ scope: 'site',
2286
+ siteIdAdded: true,
2287
+ columns: {
2288
+ VariantId: col({ type: 'uuid', pk: true }),
2289
+ ProductId: col({ type: 'uuid' }),
2290
+ Position: col({ type: 'int' }),
2291
+ Title: col({ type: 'string', length: 255 }),
2292
+ Price: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2293
+ CompareAtPrice: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2294
+ InventoryQuantity: col({ type: 'int', nullable: true }),
2295
+ InventoryPolicyId: col({ type: 'int' }),
2296
+ Sku: col({ type: 'string', length: 50, nullable: true }),
2297
+ Weight: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2298
+ DateCreated: col({ type: 'datetime' }),
2299
+ UtcDateCreated: col({ type: 'datetime' }),
2300
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2301
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2302
+ CreatedById: col({ type: 'uuid' }),
2303
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2304
+ IntId: col({ type: 'int' }),
2305
+ YmlExport: col({ type: 'bool' }),
2306
+ Bid: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2307
+ Cbid: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2308
+ VendorCode: col({ type: 'string', length: 50, nullable: true }),
2309
+ BuyAtStore: col({ type: 'bool' }),
2310
+ SelfDelivery: col({ type: 'bool' }),
2311
+ Delivery: col({ type: 'bool' }),
2312
+ DeliveryPrice: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2313
+ TemplateId: col({ type: 'uuid' }),
2314
+ Content: col({ type: 'text', nullable: true }),
2315
+ SiteId: col({ type: 'uuid' }),
2316
+ },
2317
+ indexes: [
2318
+ ix({ columns: ['SiteId'] }),
2319
+ ],
2320
+ fks: [
2321
+ // A dictionary, not a control dependency: the link is soft so a cut is
2322
+ // not blocked by a constraint — but the dictionary does NOT travel in the
2323
+ // bundle yet and has no seed, so the target must be provisioned by hand
2324
+ // (task:3852, task:3866, plan:50 Q4).
2325
+ // the OWNER first (task:4092): a variant belongs to its product, and the template is
2326
+ // only the weaker parent. With the template declared first, 63 variants on the live
2327
+ // copy took the template's site while their product sat on another one.
2328
+ fk({ columns: ['ProductId'], ref: 'Products', refColumns: ['ProductId'] }),
2329
+ fk({ columns: ['InventoryPolicyId'], ref: 'InventoryPolicies', refColumns: ['InventoryPolicyId'], soft: true }),
2330
+ fk({ columns: ['TemplateId'], ref: 'ProductVariantTemplates', refColumns: ['TemplateId'] }),
2331
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2332
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2333
+ ],
2334
+ },
2335
+ {
2336
+ name: 'Products',
2337
+ scope: 'site',
2338
+ siteIdAdded: true,
2339
+ columns: {
2340
+ ProductId: col({ type: 'uuid', pk: true }),
2341
+ Title: col({ type: 'string', length: 256 }),
2342
+ ShortDescription: col({ type: 'text', nullable: true }),
2343
+ ShortDescriptionType: col({ type: 'int', nullable: true }),
2344
+ Description: col({ type: 'text', nullable: true }),
2345
+ DescriptionType: col({ type: 'int', nullable: true }),
2346
+ Kit: col({ type: 'text', nullable: true }),
2347
+ KitType: col({ type: 'int', nullable: true }),
2348
+ Slug: col({ type: 'string', length: 256 }),
2349
+ StoreId: col({ type: 'uuid' }),
2350
+ TypeId: col({ type: 'uuid' }),
2351
+ VendorId: col({ type: 'uuid', nullable: true }),
2352
+ Published: col({ type: 'bool' }),
2353
+ Rating: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2354
+ VotesCount: col({ type: 'int', nullable: true }),
2355
+ DateCreated: col({ type: 'datetime' }),
2356
+ UtcDateCreated: col({ type: 'datetime' }),
2357
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2358
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2359
+ CreatedById: col({ type: 'uuid' }),
2360
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2361
+ TemplateName: col({ type: 'string', length: 100, nullable: true }),
2362
+ IncludeInSitemap: col({ type: 'bool' }),
2363
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2364
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
2365
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
2366
+ CountryOfOrigin: col({ type: 'string', length: 50, nullable: true }),
2367
+ Content: col({ type: 'text', nullable: true }),
2368
+ Number: col({ type: 'int' }),
2369
+ SiteId: col({ type: 'uuid' }),
2370
+ },
2371
+ indexes: [
2372
+ ix({ columns: ['SiteId'] }),
2373
+ ],
2374
+ fks: [
2375
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2376
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2377
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2378
+ fk({ columns: ['VendorId'], ref: 'StoreVendors', refColumns: ['VendorId'] }),
2379
+ fk({ columns: ['TypeId'], ref: 'ProductTypes', refColumns: ['TypeId'] }),
2380
+ ],
2381
+ },
2382
+ {
2383
+ name: 'Redirections',
2384
+ scope: 'site',
2385
+ columns: {
2386
+ RedirectionId: col({ type: 'uuid', pk: true }),
2387
+ Title: col({ type: 'string', length: 100 }),
2388
+ Seq: col({ type: 'int' }),
2389
+ UrlDetection: col({ type: 'bool' }),
2390
+ TargetUrl: col({ type: 'string', length: 256, nullable: true }),
2391
+ SourceType: col({ type: 'int' }),
2392
+ Regex: col({ type: 'bool' }),
2393
+ IgnoreCase: col({ type: 'bool' }),
2394
+ Action: col({ type: 'int' }),
2395
+ DestinationUrl: col({ type: 'string', length: 256, nullable: true }),
2396
+ Permanent: col({ type: 'bool' }),
2397
+ ThemeId: col({ type: 'uuid', nullable: true }),
2398
+ SiteId: col({ type: 'uuid' }),
2399
+ DateCreated: col({ type: 'datetime' }),
2400
+ UtcDateCreated: col({ type: 'datetime' }),
2401
+ CreatedById: col({ type: 'uuid' }),
2402
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2403
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2404
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2405
+ BrowserDetection: col({ type: 'bool' }),
2406
+ BrowserName: col({ type: 'string', length: 100, nullable: true }),
2407
+ BrowserVersion: col({ type: 'string', length: 50, nullable: true }),
2408
+ BrowserMajorVersion: col({ type: 'int', nullable: true }),
2409
+ BrowserMinorVersion: col({ type: 'decimal', precision: 18, scale: 6, nullable: true }),
2410
+ BrowserType: col({ type: 'string', length: 100, nullable: true }),
2411
+ BrowserLayoutEngine: col({ type: 'string', length: 100, nullable: true }),
2412
+ BrowserPlatform: col({ type: 'string', length: 100, nullable: true }),
2413
+ BrowserScreenPixelsWidth: col({ type: 'int', nullable: true }),
2414
+ BrowserScreenPixelsHeight: col({ type: 'int', nullable: true }),
2415
+ MobileDeviceDetection: col({ type: 'bool' }),
2416
+ IsMobileDevice: col({ type: 'bool' }),
2417
+ MobileDeviceModel: col({ type: 'string', length: 100, nullable: true }),
2418
+ MobileDeviceManufacturer: col({ type: 'string', length: 100, nullable: true }),
2419
+ DeviceTypeDetection: col({ type: 'bool' }),
2420
+ DeviceIsDesktop: col({ type: 'bool' }),
2421
+ DeviceIsTablet: col({ type: 'bool' }),
2422
+ DeviceIsConsole: col({ type: 'bool' }),
2423
+ DeviceIsTV: col({ type: 'bool' }),
2424
+ DeviceIsMobile: col({ type: 'bool' }),
2425
+ DeviceIsCrawler: col({ type: 'bool' }),
2426
+ QueryStringParamName: col({ type: 'string', length: 50, nullable: true }),
2427
+ CookieName: col({ type: 'string', length: 50, nullable: true }),
2428
+ CookieExpires: col({ type: 'int', nullable: true }),
2429
+ IgnoreOptions: col({ type: 'bool' }),
2430
+ },
2431
+ indexes: [
2432
+ ix({ columns: ['SiteId'] }),
2433
+ ],
2434
+ fks: [
2435
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
2436
+ fk({ columns: ['ThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
2437
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2438
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2439
+ ],
2440
+ },
2441
+ {
2442
+ name: 'RelatedPosts',
2443
+ scope: 'site',
2444
+ siteIdAdded: true,
2445
+ columns: {
2446
+ PostId: col({ type: 'uuid', pk: true }),
2447
+ RelatedPostId: col({ type: 'uuid', pk: true }),
2448
+ SiteId: col({ type: 'uuid' }),
2449
+ },
2450
+ indexes: [
2451
+ ix({ columns: ['SiteId'] }),
2452
+ ],
2453
+ fks: [
2454
+ fk({ columns: ['PostId'], ref: 'Posts', refColumns: ['PostId'] }),
2455
+ fk({ columns: ['RelatedPostId'], ref: 'Posts', refColumns: ['PostId'] }),
2456
+ ],
2457
+ },
2458
+ {
2459
+ name: 'ReviewItemTemplates',
2460
+ scope: 'site',
2461
+ columns: {
2462
+ ItemTemplateId: col({ type: 'uuid', pk: true }),
2463
+ ReviewTemplateId: col({ type: 'uuid' }),
2464
+ SiteId: col({ type: 'uuid' }),
2465
+ Type: col({ type: 'string', length: 256 }),
2466
+ Path: col({ type: 'string', length: 256 }),
2467
+ SubmissionAction: col({ type: 'int' }),
2468
+ RedirectUrl: col({ type: 'string', length: 256, nullable: true }),
2469
+ SuccessMessage: col({ type: 'string', length: 256, nullable: true }),
2470
+ EmailRecipients: col({ type: 'string', length: 2000, nullable: true }),
2471
+ DateCreated: col({ type: 'datetime' }),
2472
+ UtcDateCreated: col({ type: 'datetime' }),
2473
+ CreatedById: col({ type: 'uuid' }),
2474
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2475
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2476
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2477
+ },
2478
+ indexes: [
2479
+ ix({ columns: ['SiteId'] }),
2480
+ ],
2481
+ fks: [
2482
+ fk({ columns: ['ReviewTemplateId'], ref: 'ReviewTemplates', refColumns: ['TemplateId'] }),
2483
+ ],
2484
+ },
2485
+ {
2486
+ name: 'ReviewRatingTemplates',
2487
+ scope: 'site',
2488
+ siteIdAdded: true,
2489
+ columns: {
2490
+ TemplateId: col({ type: 'uuid', pk: true }),
2491
+ ReviewTemplateId: col({ type: 'uuid' }),
2492
+ Name: col({ type: 'string', length: 100 }),
2493
+ Weight: col({ type: 'int', nullable: true }),
2494
+ Seq: col({ type: 'int' }),
2495
+ SiteId: col({ type: 'uuid' }),
2496
+ },
2497
+ indexes: [
2498
+ ix({ columns: ['SiteId'] }),
2499
+ ],
2500
+ fks: [
2501
+ fk({ columns: ['ReviewTemplateId'], ref: 'ReviewTemplates', refColumns: ['TemplateId'] }),
2502
+ ],
2503
+ },
2504
+ {
2505
+ name: 'ReviewRatings',
2506
+ scope: 'site',
2507
+ siteIdAdded: true,
2508
+ columns: {
2509
+ RatingId: col({ type: 'uuid', pk: true }),
2510
+ ReviewId: col({ type: 'uuid' }),
2511
+ RatingTemplateId: col({ type: 'uuid' }),
2512
+ Value: col({ type: 'decimal', precision: 18, scale: 2 }),
2513
+ SiteId: col({ type: 'uuid' }),
2514
+ },
2515
+ indexes: [
2516
+ ix({ columns: ['SiteId'] }),
2517
+ ],
2518
+ fks: [
2519
+ fk({ columns: ['RatingTemplateId'], ref: 'ReviewRatingTemplates', refColumns: ['TemplateId'] }),
2520
+ fk({ columns: ['ReviewId'], ref: 'Reviews', refColumns: ['ReviewId'] }),
2521
+ ],
2522
+ },
2523
+ {
2524
+ name: 'ReviewTemplates',
2525
+ scope: 'site',
2526
+ columns: {
2527
+ TemplateId: col({ type: 'uuid', pk: true }),
2528
+ SiteId: col({ type: 'uuid' }),
2529
+ Name: col({ type: 'string', length: 100 }),
2530
+ Alias: col({ type: 'string', length: 100 }),
2531
+ Description: col({ type: 'text', nullable: true }),
2532
+ Content: col({ type: 'text', nullable: true }),
2533
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
2534
+ Layouts: col({ type: 'text', nullable: true }),
2535
+ DateCreated: col({ type: 'datetime' }),
2536
+ UtcDateCreated: col({ type: 'datetime' }),
2537
+ CreatedById: col({ type: 'uuid' }),
2538
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2539
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2540
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2541
+ },
2542
+ indexes: [
2543
+ ix({ columns: ['SiteId'] }),
2544
+ ],
2545
+ },
2546
+ {
2547
+ name: 'ReviewVotes',
2548
+ scope: 'site',
2549
+ siteIdAdded: true,
2550
+ columns: {
2551
+ VoteId: col({ type: 'uuid', pk: true }),
2552
+ ReviewId: col({ type: 'uuid' }),
2553
+ Helpful: col({ type: 'bool' }),
2554
+ Timestamp: col({ type: 'datetime' }),
2555
+ UtcTimestamp: col({ type: 'datetime' }),
2556
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
2557
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
2558
+ Referer: col({ type: 'string', length: 2000, nullable: true }),
2559
+ SiteId: col({ type: 'uuid' }),
2560
+ },
2561
+ indexes: [
2562
+ ix({ columns: ['SiteId'] }),
2563
+ ],
2564
+ fks: [
2565
+ fk({ columns: ['ReviewId'], ref: 'Reviews', refColumns: ['ReviewId'] }),
2566
+ fk({ columns: ['VoteId'], ref: 'Votes', refColumns: ['VoteId'] }),
2567
+ ],
2568
+ },
2569
+ {
2570
+ name: 'Reviews',
2571
+ scope: 'site',
2572
+ columns: {
2573
+ ReviewId: col({ type: 'uuid', pk: true }),
2574
+ SiteId: col({ type: 'uuid' }),
2575
+ ItemType: col({ type: 'string', length: 50 }),
2576
+ ItemId: col({ type: 'uuid' }),
2577
+ TemplateId: col({ type: 'uuid' }),
2578
+ ReviewerName: col({ type: 'string', length: 256, nullable: true }),
2579
+ ReviewerEmail: col({ type: 'string', length: 256, nullable: true }),
2580
+ Public: col({ type: 'bool' }),
2581
+ Rating: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2582
+ Summary: col({ type: 'string', length: 256, nullable: true }),
2583
+ Details: col({ type: 'text', nullable: true }),
2584
+ Pros: col({ type: 'text', nullable: true }),
2585
+ Cons: col({ type: 'text', nullable: true }),
2586
+ Fields: col({ type: 'text', nullable: true }),
2587
+ HelpfulVotesCount: col({ type: 'int', nullable: true }),
2588
+ NotHelpfulVotesCount: col({ type: 'int', nullable: true }),
2589
+ Published: col({ type: 'bool' }),
2590
+ DatePublished: col({ type: 'datetime', nullable: true }),
2591
+ UtcDatePublished: col({ type: 'datetime', nullable: true }),
2592
+ IsDublicate: col({ type: 'bool' }),
2593
+ IsSpam: col({ type: 'bool' }),
2594
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
2595
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
2596
+ Referer: col({ type: 'string', length: 2000, nullable: true }),
2597
+ DateCreated: col({ type: 'datetime' }),
2598
+ UtcDateCreated: col({ type: 'datetime' }),
2599
+ },
2600
+ indexes: [
2601
+ ix({ columns: ['SiteId'] }),
2602
+ ],
2603
+ fks: [
2604
+ fk({ columns: ['TemplateId'], ref: 'ReviewTemplates', refColumns: ['TemplateId'] }),
2605
+ ],
2606
+ },
2607
+ {
2608
+ name: 'SiteSettings',
2609
+ scope: 'site',
2610
+ columns: {
2611
+ SettingId: col({ type: 'uuid', pk: true }),
2612
+ SiteId: col({ type: 'uuid' }),
2613
+ Key: col({ type: 'string', length: 100 }),
2614
+ Value: col({ type: 'text', nullable: true }),
2615
+ DateCreated: col({ type: 'datetime' }),
2616
+ UtcDateCreated: col({ type: 'datetime' }),
2617
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2618
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2619
+ CreatedById: col({ type: 'uuid' }),
2620
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2621
+ },
2622
+ indexes: [
2623
+ ix({ columns: ['SiteId'] }),
2624
+ ],
2625
+ fks: [
2626
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
2627
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2628
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2629
+ ],
2630
+ },
2631
+ {
2632
+ name: 'Sites',
2633
+ scope: 'registry',
2634
+ columns: {
2635
+ SiteId: col({ type: 'uuid', pk: true }),
2636
+ AccountId: col({ type: 'uuid' }),
2637
+ Title: col({ type: 'string', length: 100, nullable: true }),
2638
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2639
+ LoweredAlias: col({ type: 'string', length: 100, nullable: true }),
2640
+ PrimaryDomain: col({ type: 'string', length: 100, nullable: true }),
2641
+ TimeOffset: col({ type: 'string', length: 100, nullable: true }),
2642
+ Culture: col({ type: 'string', length: 50, nullable: true }),
2643
+ MultiCultural: col({ type: 'bool', default: 'false' }),
2644
+ Cultures: col({ type: 'text', nullable: true }),
2645
+ ActiveThemeId: col({ type: 'uuid', nullable: true }),
2646
+ RobotsTxt: col({ type: 'text', nullable: true }),
2647
+ Live: col({ type: 'bool' }),
2648
+ Production: col({ type: 'bool' }),
2649
+ Password: col({ type: 'string', length: 20, nullable: true }),
2650
+ PrefixAction: col({ type: 'int', nullable: true }),
2651
+ PagerSlug: col({ type: 'string', length: 50, nullable: true }),
2652
+ SettingsData: col({ type: 'text', nullable: true }),
2653
+ SettingsTemplate: col({ type: 'text', nullable: true }),
2654
+ DomainSettingsTemplate: col({ type: 'text', nullable: true }),
2655
+ DateCreated: col({ type: 'datetime', default: 'now' }),
2656
+ UtcDateCreated: col({ type: 'datetime', default: 'now' }),
2657
+ CreatedById: col({ type: 'uuid' }),
2658
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2659
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2660
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2661
+ SearchAnalyzer: col({ type: 'string', length: 50, nullable: true }),
2662
+ SearchIndexCreationTimestamp: col({ type: 'datetime', nullable: true }),
2663
+ DefaultContentType: col({ type: 'string', length: 50, nullable: true }),
2664
+ DefaultEncoding: col({ type: 'string', length: 50, nullable: true }),
2665
+ DefaultPageName: col({ type: 'string', length: 50, nullable: true }),
2666
+ DefaultExtension: col({ type: 'string', length: 50, nullable: true }),
2667
+ NewTemplates: col({ type: 'bool', default: 'false' }),
2668
+ CachingOptions: col({ type: 'text', nullable: true }),
2669
+ EnableCors: col({ type: 'bool', default: 'false' }),
2670
+ DefaultCorsPolicy: col({ type: 'text', nullable: true }),
2671
+ ContentCacheOptions: col({ type: 'text', nullable: true }),
2672
+ Writable: col({ type: 'bool', default: 'true' }),
2673
+ },
2674
+ fks: [
2675
+ fk({ columns: ['AccountId'], ref: 'Accounts', refColumns: ['AccountId'] }),
2676
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2677
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2678
+ ],
2679
+ },
2680
+ {
2681
+ name: 'StaticPages',
2682
+ scope: 'site',
2683
+ columns: {
2684
+ PageId: col({ type: 'uuid', pk: true }),
2685
+ SiteId: col({ type: 'uuid' }),
2686
+ Path: col({ type: 'string', length: 256 }),
2687
+ Content: col({ type: 'text', nullable: true }),
2688
+ ContentType: col({ type: 'string', length: 50, nullable: true }),
2689
+ Encoding: col({ type: 'string', length: 50, nullable: true }),
2690
+ Published: col({ type: 'bool' }),
2691
+ DatePublished: col({ type: 'datetime', nullable: true }),
2692
+ UtcDatePublished: col({ type: 'datetime', nullable: true }),
2693
+ IncludeInSitemap: col({ type: 'bool' }),
2694
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
2695
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
2696
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2697
+ ViewsCount: col({ type: 'int' }),
2698
+ DateCreated: col({ type: 'datetime' }),
2699
+ UtcDateCreated: col({ type: 'datetime' }),
2700
+ CreatedById: col({ type: 'uuid' }),
2701
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2702
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2703
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2704
+ },
2705
+ indexes: [
2706
+ ix({ columns: ['SiteId'] }),
2707
+ ],
2708
+ fks: [
2709
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
2710
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2711
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2712
+ // legacy has no DB constraint; orphan static pages exist in production data
2713
+ fk({ columns: ['PageId'], ref: 'Pages', refColumns: ['PageId'], soft: true }),
2714
+ ],
2715
+ },
2716
+ {
2717
+ name: 'StoreAdministrators',
2718
+ scope: 'site',
2719
+ siteIdAdded: true,
2720
+ columns: {
2721
+ StoreAdministratorId: col({ type: 'uuid', pk: true }),
2722
+ StoreId: col({ type: 'uuid' }),
2723
+ AdministratorId: col({ type: 'uuid' }),
2724
+ DateCreated: col({ type: 'datetime' }),
2725
+ UtcDateCreated: col({ type: 'datetime' }),
2726
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2727
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2728
+ CreatedById: col({ type: 'uuid' }),
2729
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2730
+ SiteId: col({ type: 'uuid' }),
2731
+ },
2732
+ indexes: [
2733
+ ix({ columns: ['SiteId'] }),
2734
+ ],
2735
+ fks: [
2736
+ fk({ columns: ['AdministratorId'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2737
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2738
+ ],
2739
+ },
2740
+ {
2741
+ name: 'StoreCategories',
2742
+ scope: 'site',
2743
+ siteIdAdded: true,
2744
+ columns: {
2745
+ CategoryId: col({ type: 'uuid', pk: true }),
2746
+ Title: col({ type: 'string', length: 256 }),
2747
+ Description: col({ type: 'text', nullable: true }),
2748
+ DescriptionType: col({ type: 'int', nullable: true }),
2749
+ Slug: col({ type: 'string', length: 256 }),
2750
+ Content: col({ type: 'text', nullable: true }),
2751
+ StoreId: col({ type: 'uuid' }),
2752
+ DateCreated: col({ type: 'datetime', nullable: true }),
2753
+ UtcDateCreated: col({ type: 'datetime', nullable: true }),
2754
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2755
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2756
+ CreatedById: col({ type: 'uuid', nullable: true }),
2757
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2758
+ Criteria: col({ type: 'string', length: 256, nullable: true }),
2759
+ SortOrder: col({ type: 'string', length: 256, nullable: true }),
2760
+ TemplateName: col({ type: 'string', length: 100, nullable: true }),
2761
+ IncludeInSitemap: col({ type: 'bool' }),
2762
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2763
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
2764
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
2765
+ Discriminator: col({ type: 'string', length: 128 }),
2766
+ SiteId: col({ type: 'uuid' }),
2767
+ },
2768
+ indexes: [
2769
+ ix({ columns: ['SiteId'] }),
2770
+ ],
2771
+ fks: [
2772
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2773
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2774
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2775
+ ],
2776
+ },
2777
+ {
2778
+ name: 'StorePartTemplates',
2779
+ scope: 'site',
2780
+ siteIdAdded: true,
2781
+ columns: {
2782
+ TemplateId: col({ type: 'uuid', pk: true }),
2783
+ StoreId: col({ type: 'uuid' }),
2784
+ Name: col({ type: 'string', length: 100 }),
2785
+ Alias: col({ type: 'string', length: 100 }),
2786
+ Description: col({ type: 'text', nullable: true }),
2787
+ Content: col({ type: 'text', nullable: true }),
2788
+ CustomDefaultLayout: col({ type: 'string', length: 50, nullable: true }),
2789
+ Layouts: col({ type: 'text', nullable: true }),
2790
+ DateCreated: col({ type: 'datetime' }),
2791
+ UtcDateCreated: col({ type: 'datetime' }),
2792
+ CreatedById: col({ type: 'uuid' }),
2793
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2794
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2795
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2796
+ SiteId: col({ type: 'uuid' }),
2797
+ },
2798
+ indexes: [
2799
+ ix({ columns: ['SiteId'] }),
2800
+ ],
2801
+ fks: [
2802
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2803
+ ],
2804
+ },
2805
+ {
2806
+ name: 'StoreTags',
2807
+ scope: 'site',
2808
+ siteIdAdded: true,
2809
+ columns: {
2810
+ TagId: col({ type: 'uuid', pk: true }),
2811
+ Title: col({ type: 'string', length: 50 }),
2812
+ Slug: col({ type: 'string', length: 50 }),
2813
+ Content: col({ type: 'text', nullable: true }),
2814
+ StoreId: col({ type: 'uuid' }),
2815
+ DateCreated: col({ type: 'datetime' }),
2816
+ UtcDateCreated: col({ type: 'datetime' }),
2817
+ CreatedById: col({ type: 'uuid' }),
2818
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2819
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2820
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2821
+ SiteId: col({ type: 'uuid' }),
2822
+ },
2823
+ indexes: [
2824
+ ix({ columns: ['SiteId'] }),
2825
+ ],
2826
+ fks: [
2827
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2828
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2829
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2830
+ ],
2831
+ },
2832
+ {
2833
+ name: 'StoreVendors',
2834
+ scope: 'site',
2835
+ siteIdAdded: true,
2836
+ columns: {
2837
+ VendorId: col({ type: 'uuid', pk: true }),
2838
+ Title: col({ type: 'string', length: 100 }),
2839
+ Slug: col({ type: 'string', length: 100 }),
2840
+ Content: col({ type: 'text', nullable: true }),
2841
+ StoreId: col({ type: 'uuid' }),
2842
+ DateCreated: col({ type: 'datetime' }),
2843
+ UtcDateCreated: col({ type: 'datetime' }),
2844
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2845
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2846
+ CreatedById: col({ type: 'uuid' }),
2847
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2848
+ SiteId: col({ type: 'uuid' }),
2849
+ },
2850
+ indexes: [
2851
+ ix({ columns: ['SiteId'] }),
2852
+ ],
2853
+ fks: [
2854
+ fk({ columns: ['StoreId'], ref: 'Stores', refColumns: ['StoreId'] }),
2855
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2856
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2857
+ ],
2858
+ },
2859
+ {
2860
+ name: 'Stores',
2861
+ scope: 'site',
2862
+ columns: {
2863
+ StoreId: col({ type: 'uuid', pk: true }),
2864
+ Title: col({ type: 'string', length: 256 }),
2865
+ Path: col({ type: 'string', length: 256 }),
2866
+ SiteId: col({ type: 'uuid' }),
2867
+ DateCreated: col({ type: 'datetime' }),
2868
+ UtcDateCreated: col({ type: 'datetime' }),
2869
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2870
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2871
+ CreatedById: col({ type: 'uuid' }),
2872
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2873
+ IncludeInSitemap: col({ type: 'bool' }),
2874
+ SitemapPriority: col({ type: 'decimal', precision: 18, scale: 2, nullable: true }),
2875
+ SitemapLastUpdatedTime: col({ type: 'datetime', nullable: true }),
2876
+ SitemapChangeFrequency: col({ type: 'string', length: 20, nullable: true }),
2877
+ Content: col({ type: 'text', nullable: true }),
2878
+ StoreLayout: col({ type: 'string', length: 255, nullable: true }),
2879
+ CategoryLayout: col({ type: 'string', length: 255, nullable: true }),
2880
+ SmartCategoryLayout: col({ type: 'string', length: 255, nullable: true }),
2881
+ TagLayout: col({ type: 'string', length: 255, nullable: true }),
2882
+ VendorLayout: col({ type: 'string', length: 255, nullable: true }),
2883
+ CategoriesLayout: col({ type: 'string', length: 255, nullable: true }),
2884
+ SmartCategoriesLayout: col({ type: 'string', length: 255, nullable: true }),
2885
+ TagsLayout: col({ type: 'string', length: 255, nullable: true }),
2886
+ VendorsLayout: col({ type: 'string', length: 255, nullable: true }),
2887
+ StoreFields: col({ type: 'text', nullable: true }),
2888
+ CategoryFields: col({ type: 'text', nullable: true }),
2889
+ SmartCategoryFields: col({ type: 'text', nullable: true }),
2890
+ TagFields: col({ type: 'text', nullable: true }),
2891
+ VendorFields: col({ type: 'text', nullable: true }),
2892
+ CategoriesPath: col({ type: 'string', length: 255, nullable: true }),
2893
+ TagsPath: col({ type: 'string', length: 255, nullable: true }),
2894
+ VendorsPath: col({ type: 'string', length: 255, nullable: true }),
2895
+ ProductsPath: col({ type: 'string', length: 255, nullable: true }),
2896
+ SettingsData: col({ type: 'text', nullable: true }),
2897
+ SettingsTemplate: col({ type: 'text', nullable: true }),
2898
+ StoreLayouts: col({ type: 'text', nullable: true }),
2899
+ CategoryLayouts: col({ type: 'text', nullable: true }),
2900
+ SmartCategoryLayouts: col({ type: 'text', nullable: true }),
2901
+ TagLayouts: col({ type: 'text', nullable: true }),
2902
+ VendorLayouts: col({ type: 'text', nullable: true }),
2903
+ ProductLayout: col({ type: 'string', length: 255, nullable: true }),
2904
+ ProductPath: col({ type: 'string', length: 255, nullable: true }),
2905
+ ProductNumberFormat: col({ type: 'string', length: 50, nullable: true }),
2906
+ RecentlyViewedEnabled: col({ type: 'bool' }),
2907
+ RecentlyViewedStorage: col({ type: 'int' }),
2908
+ RecentlyViewedExpires: col({ type: 'int', nullable: true }),
2909
+ RecentlyViewedListCapacity: col({ type: 'int' }),
2910
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2911
+ DefaultCorsPolicy: col({ type: 'text', nullable: true }),
2912
+ },
2913
+ indexes: [
2914
+ ix({ columns: ['SiteId'] }),
2915
+ ],
2916
+ fks: [
2917
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
2918
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2919
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2920
+ ],
2921
+ },
2922
+ {
2923
+ name: 'TableRecordPartTemplates',
2924
+ scope: 'site',
2925
+ columns: {
2926
+ TemplateId: col({ type: 'uuid', pk: true }),
2927
+ Name: col({ type: 'string', length: 100 }),
2928
+ Description: col({ type: 'string', length: 1000, nullable: true }),
2929
+ Content: col({ type: 'text', nullable: true }),
2930
+ Layouts: col({ type: 'text', nullable: true }),
2931
+ SiteId: col({ type: 'uuid' }),
2932
+ DateCreated: col({ type: 'datetime' }),
2933
+ UtcDateCreated: col({ type: 'datetime' }),
2934
+ CreatedById: col({ type: 'uuid' }),
2935
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2936
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2937
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2938
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2939
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
2940
+ },
2941
+ indexes: [
2942
+ ix({ columns: ['SiteId'] }),
2943
+ ],
2944
+ fks: [
2945
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2946
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
2947
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2948
+ ],
2949
+ },
2950
+ {
2951
+ name: 'TableRecords',
2952
+ scope: 'site',
2953
+ siteIdAdded: true,
2954
+ columns: {
2955
+ RecordId: col({ type: 'uuid', pk: true }),
2956
+ Title: col({ type: 'string', length: 100 }),
2957
+ Slug: col({ type: 'string', length: 100 }),
2958
+ TableId: col({ type: 'uuid' }),
2959
+ Content: col({ type: 'text', nullable: true }),
2960
+ Published: col({ type: 'bool' }),
2961
+ DatePublished: col({ type: 'datetime', nullable: true }),
2962
+ UtcDatePublished: col({ type: 'datetime', nullable: true }),
2963
+ DateCreated: col({ type: 'datetime' }),
2964
+ UtcDateCreated: col({ type: 'datetime' }),
2965
+ CreatedById: col({ type: 'uuid' }),
2966
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2967
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2968
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2969
+ SiteId: col({ type: 'uuid' }),
2970
+ },
2971
+ indexes: [
2972
+ ix({ columns: ['SiteId'] }),
2973
+ ],
2974
+ fks: [
2975
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2976
+ fk({ columns: ['TableId'], ref: 'Tables', refColumns: ['TableId'] }),
2977
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
2978
+ ],
2979
+ },
2980
+ {
2981
+ name: 'TableTemplates',
2982
+ scope: 'site',
2983
+ columns: {
2984
+ TemplateId: col({ type: 'uuid', pk: true }),
2985
+ Name: col({ type: 'string', length: 100 }),
2986
+ Description: col({ type: 'string', length: 1000, nullable: true }),
2987
+ Content: col({ type: 'text', nullable: true }),
2988
+ Layouts: col({ type: 'text', nullable: true }),
2989
+ SiteId: col({ type: 'uuid' }),
2990
+ DateCreated: col({ type: 'datetime' }),
2991
+ UtcDateCreated: col({ type: 'datetime' }),
2992
+ CreatedById: col({ type: 'uuid' }),
2993
+ DateUpdated: col({ type: 'datetime', nullable: true }),
2994
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
2995
+ UpdatedById: col({ type: 'uuid', nullable: true }),
2996
+ Alias: col({ type: 'string', length: 100, nullable: true }),
2997
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
2998
+ },
2999
+ indexes: [
3000
+ ix({ columns: ['SiteId'] }),
3001
+ ],
3002
+ fks: [
3003
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3004
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
3005
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3006
+ ],
3007
+ },
3008
+ {
3009
+ name: 'Tables',
3010
+ scope: 'site',
3011
+ columns: {
3012
+ TableId: col({ type: 'uuid', pk: true }),
3013
+ Title: col({ type: 'string', length: 100 }),
3014
+ Slug: col({ type: 'string', length: 100 }),
3015
+ SiteId: col({ type: 'uuid' }),
3016
+ TemplateId: col({ type: 'uuid' }),
3017
+ DateCreated: col({ type: 'datetime' }),
3018
+ UtcDateCreated: col({ type: 'datetime' }),
3019
+ CreatedById: col({ type: 'uuid' }),
3020
+ DateUpdated: col({ type: 'datetime', nullable: true }),
3021
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
3022
+ UpdatedById: col({ type: 'uuid', nullable: true }),
3023
+ },
3024
+ indexes: [
3025
+ ix({ columns: ['SiteId'] }),
3026
+ ],
3027
+ fks: [
3028
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3029
+ fk({ columns: ['TemplateId'], ref: 'TableTemplates', refColumns: ['TemplateId'] }),
3030
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3031
+ ],
3032
+ },
3033
+ {
3034
+ name: 'Themes',
3035
+ scope: 'site',
3036
+ columns: {
3037
+ ThemeId: col({ type: 'uuid', pk: true }),
3038
+ Name: col({ type: 'string', length: 100 }),
3039
+ ViewEngineId: col({ type: 'int' }),
3040
+ SiteId: col({ type: 'uuid' }),
3041
+ ImageSizes: col({ type: 'text', nullable: true }),
3042
+ SettingsData: col({ type: 'text', nullable: true }),
3043
+ SettingsMarkup: col({ type: 'text', nullable: true }),
3044
+ DateCreated: col({ type: 'datetime' }),
3045
+ UtcDateCreated: col({ type: 'datetime' }),
3046
+ DateUpdated: col({ type: 'datetime', nullable: true }),
3047
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
3048
+ CreatedById: col({ type: 'uuid' }),
3049
+ UpdatedById: col({ type: 'uuid', nullable: true }),
3050
+ ParentThemeId: col({ type: 'uuid', nullable: true }),
3051
+ },
3052
+ indexes: [
3053
+ ix({ columns: ['SiteId'] }),
3054
+ ],
3055
+ fks: [
3056
+ fk({ columns: ['ParentThemeId'], ref: 'Themes', refColumns: ['ThemeId'] }),
3057
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3058
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3059
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
3060
+ ],
3061
+ },
3062
+ {
3063
+ name: 'UploadCacheItems',
3064
+ scope: 'site',
3065
+ columns: {
3066
+ ItemId: col({ type: 'uuid', pk: true }),
3067
+ SiteId: col({ type: 'uuid' }),
3068
+ Filename: col({ type: 'string', length: 100 }),
3069
+ StorageClient: col({ type: 'string', length: 255 }),
3070
+ StorageFilename: col({ type: 'string', length: 255 }),
3071
+ MediaType: col({ type: 'string', length: 50 }),
3072
+ FileSize: col({ type: 'bigint' }),
3073
+ UtcDateCreated: col({ type: 'datetime' }),
3074
+ },
3075
+ indexes: [
3076
+ ix({ columns: ['SiteId'] }),
3077
+ ],
3078
+ },
3079
+ {
3080
+ name: 'Urls',
3081
+ scope: 'site',
3082
+ columns: {
3083
+ UrlId: col({ type: 'uuid', pk: true }),
3084
+ SiteId: col({ type: 'uuid' }),
3085
+ OriginalUrl: col({ type: 'string', length: 1024 }),
3086
+ ShortUrl: col({ type: 'string', length: 1024 }),
3087
+ },
3088
+ indexes: [
3089
+ ix({ columns: ['SiteId'] }),
3090
+ ],
3091
+ fks: [
3092
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
3093
+ ],
3094
+ },
3095
+ {
3096
+ name: 'Votes',
3097
+ scope: 'site',
3098
+ siteIdAdded: true,
3099
+ columns: {
3100
+ VoteId: col({ type: 'uuid', pk: true }),
3101
+ PostId: col({ type: 'uuid' }),
3102
+ Rating: col({ type: 'decimal', precision: 18, scale: 2 }),
3103
+ Timestamp: col({ type: 'datetime' }),
3104
+ UtcTimestamp: col({ type: 'datetime' }),
3105
+ IpAddress: col({ type: 'string', length: 20, nullable: true }),
3106
+ UserAgent: col({ type: 'string', length: 256, nullable: true }),
3107
+ SiteId: col({ type: 'uuid' }),
3108
+ },
3109
+ indexes: [
3110
+ ix({ columns: ['SiteId'] }),
3111
+ ],
3112
+ fks: [
3113
+ fk({ columns: ['PostId'], ref: 'Posts', refColumns: ['PostId'] }),
3114
+ ],
3115
+ },
3116
+ {
3117
+ name: 'Watermark',
3118
+ scope: 'site',
3119
+ siteIdAdded: true,
3120
+ columns: {
3121
+ IdWatermark: col({ type: 'uuid', pk: true }),
3122
+ Name: col({ type: 'string', length: 100 }),
3123
+ HorizontalAlign: col({ type: 'string', length: 20, nullable: true }),
3124
+ VerticalAlign: col({ type: 'string', length: 20, nullable: true }),
3125
+ Opacity: col({ type: 'int', nullable: true }),
3126
+ Padding: col({ type: 'int', nullable: true }),
3127
+ IdGallery: col({ type: 'uuid' }),
3128
+ SiteId: col({ type: 'uuid' }),
3129
+ },
3130
+ indexes: [
3131
+ ix({ columns: ['SiteId'] }),
3132
+ ],
3133
+ fks: [
3134
+ fk({ columns: ['IdGallery'], ref: 'Gallery', refColumns: ['IdGallery'] }),
3135
+ ],
3136
+ },
3137
+ {
3138
+ name: 'Watermark_ImageWatermark',
3139
+ scope: 'site',
3140
+ siteIdAdded: true,
3141
+ columns: {
3142
+ IdWatermark: col({ type: 'uuid', pk: true }),
3143
+ FilePath: col({ type: 'string', length: 256 }),
3144
+ Width: col({ type: 'int', nullable: true }),
3145
+ Height: col({ type: 'int', nullable: true }),
3146
+ SiteId: col({ type: 'uuid' }),
3147
+ },
3148
+ indexes: [
3149
+ ix({ columns: ['SiteId'] }),
3150
+ ],
3151
+ fks: [
3152
+ fk({ columns: ['IdWatermark'], ref: 'Watermark', refColumns: ['IdWatermark'] }),
3153
+ ],
3154
+ },
3155
+ {
3156
+ name: 'Watermark_TextWatermark',
3157
+ scope: 'site',
3158
+ siteIdAdded: true,
3159
+ columns: {
3160
+ IdWatermark: col({ type: 'uuid', pk: true }),
3161
+ Text: col({ type: 'string', length: 256 }),
3162
+ FontColor: col({ type: 'string', length: 20, nullable: true }),
3163
+ FontSize: col({ type: 'int', nullable: true }),
3164
+ FontStyle: col({ type: 'string', length: 20, nullable: true }),
3165
+ FontFamily: col({ type: 'string', length: 50, nullable: true }),
3166
+ SiteId: col({ type: 'uuid' }),
3167
+ },
3168
+ indexes: [
3169
+ ix({ columns: ['SiteId'] }),
3170
+ ],
3171
+ fks: [
3172
+ fk({ columns: ['IdWatermark'], ref: 'Watermark', refColumns: ['IdWatermark'] }),
3173
+ ],
3174
+ },
3175
+ {
3176
+ name: 'WidgetProperties',
3177
+ scope: 'site',
3178
+ siteIdAdded: true,
3179
+ columns: {
3180
+ PropertyId: col({ type: 'uuid', pk: true }),
3181
+ WidgetId: col({ type: 'uuid' }),
3182
+ PropertyKey: col({ type: 'string', length: 100 }),
3183
+ PropertyValue: col({ type: 'text', nullable: true }),
3184
+ SiteId: col({ type: 'uuid' }),
3185
+ },
3186
+ indexes: [
3187
+ ix({ columns: ['SiteId'] }),
3188
+ ],
3189
+ fks: [
3190
+ fk({ columns: ['WidgetId'], ref: 'Widgets', refColumns: ['WidgetId'] }),
3191
+ ],
3192
+ },
3193
+ {
3194
+ name: 'Widgets',
3195
+ scope: 'site',
3196
+ columns: {
3197
+ WidgetId: col({ type: 'uuid', pk: true }),
3198
+ SiteId: col({ type: 'uuid' }),
3199
+ Title: col({ type: 'string', length: 100 }),
3200
+ Handle: col({ type: 'string', length: 100 }),
3201
+ DateCreated: col({ type: 'datetime' }),
3202
+ UtcDateCreated: col({ type: 'datetime' }),
3203
+ DateUpdated: col({ type: 'datetime', nullable: true }),
3204
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
3205
+ CreatedById: col({ type: 'uuid' }),
3206
+ UpdatedById: col({ type: 'uuid', nullable: true }),
3207
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
3208
+ },
3209
+ indexes: [
3210
+ ix({ columns: ['SiteId'] }),
3211
+ ],
3212
+ fks: [
3213
+ fk({ columns: ['SiteId'], ref: 'Sites', refColumns: ['SiteId'] }),
3214
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3215
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3216
+ ],
3217
+ },
3218
+ {
3219
+ name: '_Modules',
3220
+ scope: 'site',
3221
+ siteIdAdded: true,
3222
+ columns: {
3223
+ ModuleId: col({ type: 'uuid', pk: true }),
3224
+ OwnerName: col({ type: 'string', length: 50 }),
3225
+ OwnerId: col({ type: 'uuid' }),
3226
+ Seq: col({ type: 'int' }),
3227
+ VisibleInList: col({ type: 'bool' }),
3228
+ VisibleInDetails: col({ type: 'bool' }),
3229
+ VisibleInFeed: col({ type: 'bool' }),
3230
+ CssClasses: col({ type: 'string', length: 255, nullable: true }),
3231
+ HtmlAttrubutes: col({ type: 'text', nullable: true }),
3232
+ Published: col({ type: 'bool' }),
3233
+ DateCreated: col({ type: 'datetime' }),
3234
+ UtcDateCreated: col({ type: 'datetime' }),
3235
+ DateUpdated: col({ type: 'datetime', nullable: true }),
3236
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
3237
+ CreatedById: col({ type: 'uuid' }),
3238
+ UpdatedById: col({ type: 'uuid', nullable: true }),
3239
+ Discriminator: col({ type: 'string', length: 128, nullable: true }),
3240
+ SiteId: col({ type: 'uuid' }),
3241
+ },
3242
+ indexes: [
3243
+ ix({ columns: ['SiteId'] }),
3244
+ ],
3245
+ fks: [
3246
+ fk({ columns: ['CreatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3247
+ fk({ columns: ['UpdatedById'], ref: 'Administrators', refColumns: ['AdministratorId'], soft: true }),
3248
+ ],
3249
+ },
3250
+ {
3251
+ name: '_Templates',
3252
+ scope: 'site',
3253
+ columns: {
3254
+ TemplateId: col({ type: 'uuid', pk: true }),
3255
+ Name: col({ type: 'string', length: 100 }),
3256
+ Content: col({ type: 'text', nullable: true }),
3257
+ Shared: col({ type: 'bool', nullable: true }),
3258
+ SiteId: col({ type: 'uuid' }),
3259
+ FormId: col({ type: 'uuid', nullable: true }),
3260
+ DateCreated: col({ type: 'datetime' }),
3261
+ UtcDateCreated: col({ type: 'datetime' }),
3262
+ CreatedById: col({ type: 'uuid' }),
3263
+ DateUpdated: col({ type: 'datetime', nullable: true }),
3264
+ UtcDateUpdated: col({ type: 'datetime', nullable: true }),
3265
+ UpdatedById: col({ type: 'uuid', nullable: true }),
3266
+ Post_BlogId: col({ type: 'uuid', nullable: true }),
3267
+ Module_BlogId: col({ type: 'uuid', nullable: true }),
3268
+ Part_BlogId: col({ type: 'uuid', nullable: true }),
3269
+ Part_SiteId: col({ type: 'uuid', nullable: true }),
3270
+ Product_StoreId: col({ type: 'uuid', nullable: true }),
3271
+ Part_StoreId: col({ type: 'uuid', nullable: true }),
3272
+ Description: col({ type: 'text', nullable: true }),
3273
+ Modules: col({ type: 'bool', nullable: true }),
3274
+ ListLayout: col({ type: 'string', length: 100, nullable: true }),
3275
+ DetailsLayout: col({ type: 'string', length: 100, nullable: true }),
3276
+ FeedLayout: col({ type: 'string', length: 100, nullable: true }),
3277
+ Discriminator: col({ type: 'string', length: 255, nullable: true }),
3278
+ Page_SiteId: col({ type: 'uuid', nullable: true }),
3279
+ PagePart_SiteId: col({ type: 'uuid', nullable: true }),
3280
+ Form_SiteId: col({ type: 'uuid', nullable: true }),
3281
+ Layouts: col({ type: 'text', nullable: true }),
3282
+ PageModule_SiteId: col({ type: 'uuid', nullable: true }),
3283
+ Alias: col({ type: 'string', length: 100, nullable: true }),
3284
+ CustomDefaultLayout: col({ type: 'string', length: 100, nullable: true }),
3285
+ },
3286
+ indexes: [
3287
+ ix({ columns: ['SiteId'] }),
3288
+ ],
3289
+ fks: [
3290
+ fk({ columns: ['FormId'], ref: 'Forms', refColumns: ['FormId'], soft: true }),
3291
+ // A template names its owner by KIND (task:4451): a PostTemplate carries
3292
+ // `Post_BlogId`, a module template `Module_BlogId`, a part template `Part_BlogId`,
3293
+ // all pointing at the blog that owns the site. Without these the plan had no join
3294
+ // for them and 44 rows on the production copy had nothing to inherit from.
3295
+ fk({ columns: ['Post_BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
3296
+ fk({ columns: ['Module_BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
3297
+ fk({ columns: ['Part_BlogId'], ref: 'Blogs', refColumns: ['BlogId'] }),
3298
+ ],
3299
+ },
3300
+ ],
3301
+ };