@velocity-astro/cms-db 0.0.0-stage → 0.1.0-beta.11

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/auth-tables.d.ts +881 -0
  4. package/dist/auth-tables.d.ts.map +1 -0
  5. package/dist/auth-tables.js +82 -0
  6. package/dist/auth-tables.js.map +1 -0
  7. package/dist/contact-repository.d.ts +16 -0
  8. package/dist/contact-repository.d.ts.map +1 -0
  9. package/dist/contact-repository.js +108 -0
  10. package/dist/contact-repository.js.map +1 -0
  11. package/dist/custom-fields-store.d.ts +9 -0
  12. package/dist/custom-fields-store.d.ts.map +1 -0
  13. package/dist/custom-fields-store.js +26 -0
  14. package/dist/custom-fields-store.js.map +1 -0
  15. package/dist/database.d.ts +2709 -0
  16. package/dist/database.d.ts.map +1 -0
  17. package/dist/database.js +22 -0
  18. package/dist/database.js.map +1 -0
  19. package/dist/deal-repository.d.ts +14 -0
  20. package/dist/deal-repository.d.ts.map +1 -0
  21. package/dist/deal-repository.js +70 -0
  22. package/dist/deal-repository.js.map +1 -0
  23. package/dist/entry-repository.d.ts +12 -0
  24. package/dist/entry-repository.d.ts.map +1 -0
  25. package/dist/entry-repository.js +107 -0
  26. package/dist/entry-repository.js.map +1 -0
  27. package/dist/form-repository.d.ts +14 -0
  28. package/dist/form-repository.d.ts.map +1 -0
  29. package/dist/form-repository.js +54 -0
  30. package/dist/form-repository.js.map +1 -0
  31. package/dist/index.d.ts +15 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +15 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/media-repository.d.ts +11 -0
  36. package/dist/media-repository.d.ts.map +1 -0
  37. package/dist/media-repository.js +33 -0
  38. package/dist/media-repository.js.map +1 -0
  39. package/dist/pipeline-store.d.ts +9 -0
  40. package/dist/pipeline-store.d.ts.map +1 -0
  41. package/dist/pipeline-store.js +31 -0
  42. package/dist/pipeline-store.js.map +1 -0
  43. package/dist/plugin-store.d.ts +12 -0
  44. package/dist/plugin-store.d.ts.map +1 -0
  45. package/dist/plugin-store.js +35 -0
  46. package/dist/plugin-store.js.map +1 -0
  47. package/dist/schema-repository.d.ts +11 -0
  48. package/dist/schema-repository.d.ts.map +1 -0
  49. package/dist/schema-repository.js +37 -0
  50. package/dist/schema-repository.js.map +1 -0
  51. package/dist/search-index.d.ts +15 -0
  52. package/dist/search-index.d.ts.map +1 -0
  53. package/dist/search-index.js +67 -0
  54. package/dist/search-index.js.map +1 -0
  55. package/dist/settings-store.d.ts +12 -0
  56. package/dist/settings-store.d.ts.map +1 -0
  57. package/dist/settings-store.js +26 -0
  58. package/dist/settings-store.js.map +1 -0
  59. package/dist/submission-repository.d.ts +14 -0
  60. package/dist/submission-repository.d.ts.map +1 -0
  61. package/dist/submission-repository.js +82 -0
  62. package/dist/submission-repository.js.map +1 -0
  63. package/dist/tables.d.ts +1835 -0
  64. package/dist/tables.d.ts.map +1 -0
  65. package/dist/tables.js +166 -0
  66. package/dist/tables.js.map +1 -0
  67. package/migrations/0000_init.sql +33 -0
  68. package/migrations/0001_search.sql +10 -0
  69. package/migrations/0002_published_version.sql +7 -0
  70. package/migrations/0003_auth.sql +71 -0
  71. package/migrations/0004_media.sql +12 -0
  72. package/migrations/0005_plugins.sql +7 -0
  73. package/migrations/0006_trash.sql +3 -0
  74. package/migrations/0007_forms.sql +24 -0
  75. package/migrations/0008_contacts.sql +23 -0
  76. package/migrations/0009_pipeline.sql +11 -0
  77. package/migrations/0010_deals.sql +16 -0
  78. package/migrations/0011_custom_fields.sql +2 -0
  79. package/migrations/0012_deal_subjects.sql +3 -0
  80. package/migrations/0013_submission_subjects.sql +2 -0
  81. package/migrations/0014_stage_moves.sql +2 -0
  82. package/migrations/0015_publish_problem.sql +1 -0
  83. package/migrations/meta/0000_snapshot.json +229 -0
  84. package/migrations/meta/0001_snapshot.json +229 -0
  85. package/migrations/meta/0002_snapshot.json +266 -0
  86. package/migrations/meta/0003_snapshot.json +744 -0
  87. package/migrations/meta/0004_snapshot.json +818 -0
  88. package/migrations/meta/0005_snapshot.json +864 -0
  89. package/migrations/meta/0006_snapshot.json +872 -0
  90. package/migrations/meta/0007_snapshot.json +1022 -0
  91. package/migrations/meta/0008_snapshot.json +1164 -0
  92. package/migrations/meta/0009_snapshot.json +1232 -0
  93. package/migrations/meta/0010_snapshot.json +1335 -0
  94. package/migrations/meta/0011_snapshot.json +1349 -0
  95. package/migrations/meta/0012_snapshot.json +1370 -0
  96. package/migrations/meta/0013_snapshot.json +1384 -0
  97. package/migrations/meta/0014_snapshot.json +1398 -0
  98. package/migrations/meta/0015_snapshot.json +1405 -0
  99. package/migrations/meta/_journal.json +118 -0
  100. package/package.json +43 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAa,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAElH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBpB,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AAEH,gDAAgD;AAChD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaxB,CAAC"}
