dineway 0.1.39 → 0.1.41
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.
- package/README.md +0 -1
- package/dist/api/route-utils.d.mts +7 -7
- package/dist/api/route-utils.mjs +1 -1
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/{api-BuW5Txoj.mjs → api-BARzYYYq.mjs} +1 -1
- package/dist/astro/index.d.mts +7 -7
- package/dist/astro/index.mjs +8 -2
- package/dist/astro/middleware/auth.d.mts +7 -7
- package/dist/astro/middleware/auth.mjs +1 -1
- package/dist/astro/middleware/request-context.mjs +1 -1
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +7 -7
- package/dist/astro/routes/PluginRegistry.mjs +1 -1
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +1 -1
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +2 -2
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +2 -2
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +2 -2
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +2 -2
- package/dist/astro/routes/api/admin/context/diff.mjs +2 -2
- package/dist/astro/routes/api/admin/context/index.mjs +2 -2
- package/dist/astro/routes/api/admin/context/stale.mjs +2 -2
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +3 -3
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +3 -3
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +3 -3
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +1 -1
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +1 -1
- package/dist/astro/routes/api/auth/dev-bypass.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/register-options.mjs +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +1 -1
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +2 -2
- package/dist/astro/routes/api/import/wordpress/execute.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +2 -2
- package/dist/astro/routes/api/manifest.mjs +3 -3
- package/dist/astro/routes/api/mcp.mjs +2 -2
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +2 -2
- package/dist/astro/routes/api/menus/_name_/items.mjs +2 -2
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +2 -2
- package/dist/astro/routes/api/menus/_name_/translations.mjs +2 -2
- package/dist/astro/routes/api/menus/_name_.mjs +2 -2
- package/dist/astro/routes/api/menus/index.mjs +2 -2
- package/dist/astro/routes/api/oauth/authorize.mjs +3 -3
- package/dist/astro/routes/api/oauth/device/authorize.mjs +2 -2
- package/dist/astro/routes/api/oauth/device/code.mjs +2 -2
- package/dist/astro/routes/api/oauth/device/token.mjs +2 -2
- package/dist/astro/routes/api/oauth/register.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/refresh.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/revoke.mjs +2 -2
- package/dist/astro/routes/api/oauth/token.mjs +3 -3
- package/dist/astro/routes/api/openapi.json.mjs +1 -1
- package/dist/astro/routes/api/redirects/_id_.mjs +2 -2
- package/dist/astro/routes/api/redirects/index.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +1 -1
- package/dist/astro/routes/api/sections/_slug_.mjs +2 -2
- package/dist/astro/routes/api/sections/index.mjs +2 -2
- package/dist/astro/routes/api/settings.mjs +2 -2
- package/dist/astro/routes/api/setup/admin-verify.mjs +3 -3
- package/dist/astro/routes/api/setup/admin.mjs +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +1 -1
- package/dist/astro/routes/api/setup/index.mjs +2 -2
- package/dist/astro/routes/api/setup/status.mjs +1 -1
- package/dist/astro/routes/api/snapshot.mjs +2 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/index.mjs +2 -2
- package/dist/astro/routes/api/themes/preview.mjs +1 -1
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +1 -1
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/index.mjs +2 -2
- package/dist/astro/session-driver.d.mts +14 -0
- package/dist/astro/session-driver.mjs +33 -0
- package/dist/astro/types.d.mts +7 -7
- package/dist/auth/providers/github-admin.mjs +1 -1
- package/dist/auth/providers/google-admin.mjs +1 -1
- package/dist/{bylines-CrNTrD1c.d.mts → bylines-DCAznmua.d.mts} +28 -28
- package/dist/cli/index.mjs +10 -34
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/{context-BnD2m5tn.mjs → context-DgqEfcWz.mjs} +1 -1
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +1 -1
- package/dist/{device-flow-DDZjntgf.mjs → device-flow-CTS91g4A.mjs} +2 -2
- package/dist/{hitl-requests-Dt7JsXh5.mjs → hitl-requests-DaRuZ7tb.mjs} +2 -2
- package/dist/{hitl-route-helpers-F3voM_3Y.mjs → hitl-route-helpers-DcPySbZ3.mjs} +2 -2
- package/dist/{index-CpbixmRL.d.mts → index-BwOO3vu2.d.mts} +1 -1
- package/dist/{index-2tBfB_8X.d.mts → index-Ct0pjZwW.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +7 -7
- package/dist/{oauth-authorization-lW9vJ_hl.mjs → oauth-authorization-DyOFXQWq.mjs} +2 -2
- package/dist/{oauth-clients-D1n0ykZJ.mjs → oauth-clients-BMs_bmoz.mjs} +1 -1
- package/dist/page/index.d.mts +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +7 -7
- package/dist/{runner-S3smkgdc.mjs → runner-DF2DgD_B.mjs} +191 -177
- package/dist/{runner-pAnQS6iI.d.mts → runner-FhUNNaqA.d.mts} +1 -1
- package/dist/{runtime-BM9sqnzO.d.mts → runtime-CMx0q9sA.d.mts} +5 -5
- package/dist/runtime.d.mts +8 -8
- package/dist/seed/index.d.mts +2 -2
- package/dist/{site-context-BBX9G7FT.mjs → site-context-DuBQk6Mp.mjs} +1 -1
- package/dist/{types-B1NksXAb.d.mts → types-C-CMfzSl.d.mts} +6 -0
- package/dist/ui/server-runtime.d.mts +4 -4
- package/dist/{validate-BzUCAU2a.d.mts → validate-CvQ6cvHH.d.mts} +1 -1
- package/dist/version-CMtH9acb.mjs +6 -0
- package/package.json +8 -1
- package/dist/version-C_JnO2sx.mjs +0 -6
- /package/dist/{allowed-origins-U7ZavuGp.mjs → allowed-origins-3RuuoFjC.mjs} +0 -0
- /package/dist/{challenge-store-ChIyDxM6.mjs → challenge-store-cJam-E5R.mjs} +0 -0
- /package/dist/{experimental-workflows-_I9NlZbO.mjs → experimental-workflows-BbZbIEZp.mjs} +0 -0
- /package/dist/{jsonld-BhdZoeR1.d.mts → jsonld-CLbYsYYH.d.mts} +0 -0
- /package/dist/{mode-BSPqFzOJ.mjs → mode-Bd55iLcP.mjs} +0 -0
- /package/dist/{provider-loader-BaZhx7E3.d.mts → provider-loader-B19YyyBp.d.mts} +0 -0
- /package/dist/{secrets-DOkSNlfQ.mjs → secrets-DfeNNoLa.mjs} +0 -0
- /package/dist/{setup-complete-DXCcwkth.mjs → setup-complete-C2ztsNhJ.mjs} +0 -0
- /package/dist/{transport-qeWznEPc.d.mts → transport-nNEGdHkI.d.mts} +0 -0
|
@@ -7,8 +7,8 @@ import { createHash } from "node:crypto";
|
|
|
7
7
|
|
|
8
8
|
//#region src/database/migrations/001_initial.ts
|
|
9
9
|
var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
down: () => down$
|
|
11
|
-
up: () => up$
|
|
10
|
+
down: () => down$44,
|
|
11
|
+
up: () => up$44
|
|
12
12
|
});
|
|
13
13
|
/**
|
|
14
14
|
* Initial schema migration
|
|
@@ -17,7 +17,7 @@ var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
|
17
17
|
* by the SchemaRegistry when collections are added via the admin UI.
|
|
18
18
|
* This migration only creates system tables.
|
|
19
19
|
*/
|
|
20
|
-
async function up$
|
|
20
|
+
async function up$44(db) {
|
|
21
21
|
await db.schema.createTable("revisions").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection", "text", (col) => col.notNull()).addColumn("entry_id", "text", (col) => col.notNull()).addColumn("data", "text", (col) => col.notNull()).addColumn("author_id", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
22
22
|
await db.schema.createIndex("idx_revisions_entry").ifNotExists().on("revisions").columns(["collection", "entry_id"]).execute();
|
|
23
23
|
await db.schema.createTable("taxonomies").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("slug", "text", (col) => col.notNull()).addColumn("label", "text", (col) => col.notNull()).addColumn("parent_id", "text").addColumn("data", "text").addUniqueConstraint("taxonomies_name_slug_unique", ["name", "slug"]).addForeignKeyConstraint("taxonomies_parent_fk", ["parent_id"], "taxonomies", ["id"], (cb) => cb.onDelete("set null")).execute();
|
|
@@ -37,7 +37,7 @@ async function up$43(db) {
|
|
|
37
37
|
await db.schema.createIndex("idx_audit_action").ifNotExists().on("audit_logs").column("action").execute();
|
|
38
38
|
await db.schema.createIndex("idx_audit_timestamp").ifNotExists().on("audit_logs").column("timestamp").execute();
|
|
39
39
|
}
|
|
40
|
-
async function down$
|
|
40
|
+
async function down$44(db) {
|
|
41
41
|
await db.schema.dropTable("audit_logs").execute();
|
|
42
42
|
await db.schema.dropTable("options").execute();
|
|
43
43
|
await db.schema.dropTable("users").execute();
|
|
@@ -50,26 +50,26 @@ async function down$43(db) {
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/database/migrations/002_media_status.ts
|
|
52
52
|
var _002_media_status_exports = /* @__PURE__ */ __exportAll({
|
|
53
|
-
down: () => down$
|
|
54
|
-
up: () => up$
|
|
53
|
+
down: () => down$43,
|
|
54
|
+
up: () => up$43
|
|
55
55
|
});
|
|
56
56
|
/**
|
|
57
57
|
* Add status column to media table for tracking upload state.
|
|
58
58
|
* Status values: 'pending' | 'ready' | 'failed'
|
|
59
59
|
*/
|
|
60
|
-
async function up$
|
|
60
|
+
async function up$43(db) {
|
|
61
61
|
await db.schema.alterTable("media").addColumn("status", "text", (col) => col.notNull().defaultTo("ready")).execute();
|
|
62
62
|
await db.schema.createIndex("idx_media_status").on("media").column("status").execute();
|
|
63
63
|
}
|
|
64
|
-
async function down$
|
|
64
|
+
async function down$43(db) {
|
|
65
65
|
await db.schema.dropIndex("idx_media_status").execute();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/database/migrations/003_schema_registry.ts
|
|
70
70
|
var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
71
|
-
down: () => down$
|
|
72
|
-
up: () => up$
|
|
71
|
+
down: () => down$42,
|
|
72
|
+
up: () => up$42
|
|
73
73
|
});
|
|
74
74
|
/**
|
|
75
75
|
* Migration: Schema Registry Tables
|
|
@@ -77,14 +77,14 @@ var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
|
77
77
|
* Creates the schema registry tables that store collection and field definitions.
|
|
78
78
|
* This enables dynamic schema management where the database is the source of truth.
|
|
79
79
|
*/
|
|
80
|
-
async function up$
|
|
80
|
+
async function up$42(db) {
|
|
81
81
|
await db.schema.createTable("_dineway_collections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("label_singular", "text").addColumn("description", "text").addColumn("icon", "text").addColumn("supports", "text").addColumn("source", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
82
82
|
await db.schema.createTable("_dineway_fields").addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection_id", "text", (col) => col.notNull()).addColumn("slug", "text", (col) => col.notNull()).addColumn("label", "text", (col) => col.notNull()).addColumn("type", "text", (col) => col.notNull()).addColumn("column_type", "text", (col) => col.notNull()).addColumn("required", "integer", (col) => col.defaultTo(0)).addColumn("unique", "integer", (col) => col.defaultTo(0)).addColumn("default_value", "text").addColumn("validation", "text").addColumn("widget", "text").addColumn("options", "text").addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addForeignKeyConstraint("fields_collection_fk", ["collection_id"], "_dineway_collections", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
83
83
|
await db.schema.createIndex("idx_fields_collection_slug").on("_dineway_fields").columns(["collection_id", "slug"]).unique().execute();
|
|
84
84
|
await db.schema.createIndex("idx_fields_collection").on("_dineway_fields").column("collection_id").execute();
|
|
85
85
|
await db.schema.createIndex("idx_fields_sort").on("_dineway_fields").columns(["collection_id", "sort_order"]).execute();
|
|
86
86
|
}
|
|
87
|
-
async function down$
|
|
87
|
+
async function down$42(db) {
|
|
88
88
|
await db.schema.dropTable("_dineway_fields").execute();
|
|
89
89
|
await db.schema.dropTable("_dineway_collections").execute();
|
|
90
90
|
}
|
|
@@ -92,8 +92,8 @@ async function down$41(db) {
|
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/database/migrations/004_plugins.ts
|
|
94
94
|
var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
95
|
-
down: () => down$
|
|
96
|
-
up: () => up$
|
|
95
|
+
down: () => down$41,
|
|
96
|
+
up: () => up$41
|
|
97
97
|
});
|
|
98
98
|
/**
|
|
99
99
|
* Migration: Plugin System Tables
|
|
@@ -103,7 +103,7 @@ var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
|
103
103
|
*
|
|
104
104
|
* @see PLUGIN-SYSTEM.md § Plugin Storage
|
|
105
105
|
*/
|
|
106
|
-
async function up$
|
|
106
|
+
async function up$41(db) {
|
|
107
107
|
await db.schema.createTable("_plugin_storage").addColumn("plugin_id", "text", (col) => col.notNull()).addColumn("collection", "text", (col) => col.notNull()).addColumn("id", "text", (col) => col.notNull()).addColumn("data", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("pk_plugin_storage", [
|
|
108
108
|
"plugin_id",
|
|
109
109
|
"collection",
|
|
@@ -121,7 +121,7 @@ async function up$40(db) {
|
|
|
121
121
|
"index_name"
|
|
122
122
|
]).execute();
|
|
123
123
|
}
|
|
124
|
-
async function down$
|
|
124
|
+
async function down$41(db) {
|
|
125
125
|
await db.schema.dropTable("_plugin_indexes").execute();
|
|
126
126
|
await db.schema.dropTable("_plugin_state").execute();
|
|
127
127
|
await db.schema.dropTable("_plugin_storage").execute();
|
|
@@ -130,8 +130,8 @@ async function down$40(db) {
|
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/database/migrations/005_menus.ts
|
|
132
132
|
var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
133
|
-
down: () => down$
|
|
134
|
-
up: () => up$
|
|
133
|
+
down: () => down$40,
|
|
134
|
+
up: () => up$40
|
|
135
135
|
});
|
|
136
136
|
/**
|
|
137
137
|
* Navigation Menus migration
|
|
@@ -139,13 +139,13 @@ var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
|
139
139
|
* Creates tables for admin-editable navigation menus.
|
|
140
140
|
* Menu items can reference content entries, taxonomy terms, or custom URLs.
|
|
141
141
|
*/
|
|
142
|
-
async function up$
|
|
142
|
+
async function up$40(db) {
|
|
143
143
|
await db.schema.createTable("_dineway_menus").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
144
144
|
await db.schema.createTable("_dineway_menu_items").addColumn("id", "text", (col) => col.primaryKey()).addColumn("menu_id", "text", (col) => col.notNull()).addColumn("parent_id", "text").addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("type", "text", (col) => col.notNull()).addColumn("reference_collection", "text").addColumn("reference_id", "text").addColumn("custom_url", "text").addColumn("label", "text", (col) => col.notNull()).addColumn("title_attr", "text").addColumn("target", "text").addColumn("css_classes", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addForeignKeyConstraint("menu_items_menu_fk", ["menu_id"], "_dineway_menus", ["id"], (cb) => cb.onDelete("cascade")).addForeignKeyConstraint("menu_items_parent_fk", ["parent_id"], "_dineway_menu_items", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
145
145
|
await db.schema.createIndex("idx_menu_items_menu").on("_dineway_menu_items").columns(["menu_id", "sort_order"]).execute();
|
|
146
146
|
await db.schema.createIndex("idx_menu_items_parent").on("_dineway_menu_items").column("parent_id").execute();
|
|
147
147
|
}
|
|
148
|
-
async function down$
|
|
148
|
+
async function down$40(db) {
|
|
149
149
|
await db.schema.dropTable("_dineway_menu_items").execute();
|
|
150
150
|
await db.schema.dropTable("_dineway_menus").execute();
|
|
151
151
|
}
|
|
@@ -153,8 +153,8 @@ async function down$39(db) {
|
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/database/migrations/006_taxonomy_defs.ts
|
|
155
155
|
var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
156
|
-
down: () => down$
|
|
157
|
-
up: () => up$
|
|
156
|
+
down: () => down$39,
|
|
157
|
+
up: () => up$39
|
|
158
158
|
});
|
|
159
159
|
/**
|
|
160
160
|
* Taxonomy definitions migration
|
|
@@ -162,7 +162,7 @@ var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
|
162
162
|
* Adds _dineway_taxonomy_defs table to store taxonomy definitions (category, tag, custom)
|
|
163
163
|
* and seeds default category and tag taxonomies.
|
|
164
164
|
*/
|
|
165
|
-
async function up$
|
|
165
|
+
async function up$39(db) {
|
|
166
166
|
await db.schema.createTable("_dineway_taxonomy_defs").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("label_singular", "text").addColumn("hierarchical", "integer", (col) => col.defaultTo(0)).addColumn("collections", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
167
167
|
await db.insertInto("_dineway_taxonomy_defs").values([{
|
|
168
168
|
id: "taxdef_category",
|
|
@@ -180,22 +180,22 @@ async function up$38(db) {
|
|
|
180
180
|
collections: JSON.stringify(["posts"])
|
|
181
181
|
}]).execute();
|
|
182
182
|
}
|
|
183
|
-
async function down$
|
|
183
|
+
async function down$39(db) {
|
|
184
184
|
await db.schema.dropTable("_dineway_taxonomy_defs").execute();
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
//#endregion
|
|
188
188
|
//#region src/database/migrations/007_widgets.ts
|
|
189
189
|
var _007_widgets_exports = /* @__PURE__ */ __exportAll({
|
|
190
|
-
down: () => down$
|
|
191
|
-
up: () => up$
|
|
190
|
+
down: () => down$38,
|
|
191
|
+
up: () => up$38
|
|
192
192
|
});
|
|
193
|
-
async function up$
|
|
193
|
+
async function up$38(db) {
|
|
194
194
|
await db.schema.createTable("_dineway_widget_areas").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
195
195
|
await db.schema.createTable("_dineway_widgets").addColumn("id", "text", (col) => col.primaryKey()).addColumn("area_id", "text", (col) => col.notNull().references("_dineway_widget_areas.id").onDelete("cascade")).addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("type", "text", (col) => col.notNull()).addColumn("title", "text").addColumn("content", "text").addColumn("menu_name", "text").addColumn("component_id", "text").addColumn("component_props", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
196
196
|
await db.schema.createIndex("idx_widgets_area").on("_dineway_widgets").columns(["area_id", "sort_order"]).execute();
|
|
197
197
|
}
|
|
198
|
-
async function down$
|
|
198
|
+
async function down$38(db) {
|
|
199
199
|
await db.schema.dropTable("_dineway_widgets").execute();
|
|
200
200
|
await db.schema.dropTable("_dineway_widget_areas").execute();
|
|
201
201
|
}
|
|
@@ -203,8 +203,8 @@ async function down$37(db) {
|
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/database/migrations/008_auth.ts
|
|
205
205
|
var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
206
|
-
down: () => down$
|
|
207
|
-
up: () => up$
|
|
206
|
+
down: () => down$37,
|
|
207
|
+
up: () => up$37
|
|
208
208
|
});
|
|
209
209
|
/**
|
|
210
210
|
* Auth migration - passkey-first authentication
|
|
@@ -218,7 +218,7 @@ var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
|
218
218
|
* - Creates oauth_accounts table (external provider links)
|
|
219
219
|
* - Creates allowed_domains table (self-signup)
|
|
220
220
|
*/
|
|
221
|
-
async function up$
|
|
221
|
+
async function up$37(db) {
|
|
222
222
|
await db.schema.createTable("users_new").addColumn("id", "text", (col) => col.primaryKey()).addColumn("email", "text", (col) => col.notNull().unique()).addColumn("name", "text").addColumn("avatar_url", "text").addColumn("role", "integer", (col) => col.notNull().defaultTo(10)).addColumn("email_verified", "integer", (col) => col.notNull().defaultTo(0)).addColumn("data", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
223
223
|
await sql`
|
|
224
224
|
INSERT INTO users_new (id, email, name, role, data, created_at, updated_at)
|
|
@@ -251,7 +251,7 @@ async function up$36(db) {
|
|
|
251
251
|
await db.schema.createTable("auth_challenges").addColumn("challenge", "text", (col) => col.primaryKey()).addColumn("type", "text", (col) => col.notNull()).addColumn("user_id", "text").addColumn("data", "text").addColumn("expires_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
252
252
|
await db.schema.createIndex("idx_auth_challenges_expires").on("auth_challenges").column("expires_at").execute();
|
|
253
253
|
}
|
|
254
|
-
async function down$
|
|
254
|
+
async function down$37(db) {
|
|
255
255
|
await db.schema.dropTable("auth_challenges").execute();
|
|
256
256
|
await db.schema.dropTable("allowed_domains").execute();
|
|
257
257
|
await db.schema.dropTable("oauth_accounts").execute();
|
|
@@ -284,8 +284,8 @@ async function down$36(db) {
|
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/database/migrations/009_user_disabled.ts
|
|
286
286
|
var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
287
|
-
down: () => down$
|
|
288
|
-
up: () => up$
|
|
287
|
+
down: () => down$36,
|
|
288
|
+
up: () => up$36
|
|
289
289
|
});
|
|
290
290
|
/**
|
|
291
291
|
* User disabled column - for soft-disabling users
|
|
@@ -294,19 +294,19 @@ var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
|
294
294
|
* - Adds disabled column to users table (INTEGER, default 0)
|
|
295
295
|
* - Disabled users cannot log in
|
|
296
296
|
*/
|
|
297
|
-
async function up$
|
|
297
|
+
async function up$36(db) {
|
|
298
298
|
await sql`ALTER TABLE users ADD COLUMN disabled INTEGER NOT NULL DEFAULT 0`.execute(db);
|
|
299
299
|
await db.schema.createIndex("idx_users_disabled").on("users").column("disabled").execute();
|
|
300
300
|
}
|
|
301
|
-
async function down$
|
|
301
|
+
async function down$36(db) {
|
|
302
302
|
await db.schema.dropIndex("idx_users_disabled").execute();
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
//#endregion
|
|
306
306
|
//#region src/database/migrations/011_sections.ts
|
|
307
307
|
var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
308
|
-
down: () => down$
|
|
309
|
-
up: () => up$
|
|
308
|
+
down: () => down$35,
|
|
309
|
+
up: () => up$35
|
|
310
310
|
});
|
|
311
311
|
/**
|
|
312
312
|
* Migration: Add sections tables and performance indexes
|
|
@@ -315,13 +315,13 @@ var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
|
315
315
|
* They provide a library of pre-built page sections (heroes, CTAs, testimonials, etc.)
|
|
316
316
|
* that content authors can browse and insert with a single click.
|
|
317
317
|
*/
|
|
318
|
-
async function up$
|
|
318
|
+
async function up$35(db) {
|
|
319
319
|
await db.schema.createTable("_dineway_section_categories").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
320
320
|
await db.schema.createTable("_dineway_sections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("title", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("category_id", "text", (col) => col.references("_dineway_section_categories.id").onDelete("set null")).addColumn("keywords", "text").addColumn("content", "text", (col) => col.notNull()).addColumn("preview_media_id", "text").addColumn("source", "text", (col) => col.notNull().defaultTo("user")).addColumn("theme_id", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).addColumn("updated_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
321
321
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
322
322
|
await db.schema.createIndex("idx_sections_source").on("_dineway_sections").columns(["source"]).execute();
|
|
323
323
|
}
|
|
324
|
-
async function down$
|
|
324
|
+
async function down$35(db) {
|
|
325
325
|
await db.schema.dropIndex("idx_sections_source").execute();
|
|
326
326
|
await db.schema.dropIndex("idx_sections_category").execute();
|
|
327
327
|
await db.schema.dropTable("_dineway_sections").execute();
|
|
@@ -331,8 +331,8 @@ async function down$34(db) {
|
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/database/migrations/012_search.ts
|
|
333
333
|
var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
334
|
-
down: () => down$
|
|
335
|
-
up: () => up$
|
|
334
|
+
down: () => down$34,
|
|
335
|
+
up: () => up$34
|
|
336
336
|
});
|
|
337
337
|
/**
|
|
338
338
|
* Migration: Search Support
|
|
@@ -340,11 +340,11 @@ var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
|
340
340
|
* Adds search configuration to collections and searchable flag to fields.
|
|
341
341
|
* FTS5 tables are created dynamically when search is enabled for a collection.
|
|
342
342
|
*/
|
|
343
|
-
async function up$
|
|
343
|
+
async function up$34(db) {
|
|
344
344
|
await db.schema.alterTable("_dineway_collections").addColumn("search_config", "text").execute();
|
|
345
345
|
await db.schema.alterTable("_dineway_fields").addColumn("searchable", "integer", (col) => col.defaultTo(0)).execute();
|
|
346
346
|
}
|
|
347
|
-
async function down$
|
|
347
|
+
async function down$34(db) {
|
|
348
348
|
await db.schema.alterTable("_dineway_fields").dropColumn("searchable").execute();
|
|
349
349
|
await db.schema.alterTable("_dineway_collections").dropColumn("search_config").execute();
|
|
350
350
|
}
|
|
@@ -352,8 +352,8 @@ async function down$33(db) {
|
|
|
352
352
|
//#endregion
|
|
353
353
|
//#region src/database/migrations/013_scheduled_publishing.ts
|
|
354
354
|
var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
355
|
-
down: () => down$
|
|
356
|
-
up: () => up$
|
|
355
|
+
down: () => down$33,
|
|
356
|
+
up: () => up$33
|
|
357
357
|
});
|
|
358
358
|
/**
|
|
359
359
|
* Migration: Add scheduled publishing support
|
|
@@ -362,7 +362,7 @@ var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
|
362
362
|
* When scheduled_at is set and status is 'scheduled', the content
|
|
363
363
|
* will be auto-published when the scheduled time is reached.
|
|
364
364
|
*/
|
|
365
|
-
async function up$
|
|
365
|
+
async function up$33(db) {
|
|
366
366
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
367
367
|
for (const tableName of tableNames) {
|
|
368
368
|
const table = { name: tableName };
|
|
@@ -377,7 +377,7 @@ async function up$32(db) {
|
|
|
377
377
|
`.execute(db);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
async function down$
|
|
380
|
+
async function down$33(db) {
|
|
381
381
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
382
382
|
for (const tableName of tableNames) {
|
|
383
383
|
const table = { name: tableName };
|
|
@@ -394,10 +394,10 @@ async function down$32(db) {
|
|
|
394
394
|
//#endregion
|
|
395
395
|
//#region src/database/migrations/014_draft_revisions.ts
|
|
396
396
|
var _014_draft_revisions_exports = /* @__PURE__ */ __exportAll({
|
|
397
|
-
down: () => down$
|
|
398
|
-
up: () => up$
|
|
397
|
+
down: () => down$32,
|
|
398
|
+
up: () => up$32
|
|
399
399
|
});
|
|
400
|
-
async function up$
|
|
400
|
+
async function up$32(db) {
|
|
401
401
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
402
402
|
for (const row of tables) {
|
|
403
403
|
const tableName = `ec_${row.slug}`;
|
|
@@ -419,7 +419,7 @@ async function up$31(db) {
|
|
|
419
419
|
`.execute(db);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
async function down$
|
|
422
|
+
async function down$32(db) {
|
|
423
423
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
424
424
|
for (const row of tables) {
|
|
425
425
|
const tableName = `ec_${row.slug}`;
|
|
@@ -443,8 +443,8 @@ async function down$31(db) {
|
|
|
443
443
|
//#endregion
|
|
444
444
|
//#region src/database/migrations/015_indexes.ts
|
|
445
445
|
var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
446
|
-
down: () => down$
|
|
447
|
-
up: () => up$
|
|
446
|
+
down: () => down$31,
|
|
447
|
+
up: () => up$31
|
|
448
448
|
});
|
|
449
449
|
/**
|
|
450
450
|
* Add performance indexes for common query patterns.
|
|
@@ -457,7 +457,7 @@ var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
457
457
|
* 5. Retroactive author_id + updated_at on existing ec_* content tables
|
|
458
458
|
* (new tables get these from createContentTable() in registry.ts)
|
|
459
459
|
*/
|
|
460
|
-
async function up$
|
|
460
|
+
async function up$31(db) {
|
|
461
461
|
await db.schema.createIndex("idx_media_mime_type").on("media").column("mime_type").execute();
|
|
462
462
|
await db.schema.createIndex("idx_media_filename").on("media").column("filename").execute();
|
|
463
463
|
await db.schema.createIndex("idx_media_created_at").on("media").column("created_at").execute();
|
|
@@ -477,7 +477,7 @@ async function up$30(db) {
|
|
|
477
477
|
`.execute(db);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
async function down$
|
|
480
|
+
async function down$31(db) {
|
|
481
481
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
482
482
|
for (const tableName of tableNames) {
|
|
483
483
|
const table = { name: tableName };
|
|
@@ -495,8 +495,8 @@ async function down$30(db) {
|
|
|
495
495
|
//#endregion
|
|
496
496
|
//#region src/database/migrations/016_api_tokens.ts
|
|
497
497
|
var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
498
|
-
down: () => down$
|
|
499
|
-
up: () => up$
|
|
498
|
+
down: () => down$30,
|
|
499
|
+
up: () => up$30
|
|
500
500
|
});
|
|
501
501
|
/**
|
|
502
502
|
* API token tables for programmatic access.
|
|
@@ -510,7 +510,7 @@ var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
|
510
510
|
* created only part of the schema before failing and never recorded the
|
|
511
511
|
* migration as applied.
|
|
512
512
|
*/
|
|
513
|
-
async function up$
|
|
513
|
+
async function up$30(db) {
|
|
514
514
|
await db.schema.createTable("_dineway_api_tokens").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("token_hash", "text", (col) => col.notNull().unique()).addColumn("prefix", "text", (col) => col.notNull()).addColumn("user_id", "text", (col) => col.notNull()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("expires_at", "text").addColumn("last_used_at", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addForeignKeyConstraint("api_tokens_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
515
515
|
await db.schema.createIndex("idx_api_tokens_token_hash").ifNotExists().on("_dineway_api_tokens").column("token_hash").execute();
|
|
516
516
|
await db.schema.createIndex("idx_api_tokens_user_id").ifNotExists().on("_dineway_api_tokens").column("user_id").execute();
|
|
@@ -519,7 +519,7 @@ async function up$29(db) {
|
|
|
519
519
|
await db.schema.createIndex("idx_oauth_tokens_expires").ifNotExists().on("_dineway_oauth_tokens").column("expires_at").execute();
|
|
520
520
|
await db.schema.createTable("_dineway_device_codes").ifNotExists().addColumn("device_code", "text", (col) => col.primaryKey()).addColumn("user_code", "text", (col) => col.notNull().unique()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("user_id", "text").addColumn("status", "text", (col) => col.notNull().defaultTo("pending")).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("interval", "integer", (col) => col.notNull().defaultTo(5)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
521
521
|
}
|
|
522
|
-
async function down$
|
|
522
|
+
async function down$30(db) {
|
|
523
523
|
await db.schema.dropTable("_dineway_device_codes").ifExists().execute();
|
|
524
524
|
await db.schema.dropTable("_dineway_oauth_tokens").ifExists().execute();
|
|
525
525
|
await db.schema.dropTable("_dineway_api_tokens").ifExists().execute();
|
|
@@ -528,8 +528,8 @@ async function down$29(db) {
|
|
|
528
528
|
//#endregion
|
|
529
529
|
//#region src/database/migrations/017_authorization_codes.ts
|
|
530
530
|
var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
531
|
-
down: () => down$
|
|
532
|
-
up: () => up$
|
|
531
|
+
down: () => down$29,
|
|
532
|
+
up: () => up$29
|
|
533
533
|
});
|
|
534
534
|
/**
|
|
535
535
|
* Authorization codes for OAuth 2.1 Authorization Code + PKCE flow.
|
|
@@ -539,20 +539,20 @@ var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
|
539
539
|
*
|
|
540
540
|
* Also adds client_id tracking to oauth_tokens for per-client revocation.
|
|
541
541
|
*/
|
|
542
|
-
async function up$
|
|
542
|
+
async function up$29(db) {
|
|
543
543
|
await db.schema.createTable("_dineway_authorization_codes").addColumn("code_hash", "text", (col) => col.primaryKey()).addColumn("client_id", "text", (col) => col.notNull()).addColumn("redirect_uri", "text", (col) => col.notNull()).addColumn("user_id", "text", (col) => col.notNull()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("code_challenge", "text", (col) => col.notNull()).addColumn("code_challenge_method", "text", (col) => col.notNull().defaultTo("S256")).addColumn("resource", "text").addColumn("expires_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addForeignKeyConstraint("auth_codes_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
544
544
|
await db.schema.createIndex("idx_auth_codes_expires").on("_dineway_authorization_codes").column("expires_at").execute();
|
|
545
545
|
await sql`ALTER TABLE _dineway_oauth_tokens ADD COLUMN client_id TEXT`.execute(db);
|
|
546
546
|
}
|
|
547
|
-
async function down$
|
|
547
|
+
async function down$29(db) {
|
|
548
548
|
await db.schema.dropTable("_dineway_authorization_codes").execute();
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
//#endregion
|
|
552
552
|
//#region src/database/migrations/018_seo.ts
|
|
553
553
|
var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
554
|
-
down: () => down$
|
|
555
|
-
up: () => up$
|
|
554
|
+
down: () => down$28,
|
|
555
|
+
up: () => up$28
|
|
556
556
|
});
|
|
557
557
|
/**
|
|
558
558
|
* Migration: SEO support
|
|
@@ -565,7 +565,7 @@ var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
|
565
565
|
* need it. The `has_seo` flag controls whether the admin shows SEO fields
|
|
566
566
|
* and whether the collection's content appears in sitemaps.
|
|
567
567
|
*/
|
|
568
|
-
async function up$
|
|
568
|
+
async function up$28(db) {
|
|
569
569
|
await db.schema.createTable("_dineway_seo").addColumn("collection", "text", (col) => col.notNull()).addColumn("content_id", "text", (col) => col.notNull()).addColumn("seo_title", "text").addColumn("seo_description", "text").addColumn("seo_image", "text").addColumn("seo_canonical", "text").addColumn("seo_no_index", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("_dineway_seo_pk", ["collection", "content_id"]).execute();
|
|
570
570
|
await sql`
|
|
571
571
|
CREATE INDEX idx_dineway_seo_collection
|
|
@@ -576,7 +576,7 @@ async function up$27(db) {
|
|
|
576
576
|
ADD COLUMN has_seo INTEGER NOT NULL DEFAULT 0
|
|
577
577
|
`.execute(db);
|
|
578
578
|
}
|
|
579
|
-
async function down$
|
|
579
|
+
async function down$28(db) {
|
|
580
580
|
await sql`DROP TABLE IF EXISTS _dineway_seo`.execute(db);
|
|
581
581
|
await sql`
|
|
582
582
|
ALTER TABLE _dineway_collections
|
|
@@ -587,8 +587,8 @@ async function down$27(db) {
|
|
|
587
587
|
//#endregion
|
|
588
588
|
//#region src/database/migrations/019_i18n.ts
|
|
589
589
|
var _019_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
590
|
-
down: () => down$
|
|
591
|
-
up: () => up$
|
|
590
|
+
down: () => down$27,
|
|
591
|
+
up: () => up$27
|
|
592
592
|
});
|
|
593
593
|
/**
|
|
594
594
|
* Quote an identifier for use in raw SQL. Escapes embedded double-quotes
|
|
@@ -701,7 +701,7 @@ async function upPostgres(db) {
|
|
|
701
701
|
ADD COLUMN translatable INTEGER NOT NULL DEFAULT 1
|
|
702
702
|
`.execute(db);
|
|
703
703
|
}
|
|
704
|
-
async function up$
|
|
704
|
+
async function up$27(db) {
|
|
705
705
|
if (!isSqlite(db)) return upPostgres(db);
|
|
706
706
|
const orphanedTmps = await listTablesLike(db, "ec_%_i18n_tmp");
|
|
707
707
|
for (const tmpName of orphanedTmps) {
|
|
@@ -818,7 +818,7 @@ async function downPostgres(db) {
|
|
|
818
818
|
await sql`ALTER TABLE ${sql.ref(t)} DROP COLUMN translation_group`.execute(db);
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
async function down$
|
|
821
|
+
async function down$27(db) {
|
|
822
822
|
if (!isSqlite(db)) return downPostgres(db);
|
|
823
823
|
await sql`
|
|
824
824
|
ALTER TABLE _dineway_fields
|
|
@@ -925,8 +925,8 @@ async function down$26(db) {
|
|
|
925
925
|
//#endregion
|
|
926
926
|
//#region src/database/migrations/020_collection_url_pattern.ts
|
|
927
927
|
var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
928
|
-
down: () => down$
|
|
929
|
-
up: () => up$
|
|
928
|
+
down: () => down$26,
|
|
929
|
+
up: () => up$26
|
|
930
930
|
});
|
|
931
931
|
/**
|
|
932
932
|
* Migration: URL pattern for collections
|
|
@@ -935,13 +935,13 @@ var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
935
935
|
* can declare its own URL structure (e.g. "/{slug}" for pages, "/blog/{slug}"
|
|
936
936
|
* for posts). Used for menu URL resolution, sitemaps, and path-based lookups.
|
|
937
937
|
*/
|
|
938
|
-
async function up$
|
|
938
|
+
async function up$26(db) {
|
|
939
939
|
await sql`
|
|
940
940
|
ALTER TABLE _dineway_collections
|
|
941
941
|
ADD COLUMN url_pattern TEXT
|
|
942
942
|
`.execute(db);
|
|
943
943
|
}
|
|
944
|
-
async function down$
|
|
944
|
+
async function down$26(db) {
|
|
945
945
|
await sql`
|
|
946
946
|
ALTER TABLE _dineway_collections
|
|
947
947
|
DROP COLUMN url_pattern
|
|
@@ -951,8 +951,8 @@ async function down$25(db) {
|
|
|
951
951
|
//#endregion
|
|
952
952
|
//#region src/database/migrations/021_remove_section_categories.ts
|
|
953
953
|
var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
954
|
-
down: () => down$
|
|
955
|
-
up: () => up$
|
|
954
|
+
down: () => down$25,
|
|
955
|
+
up: () => up$25
|
|
956
956
|
});
|
|
957
957
|
/**
|
|
958
958
|
* Migration: Remove section categories
|
|
@@ -961,12 +961,12 @@ var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
|
961
961
|
* Rather than building the missing UI for a feature with very little need at this stage,
|
|
962
962
|
* we're removing the feature entirely.
|
|
963
963
|
*/
|
|
964
|
-
async function up$
|
|
964
|
+
async function up$25(db) {
|
|
965
965
|
await db.schema.dropIndex("idx_sections_category").ifExists().execute();
|
|
966
966
|
await db.schema.alterTable("_dineway_sections").dropColumn("category_id").execute();
|
|
967
967
|
await db.schema.dropTable("_dineway_section_categories").execute();
|
|
968
968
|
}
|
|
969
|
-
async function down$
|
|
969
|
+
async function down$25(db) {
|
|
970
970
|
await db.schema.createTable("_dineway_section_categories").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
971
971
|
await db.schema.alterTable("_dineway_sections").addColumn("category_id", "text", (col) => col.references("_dineway_section_categories.id").onDelete("set null")).execute();
|
|
972
972
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
@@ -975,8 +975,8 @@ async function down$24(db) {
|
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region src/database/migrations/022_marketplace_plugin_state.ts
|
|
977
977
|
var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
978
|
-
down: () => down$
|
|
979
|
-
up: () => up$
|
|
978
|
+
down: () => down$24,
|
|
979
|
+
up: () => up$24
|
|
980
980
|
});
|
|
981
981
|
/**
|
|
982
982
|
* Migration: Add marketplace fields to _plugin_state
|
|
@@ -985,7 +985,7 @@ var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
|
985
985
|
* whether a plugin was installed from config or marketplace,
|
|
986
986
|
* and which marketplace version is installed.
|
|
987
987
|
*/
|
|
988
|
-
async function up$
|
|
988
|
+
async function up$24(db) {
|
|
989
989
|
await sql`
|
|
990
990
|
ALTER TABLE _plugin_state
|
|
991
991
|
ADD COLUMN source TEXT NOT NULL DEFAULT 'config'
|
|
@@ -1000,7 +1000,7 @@ async function up$23(db) {
|
|
|
1000
1000
|
WHERE source = 'marketplace'
|
|
1001
1001
|
`.execute(db);
|
|
1002
1002
|
}
|
|
1003
|
-
async function down$
|
|
1003
|
+
async function down$24(db) {
|
|
1004
1004
|
await sql`
|
|
1005
1005
|
DROP INDEX IF EXISTS idx_plugin_state_source
|
|
1006
1006
|
`.execute(db);
|
|
@@ -1017,8 +1017,8 @@ async function down$23(db) {
|
|
|
1017
1017
|
//#endregion
|
|
1018
1018
|
//#region src/database/migrations/023_plugin_metadata.ts
|
|
1019
1019
|
var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
1020
|
-
down: () => down$
|
|
1021
|
-
up: () => up$
|
|
1020
|
+
down: () => down$23,
|
|
1021
|
+
up: () => up$23
|
|
1022
1022
|
});
|
|
1023
1023
|
/**
|
|
1024
1024
|
* Migration: Add display metadata to _plugin_state
|
|
@@ -1027,7 +1027,7 @@ var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
|
1027
1027
|
* so the admin UI can show meaningful info without re-fetching
|
|
1028
1028
|
* from the marketplace on every page load.
|
|
1029
1029
|
*/
|
|
1030
|
-
async function up$
|
|
1030
|
+
async function up$23(db) {
|
|
1031
1031
|
await sql`
|
|
1032
1032
|
ALTER TABLE _plugin_state
|
|
1033
1033
|
ADD COLUMN display_name TEXT
|
|
@@ -1037,7 +1037,7 @@ async function up$22(db) {
|
|
|
1037
1037
|
ADD COLUMN description TEXT
|
|
1038
1038
|
`.execute(db);
|
|
1039
1039
|
}
|
|
1040
|
-
async function down$
|
|
1040
|
+
async function down$23(db) {
|
|
1041
1041
|
await sql`
|
|
1042
1042
|
ALTER TABLE _plugin_state
|
|
1043
1043
|
DROP COLUMN description
|
|
@@ -1051,8 +1051,8 @@ async function down$22(db) {
|
|
|
1051
1051
|
//#endregion
|
|
1052
1052
|
//#region src/database/migrations/024_media_placeholders.ts
|
|
1053
1053
|
var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
1054
|
-
down: () => down$
|
|
1055
|
-
up: () => up$
|
|
1054
|
+
down: () => down$22,
|
|
1055
|
+
up: () => up$22
|
|
1056
1056
|
});
|
|
1057
1057
|
/**
|
|
1058
1058
|
* Migration: Add placeholder columns to media table
|
|
@@ -1060,7 +1060,7 @@ var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
|
1060
1060
|
* Stores blurhash and dominant_color for LQIP (Low Quality Image Placeholder)
|
|
1061
1061
|
* support. Generated at upload time from image pixel data.
|
|
1062
1062
|
*/
|
|
1063
|
-
async function up$
|
|
1063
|
+
async function up$22(db) {
|
|
1064
1064
|
await sql`
|
|
1065
1065
|
ALTER TABLE media
|
|
1066
1066
|
ADD COLUMN blurhash TEXT
|
|
@@ -1070,7 +1070,7 @@ async function up$21(db) {
|
|
|
1070
1070
|
ADD COLUMN dominant_color TEXT
|
|
1071
1071
|
`.execute(db);
|
|
1072
1072
|
}
|
|
1073
|
-
async function down$
|
|
1073
|
+
async function down$22(db) {
|
|
1074
1074
|
await sql`
|
|
1075
1075
|
ALTER TABLE media
|
|
1076
1076
|
DROP COLUMN dominant_color
|
|
@@ -1084,8 +1084,8 @@ async function down$21(db) {
|
|
|
1084
1084
|
//#endregion
|
|
1085
1085
|
//#region src/database/migrations/025_oauth_clients.ts
|
|
1086
1086
|
var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
1087
|
-
down: () => down$
|
|
1088
|
-
up: () => up$
|
|
1087
|
+
down: () => down$21,
|
|
1088
|
+
up: () => up$21
|
|
1089
1089
|
});
|
|
1090
1090
|
/**
|
|
1091
1091
|
* Migration: Create OAuth clients table
|
|
@@ -1096,18 +1096,18 @@ var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
|
1096
1096
|
* Each client has a set of pre-registered redirect URIs (JSON array).
|
|
1097
1097
|
* The authorize endpoint rejects any redirect_uri not in the client's list.
|
|
1098
1098
|
*/
|
|
1099
|
-
async function up$
|
|
1099
|
+
async function up$21(db) {
|
|
1100
1100
|
await db.schema.createTable("_dineway_oauth_clients").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("redirect_uris", "text", (col) => col.notNull()).addColumn("scopes", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1101
1101
|
}
|
|
1102
|
-
async function down$
|
|
1102
|
+
async function down$21(db) {
|
|
1103
1103
|
await db.schema.dropTable("_dineway_oauth_clients").execute();
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
//#endregion
|
|
1107
1107
|
//#region src/database/migrations/026_cron_tasks.ts
|
|
1108
1108
|
var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
1109
|
-
down: () => down$
|
|
1110
|
-
up: () => up$
|
|
1109
|
+
down: () => down$20,
|
|
1110
|
+
up: () => up$20
|
|
1111
1111
|
});
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Migration: Create cron tasks table for plugin scheduled tasks.
|
|
@@ -1118,7 +1118,7 @@ var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
|
1118
1118
|
* The `next_run_at` + `status` + `enabled` index drives the "find overdue
|
|
1119
1119
|
* tasks" query used by CronExecutor.tick().
|
|
1120
1120
|
*/
|
|
1121
|
-
async function up$
|
|
1121
|
+
async function up$20(db) {
|
|
1122
1122
|
await db.schema.createTable("_dineway_cron_tasks").addColumn("id", "text", (col) => col.primaryKey()).addColumn("plugin_id", "text", (col) => col.notNull()).addColumn("task_name", "text", (col) => col.notNull()).addColumn("schedule", "text", (col) => col.notNull()).addColumn("is_oneshot", "integer", (col) => col.notNull().defaultTo(0)).addColumn("data", "text").addColumn("next_run_at", "text", (col) => col.notNull()).addColumn("last_run_at", "text").addColumn("status", "text", (col) => col.notNull().defaultTo("idle")).addColumn("locked_at", "text").addColumn("enabled", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addUniqueConstraint("uq_cron_tasks_plugin_task", ["plugin_id", "task_name"]).execute();
|
|
1123
1123
|
await db.schema.createIndex("idx_cron_tasks_due").on("_dineway_cron_tasks").columns([
|
|
1124
1124
|
"enabled",
|
|
@@ -1127,17 +1127,17 @@ async function up$19(db) {
|
|
|
1127
1127
|
]).execute();
|
|
1128
1128
|
await db.schema.createIndex("idx_cron_tasks_plugin").on("_dineway_cron_tasks").column("plugin_id").execute();
|
|
1129
1129
|
}
|
|
1130
|
-
async function down$
|
|
1130
|
+
async function down$20(db) {
|
|
1131
1131
|
await db.schema.dropTable("_dineway_cron_tasks").execute();
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
1134
|
//#endregion
|
|
1135
1135
|
//#region src/database/migrations/027_comments.ts
|
|
1136
1136
|
var _027_comments_exports = /* @__PURE__ */ __exportAll({
|
|
1137
|
-
down: () => down$
|
|
1138
|
-
up: () => up$
|
|
1137
|
+
down: () => down$19,
|
|
1138
|
+
up: () => up$19
|
|
1139
1139
|
});
|
|
1140
|
-
async function up$
|
|
1140
|
+
async function up$19(db) {
|
|
1141
1141
|
await db.schema.createTable("_dineway_comments").addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection", "text", (col) => col.notNull()).addColumn("content_id", "text", (col) => col.notNull()).addColumn("parent_id", "text", (col) => col.references("_dineway_comments.id").onDelete("cascade")).addColumn("author_name", "text", (col) => col.notNull()).addColumn("author_email", "text", (col) => col.notNull()).addColumn("author_url", "text").addColumn("author_user_id", "text", (col) => col.references("users.id").onDelete("set null")).addColumn("body", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().defaultTo("pending")).addColumn("ip_hash", "text").addColumn("user_agent", "text").addColumn("moderation_metadata", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1142
1142
|
await db.schema.createIndex("idx_comments_content").on("_dineway_comments").columns([
|
|
1143
1143
|
"collection",
|
|
@@ -1153,30 +1153,30 @@ async function up$18(db) {
|
|
|
1153
1153
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_closed_after_days", "integer", (col) => col.defaultTo(90)).execute();
|
|
1154
1154
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_auto_approve_users", "integer", (col) => col.defaultTo(1)).execute();
|
|
1155
1155
|
}
|
|
1156
|
-
async function down$
|
|
1156
|
+
async function down$19(db) {
|
|
1157
1157
|
await db.schema.dropTable("_dineway_comments").execute();
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
1160
|
//#endregion
|
|
1161
1161
|
//#region src/database/migrations/028_drop_author_url.ts
|
|
1162
1162
|
var _028_drop_author_url_exports = /* @__PURE__ */ __exportAll({
|
|
1163
|
-
down: () => down$
|
|
1164
|
-
up: () => up$
|
|
1163
|
+
down: () => down$18,
|
|
1164
|
+
up: () => up$18
|
|
1165
1165
|
});
|
|
1166
|
-
async function up$
|
|
1166
|
+
async function up$18(db) {
|
|
1167
1167
|
await sql`ALTER TABLE _dineway_comments DROP COLUMN author_url`.execute(db);
|
|
1168
1168
|
}
|
|
1169
|
-
async function down$
|
|
1169
|
+
async function down$18(db) {
|
|
1170
1170
|
await db.schema.alterTable("_dineway_comments").addColumn("author_url", "text").execute();
|
|
1171
1171
|
}
|
|
1172
1172
|
|
|
1173
1173
|
//#endregion
|
|
1174
1174
|
//#region src/database/migrations/029_redirects.ts
|
|
1175
1175
|
var _029_redirects_exports = /* @__PURE__ */ __exportAll({
|
|
1176
|
-
down: () => down$
|
|
1177
|
-
up: () => up$
|
|
1176
|
+
down: () => down$17,
|
|
1177
|
+
up: () => up$17
|
|
1178
1178
|
});
|
|
1179
|
-
async function up$
|
|
1179
|
+
async function up$17(db) {
|
|
1180
1180
|
await db.schema.createTable("_dineway_redirects").addColumn("id", "text", (col) => col.primaryKey()).addColumn("source", "text", (col) => col.notNull()).addColumn("destination", "text", (col) => col.notNull()).addColumn("type", "integer", (col) => col.notNull().defaultTo(301)).addColumn("is_pattern", "integer", (col) => col.notNull().defaultTo(0)).addColumn("enabled", "integer", (col) => col.notNull().defaultTo(1)).addColumn("hits", "integer", (col) => col.notNull().defaultTo(0)).addColumn("last_hit_at", "text").addColumn("group_name", "text").addColumn("auto", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1181
1181
|
await db.schema.createIndex("idx_redirects_source").on("_dineway_redirects").column("source").execute();
|
|
1182
1182
|
await db.schema.createIndex("idx_redirects_enabled").on("_dineway_redirects").column("enabled").execute();
|
|
@@ -1185,7 +1185,7 @@ async function up$16(db) {
|
|
|
1185
1185
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
1186
1186
|
await db.schema.createIndex("idx_404_log_created").on("_dineway_404_log").column("created_at").execute();
|
|
1187
1187
|
}
|
|
1188
|
-
async function down$
|
|
1188
|
+
async function down$17(db) {
|
|
1189
1189
|
await db.schema.dropTable("_dineway_404_log").execute();
|
|
1190
1190
|
await db.schema.dropTable("_dineway_redirects").execute();
|
|
1191
1191
|
}
|
|
@@ -1193,8 +1193,8 @@ async function down$16(db) {
|
|
|
1193
1193
|
//#endregion
|
|
1194
1194
|
//#region src/database/migrations/030_widen_scheduled_index.ts
|
|
1195
1195
|
var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
1196
|
-
down: () => down$
|
|
1197
|
-
up: () => up$
|
|
1196
|
+
down: () => down$16,
|
|
1197
|
+
up: () => up$16
|
|
1198
1198
|
});
|
|
1199
1199
|
/**
|
|
1200
1200
|
* Migration: Widen scheduled publishing index
|
|
@@ -1203,7 +1203,7 @@ var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
1203
1203
|
* Published posts can now have scheduled draft changes, so widen the
|
|
1204
1204
|
* index to cover all rows where scheduled_at IS NOT NULL.
|
|
1205
1205
|
*/
|
|
1206
|
-
async function up$
|
|
1206
|
+
async function up$16(db) {
|
|
1207
1207
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1208
1208
|
for (const tableName of tableNames) {
|
|
1209
1209
|
const table = { name: tableName };
|
|
@@ -1217,7 +1217,7 @@ async function up$15(db) {
|
|
|
1217
1217
|
`.execute(db);
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
|
-
async function down$
|
|
1220
|
+
async function down$16(db) {
|
|
1221
1221
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1222
1222
|
for (const tableName of tableNames) {
|
|
1223
1223
|
const table = { name: tableName };
|
|
@@ -1235,10 +1235,10 @@ async function down$15(db) {
|
|
|
1235
1235
|
//#endregion
|
|
1236
1236
|
//#region src/database/migrations/031_bylines.ts
|
|
1237
1237
|
var _031_bylines_exports = /* @__PURE__ */ __exportAll({
|
|
1238
|
-
down: () => down$
|
|
1239
|
-
up: () => up$
|
|
1238
|
+
down: () => down$15,
|
|
1239
|
+
up: () => up$15
|
|
1240
1240
|
});
|
|
1241
|
-
async function up$
|
|
1241
|
+
async function up$15(db) {
|
|
1242
1242
|
await db.schema.createTable("_dineway_bylines").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("display_name", "text", (col) => col.notNull()).addColumn("bio", "text").addColumn("avatar_media_id", "text", (col) => col.references("media.id").onDelete("set null")).addColumn("website_url", "text").addColumn("user_id", "text", (col) => col.references("users.id").onDelete("set null")).addColumn("is_guest", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1243
1243
|
await sql`
|
|
1244
1244
|
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_user_id_unique")}
|
|
@@ -1270,7 +1270,7 @@ async function up$14(db) {
|
|
|
1270
1270
|
`.execute(db);
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
|
-
async function down$
|
|
1273
|
+
async function down$15(db) {
|
|
1274
1274
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1275
1275
|
for (const tableName of tableNames) {
|
|
1276
1276
|
await sql`
|
|
@@ -1288,8 +1288,8 @@ async function down$14(db) {
|
|
|
1288
1288
|
//#endregion
|
|
1289
1289
|
//#region src/database/migrations/032_rate_limits.ts
|
|
1290
1290
|
var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
1291
|
-
down: () => down$
|
|
1292
|
-
up: () => up$
|
|
1291
|
+
down: () => down$14,
|
|
1292
|
+
up: () => up$14
|
|
1293
1293
|
});
|
|
1294
1294
|
/**
|
|
1295
1295
|
* Migration: Rate limits table + device code polling tracking.
|
|
@@ -1300,12 +1300,12 @@ var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
|
1300
1300
|
* 2. Add last_polled_at column to _dineway_device_codes for
|
|
1301
1301
|
* RFC 8628 slow_down enforcement.
|
|
1302
1302
|
*/
|
|
1303
|
-
async function up$
|
|
1303
|
+
async function up$14(db) {
|
|
1304
1304
|
await db.schema.createTable("_dineway_rate_limits").addColumn("key", "text", (col) => col.notNull()).addColumn("window", "text", (col) => col.notNull()).addColumn("count", "integer", (col) => col.notNull().defaultTo(1)).addPrimaryKeyConstraint("pk_rate_limits", ["key", "window"]).execute();
|
|
1305
1305
|
await db.schema.createIndex("idx_rate_limits_window").on("_dineway_rate_limits").column("window").execute();
|
|
1306
1306
|
await db.schema.alterTable("_dineway_device_codes").addColumn("last_polled_at", "text").execute();
|
|
1307
1307
|
}
|
|
1308
|
-
async function down$
|
|
1308
|
+
async function down$14(db) {
|
|
1309
1309
|
await db.schema.dropTable("_dineway_rate_limits").execute();
|
|
1310
1310
|
await db.schema.alterTable("_dineway_device_codes").dropColumn("last_polled_at").execute();
|
|
1311
1311
|
}
|
|
@@ -1313,8 +1313,8 @@ async function down$13(db) {
|
|
|
1313
1313
|
//#endregion
|
|
1314
1314
|
//#region src/database/migrations/033_optimize_content_indexes.ts
|
|
1315
1315
|
var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
1316
|
-
down: () => down$
|
|
1317
|
-
up: () => up$
|
|
1316
|
+
down: () => down$13,
|
|
1317
|
+
up: () => up$13
|
|
1318
1318
|
});
|
|
1319
1319
|
/**
|
|
1320
1320
|
* Migration: Optimize content table indexes for SQLite-compatible performance
|
|
@@ -1327,7 +1327,7 @@ var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
1327
1327
|
*
|
|
1328
1328
|
* Impact: Reduces row reads by 90%+ for admin panel operations on SQLite-compatible adapters.
|
|
1329
1329
|
*/
|
|
1330
|
-
async function up$
|
|
1330
|
+
async function up$13(db) {
|
|
1331
1331
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1332
1332
|
for (const tableName of tableNames) {
|
|
1333
1333
|
const table = { name: tableName };
|
|
@@ -1369,7 +1369,7 @@ async function up$12(db) {
|
|
|
1369
1369
|
WHERE status = 'trash'
|
|
1370
1370
|
`.execute(db);
|
|
1371
1371
|
}
|
|
1372
|
-
async function down$
|
|
1372
|
+
async function down$13(db) {
|
|
1373
1373
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1374
1374
|
for (const tableName of tableNames) {
|
|
1375
1375
|
const table = { name: tableName };
|
|
@@ -1402,10 +1402,10 @@ async function down$12(db) {
|
|
|
1402
1402
|
//#endregion
|
|
1403
1403
|
//#region src/database/migrations/034_published_at_index.ts
|
|
1404
1404
|
var _034_published_at_index_exports = /* @__PURE__ */ __exportAll({
|
|
1405
|
-
down: () => down$
|
|
1406
|
-
up: () => up$
|
|
1405
|
+
down: () => down$12,
|
|
1406
|
+
up: () => up$12
|
|
1407
1407
|
});
|
|
1408
|
-
async function up$
|
|
1408
|
+
async function up$12(db) {
|
|
1409
1409
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1410
1410
|
for (const tableName of tableNames) {
|
|
1411
1411
|
const table = { name: tableName };
|
|
@@ -1415,7 +1415,7 @@ async function up$11(db) {
|
|
|
1415
1415
|
`.execute(db);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
async function down$
|
|
1418
|
+
async function down$12(db) {
|
|
1419
1419
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1420
1420
|
for (const tableName of tableNames) {
|
|
1421
1421
|
const table = { name: tableName };
|
|
@@ -1426,15 +1426,15 @@ async function down$11(db) {
|
|
|
1426
1426
|
//#endregion
|
|
1427
1427
|
//#region src/database/migrations/035_backfill_url_patterns.ts
|
|
1428
1428
|
var _035_backfill_url_patterns_exports = /* @__PURE__ */ __exportAll({
|
|
1429
|
-
down: () => down$
|
|
1430
|
-
up: () => up$
|
|
1429
|
+
down: () => down$11,
|
|
1430
|
+
up: () => up$11
|
|
1431
1431
|
});
|
|
1432
1432
|
/**
|
|
1433
1433
|
* Backfill default URL patterns for the built-in posts and pages collections.
|
|
1434
1434
|
*
|
|
1435
1435
|
* Existing rows keep custom patterns; only missing defaults are filled.
|
|
1436
1436
|
*/
|
|
1437
|
-
async function up$
|
|
1437
|
+
async function up$11(db) {
|
|
1438
1438
|
await sql`
|
|
1439
1439
|
UPDATE _dineway_collections
|
|
1440
1440
|
SET url_pattern = '/posts/{slug}'
|
|
@@ -1446,7 +1446,7 @@ async function up$10(db) {
|
|
|
1446
1446
|
WHERE slug = 'pages' AND url_pattern IS NULL
|
|
1447
1447
|
`.execute(db);
|
|
1448
1448
|
}
|
|
1449
|
-
async function down$
|
|
1449
|
+
async function down$11(db) {
|
|
1450
1450
|
await sql`
|
|
1451
1451
|
UPDATE _dineway_collections
|
|
1452
1452
|
SET url_pattern = NULL
|
|
@@ -1462,8 +1462,8 @@ async function down$10(db) {
|
|
|
1462
1462
|
//#endregion
|
|
1463
1463
|
//#region src/database/migrations/036_activity_log.ts
|
|
1464
1464
|
var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
1465
|
-
down: () => down$
|
|
1466
|
-
up: () => up$
|
|
1465
|
+
down: () => down$10,
|
|
1466
|
+
up: () => up$10
|
|
1467
1467
|
});
|
|
1468
1468
|
/**
|
|
1469
1469
|
* Site Context Engine activity foundation.
|
|
@@ -1472,7 +1472,7 @@ var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1472
1472
|
* not a request log. Actor IDs intentionally have no foreign key because the
|
|
1473
1473
|
* actor source can be users, API tokens, or a stable system actor.
|
|
1474
1474
|
*/
|
|
1475
|
-
async function up$
|
|
1475
|
+
async function up$10(db) {
|
|
1476
1476
|
await db.schema.createTable("_dineway_activity_log").addColumn("id", "text", (col) => col.primaryKey()).addColumn("actor_type", "text", (col) => col.notNull().check(sql`actor_type in ('user', 'api_token', 'system')`)).addColumn("actor_id", "text", (col) => col.notNull()).addColumn("auth_metadata", "text").addColumn("action_type", "text", (col) => col.notNull()).addColumn("subject_type", "text", (col) => col.notNull()).addColumn("subject_id", "text").addColumn("related_subject_type", "text").addColumn("related_subject_id", "text").addColumn("source_type", "text", (col) => col.check(sql`source_type is null or source_type in ('api_route', 'mcp_tool', 'system', 'plugin', 'unknown')`)).addColumn("source_name", "text").addColumn("result_status", "text", (col) => col.notNull().defaultTo("succeeded").check(sql`result_status in ('succeeded', 'pending', 'failed', 'blocked')`)).addColumn("scope", "text", (col) => col.notNull()).addColumn("summary", "text", (col) => col.notNull()).addColumn("detail", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).execute();
|
|
1477
1477
|
await db.schema.createIndex("idx_dineway_activity_actor").on("_dineway_activity_log").columns([
|
|
1478
1478
|
"actor_type",
|
|
@@ -1499,15 +1499,15 @@ async function up$9(db) {
|
|
|
1499
1499
|
await db.schema.createIndex("idx_dineway_activity_result_status").on("_dineway_activity_log").columns(["result_status", "created_at"]).execute();
|
|
1500
1500
|
await db.schema.createIndex("idx_dineway_activity_created_at").on("_dineway_activity_log").column("created_at").execute();
|
|
1501
1501
|
}
|
|
1502
|
-
async function down$
|
|
1502
|
+
async function down$10(db) {
|
|
1503
1503
|
await db.schema.dropTable("_dineway_activity_log").execute();
|
|
1504
1504
|
}
|
|
1505
1505
|
|
|
1506
1506
|
//#endregion
|
|
1507
1507
|
//#region src/database/migrations/037_context_entries.ts
|
|
1508
1508
|
var _037_context_entries_exports = /* @__PURE__ */ __exportAll({
|
|
1509
|
-
down: () => down$
|
|
1510
|
-
up: () => up$
|
|
1509
|
+
down: () => down$9,
|
|
1510
|
+
up: () => up$9
|
|
1511
1511
|
});
|
|
1512
1512
|
const CONTEXT_TYPE_SQL = [
|
|
1513
1513
|
"brand_voice",
|
|
@@ -1532,7 +1532,7 @@ const CONTEXT_TYPE_SQL = [
|
|
|
1532
1532
|
* marking old entries non-current and linking replacements through
|
|
1533
1533
|
* `supersedes_id`.
|
|
1534
1534
|
*/
|
|
1535
|
-
async function up$
|
|
1535
|
+
async function up$9(db) {
|
|
1536
1536
|
await db.schema.createTable("_dineway_context_entries").addColumn("id", "text", (col) => col.primaryKey()).addColumn("scope", "text", (col) => col.notNull()).addColumn("context_type", "text", (col) => col.notNull().check(sql`context_type in (${sql.raw(CONTEXT_TYPE_SQL)})`)).addColumn("title", "text", (col) => col.notNull()).addColumn("body", "text", (col) => col.notNull()).addColumn("policy_key", "text").addColumn("source_activity_id", "text").addColumn("created_by_actor_type", "text", (col) => col.notNull().check(sql`created_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("created_by_actor_id", "text", (col) => col.notNull()).addColumn("created_auth_metadata", "text").addColumn("supersedes_id", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("is_current", "integer", (col) => col.notNull().defaultTo(1).check(sql`is_current in (0, 1)`)).addColumn("valid_until", "text").addColumn("reviewed_at", "text").addColumn("reviewed_by_actor_type", "text", (col) => col.check(sql`reviewed_by_actor_type is null or reviewed_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("reviewed_by_actor_id", "text").addColumn("review_note", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addForeignKeyConstraint("fk_dineway_context_source_activity", ["source_activity_id"], "_dineway_activity_log", ["id"], (cb) => cb.onDelete("set null")).addForeignKeyConstraint("fk_dineway_context_supersedes", ["supersedes_id"], "_dineway_context_entries", ["id"], (cb) => cb.onDelete("set null")).execute();
|
|
1537
1537
|
await db.schema.createTable("_dineway_context_tags").addColumn("context_entry_id", "text", (col) => col.notNull()).addColumn("tag", "text", (col) => col.notNull()).addPrimaryKeyConstraint("pk_dineway_context_tags", ["context_entry_id", "tag"]).addForeignKeyConstraint("fk_dineway_context_tags_entry", ["context_entry_id"], "_dineway_context_entries", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
1538
1538
|
await db.schema.createIndex("idx_dineway_context_scope_current").on("_dineway_context_entries").columns([
|
|
@@ -1557,7 +1557,7 @@ async function up$8(db) {
|
|
|
1557
1557
|
await db.schema.createIndex("idx_dineway_context_created_at").on("_dineway_context_entries").column("created_at").execute();
|
|
1558
1558
|
await db.schema.createIndex("idx_dineway_context_tags_tag").on("_dineway_context_tags").columns(["tag", "context_entry_id"]).execute();
|
|
1559
1559
|
}
|
|
1560
|
-
async function down$
|
|
1560
|
+
async function down$9(db) {
|
|
1561
1561
|
await db.schema.dropTable("_dineway_context_tags").execute();
|
|
1562
1562
|
await db.schema.dropTable("_dineway_context_entries").execute();
|
|
1563
1563
|
}
|
|
@@ -1565,8 +1565,8 @@ async function down$8(db) {
|
|
|
1565
1565
|
//#endregion
|
|
1566
1566
|
//#region src/database/migrations/038_review_requests.ts
|
|
1567
1567
|
var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1568
|
-
down: () => down$
|
|
1569
|
-
up: () => up$
|
|
1568
|
+
down: () => down$8,
|
|
1569
|
+
up: () => up$8
|
|
1570
1570
|
});
|
|
1571
1571
|
/**
|
|
1572
1572
|
* Lightweight content review requests for Phase 5a.
|
|
@@ -1574,7 +1574,7 @@ var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
|
1574
1574
|
* Review requests bind human approval to immutable content revision/action
|
|
1575
1575
|
* identifiers so an approval cannot be reused after the draft or action changes.
|
|
1576
1576
|
*/
|
|
1577
|
-
async function up$
|
|
1577
|
+
async function up$8(db) {
|
|
1578
1578
|
await db.schema.createTable("_dineway_review_requests").addColumn("id", "text", (col) => col.primaryKey()).addColumn("status", "text", (col) => col.notNull().defaultTo("pending").check(sql`status in ('pending', 'approved', 'rejected')`)).addColumn("collection", "text", (col) => col.notNull()).addColumn("entry_id", "text", (col) => col.notNull()).addColumn("scope", "text", (col) => col.notNull()).addColumn("live_revision_id", "text").addColumn("draft_revision_id", "text").addColumn("reviewed_rev", "text", (col) => col.notNull()).addColumn("action_type", "text", (col) => col.notNull()).addColumn("action_hash", "text", (col) => col.notNull()).addColumn("risk_reason", "text").addColumn("review_payload", "text", (col) => col.notNull()).addColumn("requested_by_actor_type", "text", (col) => col.notNull().check(sql`requested_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("requested_by_actor_id", "text", (col) => col.notNull()).addColumn("requested_auth_metadata", "text").addColumn("resolved_by_actor_type", "text", (col) => col.check(sql`resolved_by_actor_type is null or resolved_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("resolved_by_actor_id", "text").addColumn("resolved_auth_metadata", "text").addColumn("review_note", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addColumn("resolved_at", "text").execute();
|
|
1579
1579
|
await db.schema.createIndex("idx_dineway_review_status_created").on("_dineway_review_requests").columns(["status", "created_at"]).execute();
|
|
1580
1580
|
await db.schema.createIndex("idx_dineway_review_target").on("_dineway_review_requests").columns([
|
|
@@ -1595,15 +1595,15 @@ async function up$7(db) {
|
|
|
1595
1595
|
]).execute();
|
|
1596
1596
|
await db.schema.createIndex("idx_dineway_review_resolved_at").on("_dineway_review_requests").column("resolved_at").execute();
|
|
1597
1597
|
}
|
|
1598
|
-
async function down$
|
|
1598
|
+
async function down$8(db) {
|
|
1599
1599
|
await db.schema.dropTable("_dineway_review_requests").execute();
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
1602
|
//#endregion
|
|
1603
1603
|
//#region src/database/migrations/039_entity_aliases.ts
|
|
1604
1604
|
var _039_entity_aliases_exports = /* @__PURE__ */ __exportAll({
|
|
1605
|
-
down: () => down$
|
|
1606
|
-
up: () => up$
|
|
1605
|
+
down: () => down$7,
|
|
1606
|
+
up: () => up$7
|
|
1607
1607
|
});
|
|
1608
1608
|
const ENTITY_ALIAS_TYPES = [
|
|
1609
1609
|
"content",
|
|
@@ -1618,7 +1618,7 @@ const ENTITY_ALIAS_TYPES = [
|
|
|
1618
1618
|
* This replaces CRMy's PostgreSQL-specific alias arrays with a normalized
|
|
1619
1619
|
* mapping table that works across SQLite/libSQL and PostgreSQL.
|
|
1620
1620
|
*/
|
|
1621
|
-
async function up$
|
|
1621
|
+
async function up$7(db) {
|
|
1622
1622
|
const entityTypesSql = sql.join(ENTITY_ALIAS_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
1623
1623
|
await db.schema.createTable("_dineway_entity_aliases").addColumn("id", "text", (col) => col.primaryKey()).addColumn("entity_type", "text", (col) => col.notNull().check(sql`entity_type in (${entityTypesSql})`)).addColumn("collection_slug", "text").addColumn("entity_id", "text", (col) => col.notNull()).addColumn("alias", "text", (col) => col.notNull()).addColumn("normalized_alias", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).execute();
|
|
1624
1624
|
await db.schema.createIndex("idx_dineway_entity_alias_lookup").on("_dineway_entity_aliases").columns(["entity_type", "normalized_alias"]).execute();
|
|
@@ -1635,15 +1635,15 @@ async function up$6(db) {
|
|
|
1635
1635
|
"normalized_alias"
|
|
1636
1636
|
]).unique().execute();
|
|
1637
1637
|
}
|
|
1638
|
-
async function down$
|
|
1638
|
+
async function down$7(db) {
|
|
1639
1639
|
await db.schema.dropTable("_dineway_entity_aliases").execute();
|
|
1640
1640
|
}
|
|
1641
1641
|
|
|
1642
1642
|
//#endregion
|
|
1643
1643
|
//#region src/database/migrations/040_handoff_snapshots.ts
|
|
1644
1644
|
var _040_handoff_snapshots_exports = /* @__PURE__ */ __exportAll({
|
|
1645
|
-
down: () => down$
|
|
1646
|
-
up: () => up$
|
|
1645
|
+
down: () => down$6,
|
|
1646
|
+
up: () => up$6
|
|
1647
1647
|
});
|
|
1648
1648
|
const ACTOR_TYPES$2 = [
|
|
1649
1649
|
"user",
|
|
@@ -1656,7 +1656,7 @@ const HANDOFF_KINDS = [
|
|
|
1656
1656
|
"assignment"
|
|
1657
1657
|
];
|
|
1658
1658
|
const REFERENCE_TYPES = ["review_request", "assignment"];
|
|
1659
|
-
async function up$
|
|
1659
|
+
async function up$6(db) {
|
|
1660
1660
|
const actorTypesSql = sql.join(ACTOR_TYPES$2.map((value) => sql.lit(value)), sql`, `);
|
|
1661
1661
|
const handoffKindsSql = sql.join(HANDOFF_KINDS.map((value) => sql.lit(value)), sql`, `);
|
|
1662
1662
|
const referenceTypesSql = sql.join(REFERENCE_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1670,15 +1670,15 @@ async function up$5(db) {
|
|
|
1670
1670
|
await db.schema.createIndex("idx_dineway_handoff_kind_created").on("_dineway_handoff_snapshots").columns(["handoff_kind", "created_at"]).execute();
|
|
1671
1671
|
await db.schema.createIndex("idx_dineway_handoff_reference").on("_dineway_handoff_snapshots").columns(["reference_type", "reference_id"]).execute();
|
|
1672
1672
|
}
|
|
1673
|
-
async function down$
|
|
1673
|
+
async function down$6(db) {
|
|
1674
1674
|
await db.schema.dropTable("_dineway_handoff_snapshots").execute();
|
|
1675
1675
|
}
|
|
1676
1676
|
|
|
1677
1677
|
//#endregion
|
|
1678
1678
|
//#region src/database/migrations/041_assignments.ts
|
|
1679
1679
|
var _041_assignments_exports = /* @__PURE__ */ __exportAll({
|
|
1680
|
-
down: () => down$
|
|
1681
|
-
up: () => up$
|
|
1680
|
+
down: () => down$5,
|
|
1681
|
+
up: () => up$5
|
|
1682
1682
|
});
|
|
1683
1683
|
const ACTOR_TYPES$1 = [
|
|
1684
1684
|
"user",
|
|
@@ -1700,7 +1700,7 @@ const ASSIGNMENT_PRIORITIES = [
|
|
|
1700
1700
|
"high",
|
|
1701
1701
|
"urgent"
|
|
1702
1702
|
];
|
|
1703
|
-
async function up$
|
|
1703
|
+
async function up$5(db) {
|
|
1704
1704
|
const actorTypesSql = sql.join(ACTOR_TYPES$1.map((value) => sql.lit(value)), sql`, `);
|
|
1705
1705
|
const statusesSql = sql.join(ASSIGNMENT_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1706
1706
|
const prioritiesSql = sql.join(ASSIGNMENT_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1732,15 +1732,15 @@ async function up$4(db) {
|
|
|
1732
1732
|
await db.schema.createIndex("idx_dineway_assignment_due_at").on("_dineway_assignments").column("due_at").execute();
|
|
1733
1733
|
await db.schema.createIndex("idx_dineway_assignment_handoff").on("_dineway_assignments").column("related_handoff_snapshot_id").execute();
|
|
1734
1734
|
}
|
|
1735
|
-
async function down$
|
|
1735
|
+
async function down$5(db) {
|
|
1736
1736
|
await db.schema.dropTable("_dineway_assignments").execute();
|
|
1737
1737
|
}
|
|
1738
1738
|
|
|
1739
1739
|
//#endregion
|
|
1740
1740
|
//#region src/database/migrations/042_hitl_requests.ts
|
|
1741
1741
|
var _042_hitl_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1742
|
-
down: () => down$
|
|
1743
|
-
up: () => up$
|
|
1742
|
+
down: () => down$4,
|
|
1743
|
+
up: () => up$4
|
|
1744
1744
|
});
|
|
1745
1745
|
const ACTOR_TYPES = [
|
|
1746
1746
|
"user",
|
|
@@ -1758,7 +1758,7 @@ const HITL_PRIORITIES = [
|
|
|
1758
1758
|
"high",
|
|
1759
1759
|
"urgent"
|
|
1760
1760
|
];
|
|
1761
|
-
async function up$
|
|
1761
|
+
async function up$4(db) {
|
|
1762
1762
|
const actorTypesSql = sql.join(ACTOR_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
1763
1763
|
const statusesSql = sql.join(HITL_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1764
1764
|
const prioritiesSql = sql.join(HITL_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1793,7 +1793,7 @@ async function up$3(db) {
|
|
|
1793
1793
|
await db.schema.createIndex("idx_dineway_hitl_sla_due_at").on("_dineway_hitl_requests").column("sla_due_at").execute();
|
|
1794
1794
|
await db.schema.createIndex("idx_dineway_assignment_hitl").on("_dineway_assignments").column("related_hitl_request_id").execute();
|
|
1795
1795
|
}
|
|
1796
|
-
async function down$
|
|
1796
|
+
async function down$4(db) {
|
|
1797
1797
|
await db.schema.dropIndex("idx_dineway_assignment_hitl").execute();
|
|
1798
1798
|
await db.schema.alterTable("_dineway_assignments").dropColumn("related_hitl_request_id").execute();
|
|
1799
1799
|
await db.schema.dropTable("_dineway_hitl_requests").execute();
|
|
@@ -1802,8 +1802,8 @@ async function down$3(db) {
|
|
|
1802
1802
|
//#endregion
|
|
1803
1803
|
//#region src/database/migrations/043_bounded_404_log.ts
|
|
1804
1804
|
var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
1805
|
-
down: () => down$
|
|
1806
|
-
up: () => up$
|
|
1805
|
+
down: () => down$3,
|
|
1806
|
+
up: () => up$3
|
|
1807
1807
|
});
|
|
1808
1808
|
/**
|
|
1809
1809
|
* Migration: Bounded 404 logging
|
|
@@ -1812,7 +1812,7 @@ var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1812
1812
|
* Previously every 404 inserted a new row, so a requester could grow the
|
|
1813
1813
|
* table without bound by hitting unique URLs.
|
|
1814
1814
|
*/
|
|
1815
|
-
async function up$
|
|
1815
|
+
async function up$3(db) {
|
|
1816
1816
|
await db.schema.alterTable("_dineway_404_log").addColumn("hits", "integer", (col) => col.notNull().defaultTo(1)).execute();
|
|
1817
1817
|
await db.schema.alterTable("_dineway_404_log").addColumn("last_seen_at", "text").execute();
|
|
1818
1818
|
await sql`
|
|
@@ -1858,7 +1858,7 @@ async function up$2(db) {
|
|
|
1858
1858
|
await db.schema.dropIndex("idx_404_log_path").execute();
|
|
1859
1859
|
await db.schema.createIndex("idx_404_log_last_seen").on("_dineway_404_log").column("last_seen_at").execute();
|
|
1860
1860
|
}
|
|
1861
|
-
async function down$
|
|
1861
|
+
async function down$3(db) {
|
|
1862
1862
|
await db.schema.dropIndex("idx_404_log_last_seen").execute();
|
|
1863
1863
|
await db.schema.dropIndex("idx_404_log_path_unique").execute();
|
|
1864
1864
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
@@ -1869,21 +1869,21 @@ async function down$2(db) {
|
|
|
1869
1869
|
//#endregion
|
|
1870
1870
|
//#region src/database/migrations/044_credential_algorithm.ts
|
|
1871
1871
|
var _044_credential_algorithm_exports = /* @__PURE__ */ __exportAll({
|
|
1872
|
-
down: () => down$
|
|
1873
|
-
up: () => up$
|
|
1872
|
+
down: () => down$2,
|
|
1873
|
+
up: () => up$2
|
|
1874
1874
|
});
|
|
1875
|
-
async function up$
|
|
1875
|
+
async function up$2(db) {
|
|
1876
1876
|
if (!await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").addColumn("algorithm", "integer", (col) => col.notNull().defaultTo(-7)).execute();
|
|
1877
1877
|
}
|
|
1878
|
-
async function down$
|
|
1878
|
+
async function down$2(db) {
|
|
1879
1879
|
if (await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").dropColumn("algorithm").execute();
|
|
1880
1880
|
}
|
|
1881
1881
|
|
|
1882
1882
|
//#endregion
|
|
1883
1883
|
//#region src/database/migrations/045_i18n_menus_and_taxonomies.ts
|
|
1884
1884
|
var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
1885
|
-
down: () => down,
|
|
1886
|
-
up: () => up
|
|
1885
|
+
down: () => down$1,
|
|
1886
|
+
up: () => up$1
|
|
1887
1887
|
});
|
|
1888
1888
|
/**
|
|
1889
1889
|
* i18n for menus + taxonomies. Adds `locale` + `translation_group` to system
|
|
@@ -1894,7 +1894,7 @@ var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
|
1894
1894
|
function getDefaultLocale() {
|
|
1895
1895
|
return getI18nConfig()?.defaultLocale ?? "en";
|
|
1896
1896
|
}
|
|
1897
|
-
async function up(db) {
|
|
1897
|
+
async function up$1(db) {
|
|
1898
1898
|
const defaultLocale = getDefaultLocale();
|
|
1899
1899
|
if (isSqlite(db)) {
|
|
1900
1900
|
await sql.raw(`PRAGMA foreign_keys = OFF`).execute(db);
|
|
@@ -2084,7 +2084,7 @@ async function assertSingleLocale(db, defaultLocale) {
|
|
|
2084
2084
|
if (count > 0) throw new Error(`Cannot revert migration 045_i18n_menus_and_taxonomies: ${count} row(s) in "${table}" use a non-default locale (defaultLocale="${defaultLocale}"). Reverting would drop them silently. Export translations first (or delete them) and re-run the rollback. See packages/core/src/database/migrations/045_i18n_menus_and_taxonomies.ts.`);
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
|
-
async function down(db) {
|
|
2087
|
+
async function down$1(db) {
|
|
2088
2088
|
const defaultLocale = getDefaultLocale();
|
|
2089
2089
|
await assertSingleLocale(db, defaultLocale);
|
|
2090
2090
|
const widenedTables = [
|
|
@@ -2174,6 +2174,19 @@ async function rebuildTaxonomyDefsDown(db) {
|
|
|
2174
2174
|
await sql`ALTER TABLE _dineway_taxonomy_defs_old RENAME TO _dineway_taxonomy_defs`.execute(db);
|
|
2175
2175
|
}
|
|
2176
2176
|
|
|
2177
|
+
//#endregion
|
|
2178
|
+
//#region src/database/migrations/046_astro_sessions.ts
|
|
2179
|
+
var _046_astro_sessions_exports = /* @__PURE__ */ __exportAll({
|
|
2180
|
+
down: () => down,
|
|
2181
|
+
up: () => up
|
|
2182
|
+
});
|
|
2183
|
+
async function up(db) {
|
|
2184
|
+
await db.schema.createTable("_dineway_sessions").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("value", "text", (col) => col.notNull()).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).execute();
|
|
2185
|
+
}
|
|
2186
|
+
async function down(db) {
|
|
2187
|
+
await db.schema.dropTable("_dineway_sessions").ifExists().execute();
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2177
2190
|
//#endregion
|
|
2178
2191
|
//#region src/database/migrations/runner.ts
|
|
2179
2192
|
const MIGRATIONS = Object.freeze({
|
|
@@ -2220,7 +2233,8 @@ const MIGRATIONS = Object.freeze({
|
|
|
2220
2233
|
"042_hitl_requests": _042_hitl_requests_exports,
|
|
2221
2234
|
"043_bounded_404_log": _043_bounded_404_log_exports,
|
|
2222
2235
|
"044_credential_algorithm": _044_credential_algorithm_exports,
|
|
2223
|
-
"045_i18n_menus_and_taxonomies": _045_i18n_menus_and_taxonomies_exports
|
|
2236
|
+
"045_i18n_menus_and_taxonomies": _045_i18n_menus_and_taxonomies_exports,
|
|
2237
|
+
"046_astro_sessions": _046_astro_sessions_exports
|
|
2224
2238
|
});
|
|
2225
2239
|
const MIGRATION_NAMES = Object.freeze(Object.keys(MIGRATIONS).toSorted());
|
|
2226
2240
|
/** Total number of registered migrations. Exported for use in tests. */
|