package/dist/tables.js ADDED
@@ -0,0 +1,166 @@
1
+ import { sql } from 'drizzle-orm';
2
+ import { index, integer, primaryKey, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core';
3
+ /**
4
+ * One row per content type. The definition is stored whole, as JSON: it is always read and
5
+ * written as a unit, and its shape is owned by cms-core, not by this table.
6
+ */
7
+ export const contentTypes = sqliteTable('content_types', {
8
+ id: text('id').primaryKey(),
9
+ key: text('key').notNull(),
10
+ definition: text('definition', { mode: 'json' }).$type().notNull(),
11
+ }, (table) => [uniqueIndex('content_types_key').on(table.key)]);
12
+ /**
13
+ * One row per entry: the version being worked on, and beside it, in the `published_` columns, the
14
+ * version visitors see. Those four are all set or all null.
15
+ */
16
+ export const entries = sqliteTable('entries', {
17
+ id: text('id').primaryKey(),
18
+ typeId: text('type_id').notNull(),
19
+ locale: text('locale').notNull(),
20
+ translationGroup: text('translation_group').notNull(),
21
+ slug: text('slug').notNull(),
22
+ status: text('status').$type().notNull(),
23
+ data: text('data', { mode: 'json' }).$type().notNull(),
24
+ revision: integer('revision').notNull(),
25
+ publishAt: text('publish_at'),
26
+ /** Why it did not go on the site when its time came. */
27
+ publishProblem: text('publish_problem'),
28
+ publishedSlug: text('published_slug'),
29
+ publishedData: text('published_data', { mode: 'json' }).$type(),
30
+ publishedRevision: integer('published_revision'),
31
+ publishedAt: text('published_at'),
32
+ createdAt: text('created_at').notNull(),
33
+ updatedAt: text('updated_at').notNull(),
34
+ /** Set while the entry is in the trash. */
35
+ deletedAt: text('deleted_at'),
36
+ }, (table) => [
37
+ // An entry in the trash holds no slug, so another entry may take it.
38
+ uniqueIndex('entries_type_locale_slug').on(table.typeId, table.locale, table.slug).where(sql `${table.deletedAt} is null`),
39
+ uniqueIndex('entries_type_locale_published_slug').on(table.typeId, table.locale, table.publishedSlug),
40
+ index('entries_type_status').on(table.typeId, table.status),
41
+ index('entries_translation_group').on(table.translationGroup),
42
+ ]);
43
+ /** Every saved version of every entry. Rows are only ever added. */
44
+ export const revisions = sqliteTable('revisions', {
45
+ entryId: text('entry_id').notNull(),
46
+ revision: integer('revision').notNull(),
47
+ status: text('status').$type().notNull(),
48
+ data: text('data', { mode: 'json' }).$type().notNull(),
49
+ actorId: text('actor_id').notNull(),
50
+ createdAt: text('created_at').notNull(),
51
+ }, (table) => [primaryKey({ columns: [table.entryId, table.revision] })]);
52
+ /** The record of every uploaded image. The files themselves are kept in a `MediaStore`. */
53
+ export const media = sqliteTable('media', {
54
+ name: text('name').primaryKey(),
55
+ key: text('key').notNull(),
56
+ contentType: text('content_type').notNull(),
57
+ width: integer('width').notNull(),
58
+ height: integer('height').notNull(),
59
+ size: integer('size').notNull(),
60
+ createdAt: text('created_at').notNull(),
61
+ createdBy: text('created_by').notNull(),
62
+ }, (table) => [uniqueIndex('media_key').on(table.key)]);
63
+ /**
64
+ * Small values kept per plugin: its settings, whether it is switched on, and what it stores
65
+ * itself. `value` is JSON as text, written and read by the store, so `null` and `false` are
66
+ * values like any other.
67
+ */
68
+ export const pluginData = sqliteTable('plugin_data', {
69
+ plugin: text('plugin').notNull(),
70
+ key: text('key').notNull(),
71
+ value: text('value').notNull(),
72
+ updatedAt: text('updated_at').notNull(),
73
+ }, (table) => [primaryKey({ columns: [table.plugin, table.key] })]);
74
+ /**
75
+ * One row per form. The definition is stored whole, as JSON, like a content type's. `revision`
76
+ * and `deleted_at` are repeated beside it for the checks a save makes.
77
+ */
78
+ export const forms = sqliteTable('forms', {
79
+ id: text('id').primaryKey(),
80
+ key: text('key').notNull(),
81
+ revision: integer('revision').notNull(),
82
+ definition: text('definition', { mode: 'json' }).$type().notNull(),
83
+ deletedAt: text('deleted_at'),
84
+ },
85
+ // A form in the trash holds no key, so another form may take it.
86
+ (table) => [uniqueIndex('forms_key').on(table.key).where(sql `${table.deletedAt} is null`)]);
87
+ /** What visitors sent through forms. Personal data: read only through the submission service. */
88
+ export const formSubmissions = sqliteTable('form_submissions', {
89
+ id: text('id').primaryKey(),
90
+ formId: text('form_id').notNull(),
91
+ status: text('status').$type().notNull(),
92
+ data: text('data', { mode: 'json' }).$type().notNull(),
93
+ email: text('email'),
94
+ locale: text('locale'),
95
+ page: text('page'),
96
+ /** The entry whose own page it was sent from: its content type and its translation group. */
97
+ aboutType: text('about_type'),
98
+ aboutEntry: text('about_entry'),
99
+ createdAt: text('created_at').notNull(),
100
+ handledAt: text('handled_at'),
101
+ handledBy: text('handled_by'),
102
+ }, (table) => [
103
+ index('form_submissions_form_created').on(table.formId, table.createdAt),
104
+ index('form_submissions_email').on(table.email),
105
+ ]);
106
+ /** The people who wrote to the site. Personal data: read only through the contact service. */
107
+ export const contacts = sqliteTable('contacts', {
108
+ id: text('id').primaryKey(),
109
+ email: text('email').notNull(),
110
+ name: text('name'),
111
+ phone: text('phone'),
112
+ sourceFormId: text('source_form_id'),
113
+ sourcePage: text('source_page'),
114
+ // Whoever wrote in before there was a pipeline starts where a new contact does.
115
+ stage: text('stage').notNull().default('new'),
116
+ ownerId: text('owner_id'),
117
+ followUpAt: text('follow_up_at'),
118
+ // What the site's own fields hold, by field id.
119
+ data: text('data', { mode: 'json' }).$type(),
120
+ revision: integer('revision').notNull(),
121
+ createdAt: text('created_at').notNull(),
122
+ updatedAt: text('updated_at').notNull(),
123
+ }, (table) => [
124
+ uniqueIndex('contacts_email').on(table.email),
125
+ index('contacts_created').on(table.createdAt),
126
+ index('contacts_stage').on(table.stage, table.createdAt),
127
+ index('contacts_follow_up').on(table.followUpAt),
128
+ ]);
129
+ /** What contacts may buy. As personal as its contact: read only through the deal service. */
130
+ export const deals = sqliteTable('deals', {
131
+ id: text('id').primaryKey(),
132
+ contactId: text('contact_id').notNull(),
133
+ title: text('title').notNull(),
134
+ aboutType: text('about_type'),
135
+ aboutEntry: text('about_entry'),
136
+ value: integer('value').notNull(),
137
+ stage: text('stage').notNull(),
138
+ ownerId: text('owner_id'),
139
+ closeOn: text('close_on'),
140
+ closedAt: text('closed_at'),
141
+ data: text('data', { mode: 'json' }).$type(),
142
+ revision: integer('revision').notNull(),
143
+ createdAt: text('created_at').notNull(),
144
+ updatedAt: text('updated_at').notNull(),
145
+ }, (table) => [index('deals_contact').on(table.contactId), index('deals_stage').on(table.stage, table.createdAt), index('deals_about').on(table.aboutEntry)]);
146
+ /**
147
+ * Small things a site keeps one of, each stored whole as JSON under its name: the pipeline's
148
+ * stages today. `revision` is repeated beside it for the check a save makes.
149
+ */
150
+ export const siteSettings = sqliteTable('site_settings', {
151
+ key: text('key').primaryKey(),
152
+ revision: integer('revision').notNull(),
153
+ value: text('value', { mode: 'json' }).$type().notNull(),
154
+ });
155
+ /** What the team wrote down about a contact. */
156
+ export const contactNotes = sqliteTable('contact_notes', {
157
+ id: text('id').primaryKey(),
158
+ contactId: text('contact_id').notNull(),
159
+ text: text('text').notNull(),
160
+ /** Set on the record of a move to another stage: the stage left and the stage reached. */
161
+ movedFrom: text('moved_from'),
162
+ movedTo: text('moved_to'),
163
+ createdBy: text('created_by').notNull(),
164
+ createdAt: text('created_at').notNull(),
165
+ }, (table) => [index('contact_notes_contact').on(table.contactId, table.createdAt)]);
166
+ //# sourceMappingURL=tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.js","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGrG;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CACrC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;IAC1B,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAkB,CAAC,OAAO,EAAE;CACnF,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAC5D,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAChC,SAAS,EACT;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,MAAM,EAA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C,KAAK,CAAC,UAAU,CAAC,CAAC,CAC1J,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,eAAe,EAAE;IACvD,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE;IAC7B,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;IACvC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAW,CAAC,OAAO,EAAE;CAClE,CAAC,CAAC;AAEH,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CACrC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,0FAA0F;IAC1F,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAC7B,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;IACzB,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CACxC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CACjF,CAAC"}
@@ -0,0 +1,33 @@
1
+ CREATE TABLE `content_types` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `key` text NOT NULL,
4
+ `definition` text NOT NULL
5
+ );
6
+ --> statement-breakpoint
7
+ CREATE UNIQUE INDEX `content_types_key` ON `content_types` (`key`);--> statement-breakpoint
8
+ CREATE TABLE `entries` (
9
+ `id` text PRIMARY KEY NOT NULL,
10
+ `type_id` text NOT NULL,
11
+ `locale` text NOT NULL,
12
+ `translation_group` text NOT NULL,
13
+ `slug` text NOT NULL,
14
+ `status` text NOT NULL,
15
+ `data` text NOT NULL,
16
+ `revision` integer NOT NULL,
17
+ `publish_at` text,
18
+ `created_at` text NOT NULL,
19
+ `updated_at` text NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE UNIQUE INDEX `entries_type_locale_slug` ON `entries` (`type_id`,`locale`,`slug`);--> statement-breakpoint
23
+ CREATE INDEX `entries_type_status` ON `entries` (`type_id`,`status`);--> statement-breakpoint
24
+ CREATE INDEX `entries_translation_group` ON `entries` (`translation_group`);--> statement-breakpoint
25
+ CREATE TABLE `revisions` (
26
+ `entry_id` text NOT NULL,
27
+ `revision` integer NOT NULL,
28
+ `status` text NOT NULL,
29
+ `data` text NOT NULL,
30
+ `actor_id` text NOT NULL,
31
+ `created_at` text NOT NULL,
32
+ PRIMARY KEY(`entry_id`, `revision`)
33
+ );
@@ -0,0 +1,10 @@
1
+ -- Full-text search over published pages. A virtual table, so it is written by hand:
2
+ -- Drizzle's table definitions cannot describe FTS5.
3
+ CREATE VIRTUAL TABLE `search_documents` USING fts5(
4
+ `id` UNINDEXED,
5
+ `locale` UNINDEXED,
6
+ `url` UNINDEXED,
7
+ `title`,
8
+ `body`,
9
+ tokenize = 'unicode61 remove_diacritics 2'
10
+ );
@@ -0,0 +1,7 @@
1
+ ALTER TABLE `entries` ADD `published_slug` text;--> statement-breakpoint
2
+ ALTER TABLE `entries` ADD `published_data` text;--> statement-breakpoint
3
+ ALTER TABLE `entries` ADD `published_revision` integer;--> statement-breakpoint
4
+ ALTER TABLE `entries` ADD `published_at` text;--> statement-breakpoint
5
+ -- Entries published before this migration were live as they stood.
6
+ UPDATE `entries` SET `published_slug` = `slug`, `published_data` = `data`, `published_revision` = `revision`, `published_at` = `updated_at` WHERE `status` = 'published';--> statement-breakpoint
7
+ CREATE UNIQUE INDEX `entries_type_locale_published_slug` ON `entries` (`type_id`,`locale`,`published_slug`);
@@ -0,0 +1,71 @@
1
+ CREATE TABLE `auth_account` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `account_id` text NOT NULL,
4
+ `provider_id` text NOT NULL,
5
+ `user_id` text NOT NULL,
6
+ `access_token` text,
7
+ `refresh_token` text,
8
+ `id_token` text,
9
+ `access_token_expires_at` integer,
10
+ `refresh_token_expires_at` integer,
11
+ `scope` text,
12
+ `password` text,
13
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
14
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
15
+ FOREIGN KEY (`user_id`) REFERENCES `auth_user`(`id`) ON UPDATE no action ON DELETE cascade
16
+ );
17
+ --> statement-breakpoint
18
+ CREATE INDEX `auth_account_user_id` ON `auth_account` (`user_id`);--> statement-breakpoint
19
+ CREATE TABLE `auth_passkey` (
20
+ `id` text PRIMARY KEY NOT NULL,
21
+ `name` text,
22
+ `public_key` text NOT NULL,
23
+ `user_id` text NOT NULL,
24
+ `credential_id` text NOT NULL,
25
+ `counter` integer NOT NULL,
26
+ `device_type` text NOT NULL,
27
+ `backed_up` integer NOT NULL,
28
+ `transports` text,
29
+ `created_at` integer,
30
+ `aaguid` text,
31
+ FOREIGN KEY (`user_id`) REFERENCES `auth_user`(`id`) ON UPDATE no action ON DELETE cascade
32
+ );
33
+ --> statement-breakpoint
34
+ CREATE INDEX `auth_passkey_user_id` ON `auth_passkey` (`user_id`);--> statement-breakpoint
35
+ CREATE INDEX `auth_passkey_credential_id` ON `auth_passkey` (`credential_id`);--> statement-breakpoint
36
+ CREATE TABLE `auth_session` (
37
+ `id` text PRIMARY KEY NOT NULL,
38
+ `expires_at` integer NOT NULL,
39
+ `token` text NOT NULL,
40
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
41
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
42
+ `ip_address` text,
43
+ `user_agent` text,
44
+ `user_id` text NOT NULL,
45
+ FOREIGN KEY (`user_id`) REFERENCES `auth_user`(`id`) ON UPDATE no action ON DELETE cascade
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE UNIQUE INDEX `auth_session_token_unique` ON `auth_session` (`token`);--> statement-breakpoint
49
+ CREATE INDEX `auth_session_user_id` ON `auth_session` (`user_id`);--> statement-breakpoint
50
+ CREATE TABLE `auth_user` (
51
+ `id` text PRIMARY KEY NOT NULL,
52
+ `name` text NOT NULL,
53
+ `email` text NOT NULL,
54
+ `email_verified` integer DEFAULT false NOT NULL,
55
+ `image` text,
56
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
57
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
58
+ `role` text DEFAULT 'author' NOT NULL
59
+ );
60
+ --> statement-breakpoint
61
+ CREATE UNIQUE INDEX `auth_user_email_unique` ON `auth_user` (`email`);--> statement-breakpoint
62
+ CREATE TABLE `auth_verification` (
63
+ `id` text PRIMARY KEY NOT NULL,
64
+ `identifier` text NOT NULL,
65
+ `value` text NOT NULL,
66
+ `expires_at` integer NOT NULL,
67
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
68
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL
69
+ );
70
+ --> statement-breakpoint
71
+ CREATE INDEX `auth_verification_identifier` ON `auth_verification` (`identifier`);
@@ -0,0 +1,12 @@
1
+ CREATE TABLE `media` (
2
+ `name` text PRIMARY KEY NOT NULL,
3
+ `key` text NOT NULL,
4
+ `content_type` text NOT NULL,
5
+ `width` integer NOT NULL,
6
+ `height` integer NOT NULL,
7
+ `size` integer NOT NULL,
8
+ `created_at` text NOT NULL,
9
+ `created_by` text NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE UNIQUE INDEX `media_key` ON `media` (`key`);
@@ -0,0 +1,7 @@
1
+ CREATE TABLE `plugin_data` (
2
+ `plugin` text NOT NULL,
3
+ `key` text NOT NULL,
4
+ `value` text NOT NULL,
5
+ `updated_at` text NOT NULL,
6
+ PRIMARY KEY(`plugin`, `key`)
7
+ );
@@ -0,0 +1,3 @@
1
+ DROP INDEX `entries_type_locale_slug`;--> statement-breakpoint
2
+ ALTER TABLE `entries` ADD `deleted_at` text;--> statement-breakpoint
3
+ CREATE UNIQUE INDEX `entries_type_locale_slug` ON `entries` (`type_id`,`locale`,`slug`) WHERE "entries"."deleted_at" is null;
@@ -0,0 +1,24 @@
1
+ CREATE TABLE `form_submissions` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `form_id` text NOT NULL,
4
+ `status` text NOT NULL,
5
+ `data` text NOT NULL,
6
+ `email` text,
7
+ `locale` text,
8
+ `page` text,
9
+ `created_at` text NOT NULL,
10
+ `handled_at` text,
11
+ `handled_by` text
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE INDEX `form_submissions_form_created` ON `form_submissions` (`form_id`,`created_at`);--> statement-breakpoint
15
+ CREATE INDEX `form_submissions_email` ON `form_submissions` (`email`);--> statement-breakpoint
16
+ CREATE TABLE `forms` (
17
+ `id` text PRIMARY KEY NOT NULL,
18
+ `key` text NOT NULL,
19
+ `revision` integer NOT NULL,
20
+ `definition` text NOT NULL,
21
+ `deleted_at` text
22
+ );
23
+ --> statement-breakpoint
24
+ CREATE UNIQUE INDEX `forms_key` ON `forms` (`key`) WHERE "forms"."deleted_at" is null;
@@ -0,0 +1,23 @@
1
+ CREATE TABLE `contact_notes` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `contact_id` text NOT NULL,
4
+ `text` text NOT NULL,
5
+ `created_by` text NOT NULL,
6
+ `created_at` text NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ CREATE INDEX `contact_notes_contact` ON `contact_notes` (`contact_id`,`created_at`);--> statement-breakpoint
10
+ CREATE TABLE `contacts` (
11
+ `id` text PRIMARY KEY NOT NULL,
12
+ `email` text NOT NULL,
13
+ `name` text,
14
+ `phone` text,
15
+ `source_form_id` text,
16
+ `source_page` text,
17
+ `revision` integer NOT NULL,
18
+ `created_at` text NOT NULL,
19
+ `updated_at` text NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE UNIQUE INDEX `contacts_email` ON `contacts` (`email`);--> statement-breakpoint
23
+ CREATE INDEX `contacts_created` ON `contacts` (`created_at`);
@@ -0,0 +1,11 @@
1
+ CREATE TABLE `site_settings` (
2
+ `key` text PRIMARY KEY NOT NULL,
3
+ `revision` integer NOT NULL,
4
+ `value` text NOT NULL
5
+ );
6
+ --> statement-breakpoint
7
+ ALTER TABLE `contacts` ADD `stage` text DEFAULT 'new' NOT NULL;--> statement-breakpoint
8
+ ALTER TABLE `contacts` ADD `owner_id` text;--> statement-breakpoint
9
+ ALTER TABLE `contacts` ADD `follow_up_at` text;--> statement-breakpoint
10
+ CREATE INDEX `contacts_stage` ON `contacts` (`stage`,`created_at`);--> statement-breakpoint
11
+ CREATE INDEX `contacts_follow_up` ON `contacts` (`follow_up_at`);
@@ -0,0 +1,16 @@
1
+ CREATE TABLE `deals` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `contact_id` text NOT NULL,
4
+ `title` text NOT NULL,
5
+ `value` integer NOT NULL,
6
+ `stage` text NOT NULL,
7
+ `owner_id` text,
8
+ `close_on` text,
9
+ `closed_at` text,
10
+ `revision` integer NOT NULL,
11
+ `created_at` text NOT NULL,
12
+ `updated_at` text NOT NULL
13
+ );
14
+ --> statement-breakpoint
15
+ CREATE INDEX `deals_contact` ON `deals` (`contact_id`);--> statement-breakpoint
16
+ CREATE INDEX `deals_stage` ON `deals` (`stage`,`created_at`);
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `contacts` ADD `data` text;--> statement-breakpoint
2
+ ALTER TABLE `deals` ADD `data` text;
@@ -0,0 +1,3 @@
1
+ ALTER TABLE `deals` ADD `about_type` text;--> statement-breakpoint
2
+ ALTER TABLE `deals` ADD `about_entry` text;--> statement-breakpoint
3
+ CREATE INDEX `deals_about` ON `deals` (`about_entry`);
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `form_submissions` ADD `about_type` text;--> statement-breakpoint
2
+ ALTER TABLE `form_submissions` ADD `about_entry` text;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `contact_notes` ADD `moved_from` text;--> statement-breakpoint
2
+ ALTER TABLE `contact_notes` ADD `moved_to` text;
@@ -0,0 +1 @@
1
+ ALTER TABLE `entries` ADD `publish_problem` text;