@opencloudcms/db 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/index.d.ts +41 -0
- package/dist/index.js +449 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ánh Nguyễn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @opencloudcms/db
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Database connection, system migrations and migrator for OpenCloudCMS.
|
|
4
|
+
|
|
5
|
+
Part of [OpenCloudCMS](https://github.com/anhdev97/Open-CMS): see the [main README](https://github.com/anhdev97/Open-CMS#readme) for setup and documentation.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Kysely, Migrator, sql, type Migration, type MigrationProvider } from 'kysely';
|
|
2
|
+
export declare function createDb(connectionString: string): Kysely<any>;
|
|
3
|
+
export declare const coreMigrations: Record<string, Migration>;
|
|
4
|
+
export declare class FileMigrationProvider implements MigrationProvider {
|
|
5
|
+
private readonly dir;
|
|
6
|
+
constructor(dir: string);
|
|
7
|
+
getMigrations(): Promise<Record<string, Migration>>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Lets other packages (e.g. @opencloudcms/oauth2) contribute migrations to the core stream.
|
|
11
|
+
* Registering the same object again is a no-op; a key that already exists (built-in or
|
|
12
|
+
* from another source) throws.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerCoreMigrations(source: Record<string, Migration>): void;
|
|
15
|
+
/** Built-in core migrations merged with registered sources, sorted by key. */
|
|
16
|
+
export declare function allCoreMigrations(): Record<string, Migration>;
|
|
17
|
+
/**
|
|
18
|
+
* Unordered on purpose: contributed sources are independent of the built-ins, and their keys
|
|
19
|
+
* (`oauth2_0001_init`) sort after every `000N_*`, so the next built-in would otherwise land before an
|
|
20
|
+
* already executed migration and Kysely would refuse to run.
|
|
21
|
+
*/
|
|
22
|
+
export declare function coreMigrator(db: Kysely<any>): Migrator;
|
|
23
|
+
export declare function projectMigrator(db: Kysely<any>, migrationsDir: string): Migrator;
|
|
24
|
+
export interface MigrationRun {
|
|
25
|
+
stream: 'core' | 'project';
|
|
26
|
+
name: string;
|
|
27
|
+
direction: 'Up' | 'Down';
|
|
28
|
+
status: 'Success' | 'Error' | 'NotExecuted';
|
|
29
|
+
}
|
|
30
|
+
/** Applies pending core migrations, then pending project migrations. */
|
|
31
|
+
export declare function migrateUp(db: Kysely<any>, migrationsDir: string): Promise<MigrationRun[]>;
|
|
32
|
+
/** Reverts the last `steps` project migrations (core migrations are never rolled back here). */
|
|
33
|
+
export declare function migrateDown(db: Kysely<any>, migrationsDir: string, steps?: number): Promise<MigrationRun[]>;
|
|
34
|
+
export interface MigrationStatusRow {
|
|
35
|
+
stream: 'core' | 'project';
|
|
36
|
+
name: string;
|
|
37
|
+
executedAt: Date | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function migrationStatus(db: Kysely<any>, migrationsDir: string): Promise<MigrationStatusRow[]>;
|
|
40
|
+
export declare function pendingMigrations(db: Kysely<any>, migrationsDir: string): Promise<MigrationStatusRow[]>;
|
|
41
|
+
export { sql };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sql = exports.FileMigrationProvider = exports.coreMigrations = void 0;
|
|
37
|
+
exports.createDb = createDb;
|
|
38
|
+
exports.registerCoreMigrations = registerCoreMigrations;
|
|
39
|
+
exports.allCoreMigrations = allCoreMigrations;
|
|
40
|
+
exports.coreMigrator = coreMigrator;
|
|
41
|
+
exports.projectMigrator = projectMigrator;
|
|
42
|
+
exports.migrateUp = migrateUp;
|
|
43
|
+
exports.migrateDown = migrateDown;
|
|
44
|
+
exports.migrationStatus = migrationStatus;
|
|
45
|
+
exports.pendingMigrations = pendingMigrations;
|
|
46
|
+
/**
|
|
47
|
+
* Database access and the two migration streams:
|
|
48
|
+
* - core migrations (system tables shipped with @opencloudcms/db), tracked in opencms_core_migrations
|
|
49
|
+
* - project migrations (generated ct_* tables in <project>/migrations), tracked in opencms_migrations
|
|
50
|
+
* Core always runs first. Kysely's migrator takes a lock, so several instances
|
|
51
|
+
* starting at once will not apply the same migration twice.
|
|
52
|
+
*/
|
|
53
|
+
const fs = __importStar(require("node:fs"));
|
|
54
|
+
const path = __importStar(require("node:path"));
|
|
55
|
+
const jiti_1 = require("jiti");
|
|
56
|
+
const kysely_1 = require("kysely");
|
|
57
|
+
Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return kysely_1.sql; } });
|
|
58
|
+
const pg_1 = require("pg");
|
|
59
|
+
const schema_1 = require("@opencloudcms/schema");
|
|
60
|
+
// Keep `date` columns as 'YYYY-MM-DD' strings instead of timezone-shifted JS Dates.
|
|
61
|
+
pg_1.types.setTypeParser(1082, (v) => v);
|
|
62
|
+
function createDb(connectionString) {
|
|
63
|
+
return new kysely_1.Kysely({ dialect: new kysely_1.PostgresDialect({ pool: new pg_1.Pool({ connectionString, max: 10 }) }) });
|
|
64
|
+
}
|
|
65
|
+
/* ------------------------------ core ------------------------------ */
|
|
66
|
+
exports.coreMigrations = {
|
|
67
|
+
'0001_system_tables': {
|
|
68
|
+
async up(db) {
|
|
69
|
+
await db.schema
|
|
70
|
+
.createTable(schema_1.SYSTEM_TABLES.assets)
|
|
71
|
+
.addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo((0, kysely_1.sql) `gen_random_uuid()`))
|
|
72
|
+
.addColumn('filename', 'varchar(255)', (c) => c.notNull())
|
|
73
|
+
.addColumn('url', 'varchar(2048)', (c) => c.notNull())
|
|
74
|
+
.addColumn('mime_type', 'varchar(127)')
|
|
75
|
+
.addColumn('size', 'bigint')
|
|
76
|
+
.addColumn('width', 'integer')
|
|
77
|
+
.addColumn('height', 'integer')
|
|
78
|
+
.addColumn('alt', 'varchar(512)')
|
|
79
|
+
.addColumn('metadata', 'jsonb')
|
|
80
|
+
.addColumn('created_at', 'timestamptz', (c) => c.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
81
|
+
.execute();
|
|
82
|
+
await db.schema
|
|
83
|
+
.createTable(schema_1.SYSTEM_TABLES.taxonomies)
|
|
84
|
+
.addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo((0, kysely_1.sql) `gen_random_uuid()`))
|
|
85
|
+
.addColumn('slug', 'varchar(64)', (c) => c.notNull().unique())
|
|
86
|
+
.addColumn('name', 'varchar(255)', (c) => c.notNull())
|
|
87
|
+
.addColumn('created_at', 'timestamptz', (c) => c.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
88
|
+
.execute();
|
|
89
|
+
await db.schema
|
|
90
|
+
.createTable(schema_1.SYSTEM_TABLES.taxonomyTerms)
|
|
91
|
+
.addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo((0, kysely_1.sql) `gen_random_uuid()`))
|
|
92
|
+
.addColumn('taxonomy_id', 'uuid', (c) => c.notNull().references(`${schema_1.SYSTEM_TABLES.taxonomies}.id`).onDelete('cascade'))
|
|
93
|
+
.addColumn('parent_id', 'uuid', (c) => c.references(`${schema_1.SYSTEM_TABLES.taxonomyTerms}.id`).onDelete('set null'))
|
|
94
|
+
.addColumn('slug', 'varchar(128)', (c) => c.notNull())
|
|
95
|
+
.addColumn('name', 'jsonb', (c) => c.notNull()) // { "vi-VN": "Ô tô", "en": "Car" }
|
|
96
|
+
.addColumn('sort_order', 'integer', (c) => c.notNull().defaultTo(0))
|
|
97
|
+
.addUniqueConstraint('opencms_taxonomy_terms_slug_uq', ['taxonomy_id', 'slug'])
|
|
98
|
+
.execute();
|
|
99
|
+
await db.schema
|
|
100
|
+
.createTable(schema_1.SYSTEM_TABLES.entryVersions)
|
|
101
|
+
.addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo((0, kysely_1.sql) `gen_random_uuid()`))
|
|
102
|
+
.addColumn('content_type', 'varchar(64)', (c) => c.notNull())
|
|
103
|
+
.addColumn('document_id', 'uuid', (c) => c.notNull())
|
|
104
|
+
.addColumn('snapshot', 'jsonb', (c) => c.notNull())
|
|
105
|
+
.addColumn('created_at', 'timestamptz', (c) => c.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
106
|
+
.execute();
|
|
107
|
+
await db.schema
|
|
108
|
+
.createIndex('opencms_entry_versions_doc_idx')
|
|
109
|
+
.on(schema_1.SYSTEM_TABLES.entryVersions)
|
|
110
|
+
.columns(['content_type', 'document_id', 'created_at'])
|
|
111
|
+
.execute();
|
|
112
|
+
},
|
|
113
|
+
async down(db) {
|
|
114
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.entryVersions).execute();
|
|
115
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.taxonomyTerms).execute();
|
|
116
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.taxonomies).execute();
|
|
117
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.assets).execute();
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
'0002_region_locales': {
|
|
121
|
+
/**
|
|
122
|
+
* Short locale codes become region codes in every `*_l10n` table. Rows are keyed by (entry_id, locale):
|
|
123
|
+
* a row whose renamed key already exists is left as it is and reported.
|
|
124
|
+
*/
|
|
125
|
+
async up(db) {
|
|
126
|
+
const renames = [['en', 'en-US'], ['vi', 'vi-VN'], ['fr', 'fr-FR'], ['id', 'id-ID']];
|
|
127
|
+
const tables = await (0, kysely_1.sql) `
|
|
128
|
+
select t.table_name from information_schema.tables t
|
|
129
|
+
join information_schema.columns c on c.table_schema = t.table_schema and c.table_name = t.table_name and c.column_name = 'locale'
|
|
130
|
+
where t.table_schema = current_schema() and t.table_type = 'BASE TABLE' and t.table_name like '%\_l10n'
|
|
131
|
+
order by t.table_name`.execute(db);
|
|
132
|
+
let changed = 0;
|
|
133
|
+
for (const { table_name: table } of tables.rows) {
|
|
134
|
+
for (const [from, to] of renames) {
|
|
135
|
+
const res = await (0, kysely_1.sql) `
|
|
136
|
+
update ${kysely_1.sql.id(table)} o set locale = ${to}
|
|
137
|
+
where o.locale = ${from}
|
|
138
|
+
and not exists (select 1 from ${kysely_1.sql.id(table)} n where n.entry_id = o.entry_id and n.locale = ${to})`.execute(db);
|
|
139
|
+
changed += Number(res.numAffectedRows ?? 0);
|
|
140
|
+
const left = await (0, kysely_1.sql) `select count(*)::text as n from ${kysely_1.sql.id(table)} where locale = ${from}`.execute(db);
|
|
141
|
+
const n = Number(left.rows[0]?.n ?? 0);
|
|
142
|
+
if (n > 0)
|
|
143
|
+
console.warn(`[opencloudcms] 0002_region_locales: ${table}: ${n} "${from}" row(s) kept, "${to}" already exists for the same entry`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
console.log(`[opencloudcms] 0002_region_locales: renamed ${changed} locale row(s)`);
|
|
147
|
+
},
|
|
148
|
+
async down() {
|
|
149
|
+
// Not reversible: the old short codes are not recorded.
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
'0003_workflow': {
|
|
153
|
+
/** Spec B §5.2: review state per document. No row = clean draft. */
|
|
154
|
+
async up(db) {
|
|
155
|
+
await db.schema
|
|
156
|
+
.createTable(schema_1.SYSTEM_TABLES.workflow)
|
|
157
|
+
.addColumn('api_id', 'text', (c) => c.notNull())
|
|
158
|
+
.addColumn('document_id', 'uuid', (c) => c.notNull())
|
|
159
|
+
.addColumn('state', 'text', (c) => c.notNull().check((0, kysely_1.sql) `state in ('in_review', 'draft')`))
|
|
160
|
+
.addColumn('submitted_by', 'uuid')
|
|
161
|
+
.addColumn('submitted_at', 'timestamptz')
|
|
162
|
+
.addColumn('reviewed_by', 'uuid')
|
|
163
|
+
.addColumn('reviewed_at', 'timestamptz')
|
|
164
|
+
.addColumn('note', 'text')
|
|
165
|
+
.addPrimaryKeyConstraint('opencms_workflow_pk', ['api_id', 'document_id'])
|
|
166
|
+
.execute();
|
|
167
|
+
await db.schema.createIndex('opencms_workflow_state_idx').on(schema_1.SYSTEM_TABLES.workflow).columns(['state', 'api_id']).execute();
|
|
168
|
+
},
|
|
169
|
+
async down(db) {
|
|
170
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.workflow).execute();
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
'0004_assets_storage': {
|
|
174
|
+
async up(db) {
|
|
175
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).addColumn('storage_key', 'text').execute();
|
|
176
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).addColumn('provider', 'text').execute();
|
|
177
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).addColumn('variants', 'jsonb').execute();
|
|
178
|
+
},
|
|
179
|
+
async down(db) {
|
|
180
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).dropColumn('variants').execute();
|
|
181
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).dropColumn('provider').execute();
|
|
182
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).dropColumn('storage_key').execute();
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
'0005_asset_folders': {
|
|
186
|
+
async up(db) {
|
|
187
|
+
await db.schema
|
|
188
|
+
.createTable(schema_1.SYSTEM_TABLES.assetFolders)
|
|
189
|
+
.addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo((0, kysely_1.sql) `gen_random_uuid()`))
|
|
190
|
+
.addColumn('parent_id', 'uuid', (c) => c.references(`${schema_1.SYSTEM_TABLES.assetFolders}.id`).onDelete('restrict'))
|
|
191
|
+
.addColumn('slug', 'varchar(64)', (c) => c.notNull())
|
|
192
|
+
.addColumn('name', 'varchar(255)', (c) => c.notNull())
|
|
193
|
+
.addColumn('created_at', 'timestamptz', (c) => c.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
194
|
+
.addUniqueConstraint('opencms_asset_folders_parent_slug_uq', ['parent_id', 'slug'])
|
|
195
|
+
.execute();
|
|
196
|
+
// Unique among root folders (parent_id IS NULL): partial unique index.
|
|
197
|
+
await (0, kysely_1.sql) `create unique index opencms_asset_folders_root_slug_uq on ${kysely_1.sql.table(schema_1.SYSTEM_TABLES.assetFolders)} (slug) where parent_id is null`.execute(db);
|
|
198
|
+
await db.schema
|
|
199
|
+
.alterTable(schema_1.SYSTEM_TABLES.assets)
|
|
200
|
+
.addColumn('folder_id', 'uuid', (c) => c.references(`${schema_1.SYSTEM_TABLES.assetFolders}.id`).onDelete('set null'))
|
|
201
|
+
.execute();
|
|
202
|
+
await db.schema.createIndex('opencms_assets_folder_idx').on(schema_1.SYSTEM_TABLES.assets).column('folder_id').execute();
|
|
203
|
+
},
|
|
204
|
+
async down(db) {
|
|
205
|
+
await db.schema.dropIndex('opencms_assets_folder_idx').execute();
|
|
206
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).dropColumn('folder_id').execute();
|
|
207
|
+
await (0, kysely_1.sql) `drop index if exists opencms_asset_folders_root_slug_uq`.execute(db);
|
|
208
|
+
await db.schema.dropTable(schema_1.SYSTEM_TABLES.assetFolders).execute();
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
'0006_pages': {
|
|
212
|
+
/**
|
|
213
|
+
* Tables of the core-owned `opencloudcmsPage` content type. This is exactly what the codegen DDL produces for
|
|
214
|
+
* packages/core/src/pages/page.type.ts (guarded by the drift test in core's pages-type integration test).
|
|
215
|
+
*/
|
|
216
|
+
async up(db) {
|
|
217
|
+
await db.schema
|
|
218
|
+
.createTable('ct_opencloudcms_page')
|
|
219
|
+
.addColumn('id', (0, kysely_1.sql) `uuid`, (col) => col.notNull())
|
|
220
|
+
.addColumn('document_id', (0, kysely_1.sql) `uuid`, (col) => col.notNull())
|
|
221
|
+
.addColumn('status', (0, kysely_1.sql) `varchar(16)`, (col) => col.notNull())
|
|
222
|
+
.addColumn('created_at', (0, kysely_1.sql) `timestamptz`, (col) => col.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
223
|
+
.addColumn('updated_at', (0, kysely_1.sql) `timestamptz`, (col) => col.notNull().defaultTo((0, kysely_1.sql) `now()`))
|
|
224
|
+
.addColumn('published_at', (0, kysely_1.sql) `timestamptz`)
|
|
225
|
+
.addPrimaryKeyConstraint('ct_opencloudcms_page_pkey', ['id'])
|
|
226
|
+
.execute();
|
|
227
|
+
await db.schema
|
|
228
|
+
.createIndex('ct_opencloudcms_page_document_status_uq')
|
|
229
|
+
.on('ct_opencloudcms_page')
|
|
230
|
+
.columns(['document_id', 'status'])
|
|
231
|
+
.unique()
|
|
232
|
+
.execute();
|
|
233
|
+
await db.schema
|
|
234
|
+
.createTable('ct_opencloudcms_page_l10n')
|
|
235
|
+
.addColumn('entry_id', (0, kysely_1.sql) `uuid`, (col) => col.notNull().references('ct_opencloudcms_page.id').onDelete('cascade'))
|
|
236
|
+
.addColumn('locale', (0, kysely_1.sql) `varchar(16)`, (col) => col.notNull())
|
|
237
|
+
.addColumn('status', (0, kysely_1.sql) `varchar(16)`, (col) => col.notNull())
|
|
238
|
+
.addColumn('title', (0, kysely_1.sql) `varchar(255)`)
|
|
239
|
+
.addColumn('path', (0, kysely_1.sql) `varchar(255)`)
|
|
240
|
+
.addColumn('seo', (0, kysely_1.sql) `jsonb`)
|
|
241
|
+
.addColumn('content', (0, kysely_1.sql) `jsonb`)
|
|
242
|
+
.addPrimaryKeyConstraint('ct_opencloudcms_page_l10n_pkey', ['entry_id', 'locale'])
|
|
243
|
+
.execute();
|
|
244
|
+
await db.schema
|
|
245
|
+
.createIndex('ct_opencloudcms_page_l10n_path_uq')
|
|
246
|
+
.on('ct_opencloudcms_page_l10n')
|
|
247
|
+
.columns(['locale', 'status', 'path'])
|
|
248
|
+
.unique()
|
|
249
|
+
.execute();
|
|
250
|
+
},
|
|
251
|
+
async down(db) {
|
|
252
|
+
await db.schema.dropTable('ct_opencloudcms_page_l10n').execute();
|
|
253
|
+
await db.schema.dropTable('ct_opencloudcms_page').execute();
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
'0007_page_kind': {
|
|
257
|
+
/**
|
|
258
|
+
* Base pages: document-level `kind` ('page' | 'base'), the default-base flag and a page's base choice. Matches the
|
|
259
|
+
* codegen DDL for the `kind` / `isDefault` / `layout` fields of page.type.ts plus `not null` and defaults.
|
|
260
|
+
*/
|
|
261
|
+
async up(db) {
|
|
262
|
+
await db.schema
|
|
263
|
+
.alterTable('ct_opencloudcms_page')
|
|
264
|
+
.addColumn('kind', (0, kysely_1.sql) `varchar(16)`, (col) => col.notNull().defaultTo('page'))
|
|
265
|
+
.addColumn('is_default', (0, kysely_1.sql) `boolean`, (col) => col.notNull().defaultTo(false))
|
|
266
|
+
.addColumn('layout', (0, kysely_1.sql) `jsonb`)
|
|
267
|
+
.execute();
|
|
268
|
+
},
|
|
269
|
+
async down(db) {
|
|
270
|
+
await db.schema.alterTable('ct_opencloudcms_page').dropColumn('layout').dropColumn('is_default').dropColumn('kind').execute();
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
'0008_private_assets': {
|
|
274
|
+
/**
|
|
275
|
+
* Private files (spec §7, decision 9): `visibility` ('public' | 'private'), the private content type and entry
|
|
276
|
+
* that own a private file (`owner_document_id` null = uploaded, not yet attached). Private rows store `url = ''`.
|
|
277
|
+
*/
|
|
278
|
+
async up(db) {
|
|
279
|
+
await db.schema
|
|
280
|
+
.alterTable(schema_1.SYSTEM_TABLES.assets)
|
|
281
|
+
.addColumn('visibility', 'varchar(16)', (c) => c.notNull().defaultTo('public'))
|
|
282
|
+
.addColumn('owner_api_id', 'varchar(64)')
|
|
283
|
+
.addColumn('owner_document_id', 'uuid')
|
|
284
|
+
.execute();
|
|
285
|
+
await db.schema.createIndex('opencms_assets_owner_idx').on(schema_1.SYSTEM_TABLES.assets).columns(['owner_api_id', 'owner_document_id']).execute();
|
|
286
|
+
},
|
|
287
|
+
async down(db) {
|
|
288
|
+
// Without `visibility` every row would read as a public asset: drop the private rows first. Their stored
|
|
289
|
+
// objects stay where they are (private storage), unreferenced.
|
|
290
|
+
await db.deleteFrom(schema_1.SYSTEM_TABLES.assets).where('visibility', '=', 'private').execute();
|
|
291
|
+
await db.schema.dropIndex('opencms_assets_owner_idx').execute();
|
|
292
|
+
await db.schema.alterTable(schema_1.SYSTEM_TABLES.assets).dropColumn('owner_document_id').dropColumn('owner_api_id').dropColumn('visibility').execute();
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
'0009_detail_pages': {
|
|
296
|
+
/**
|
|
297
|
+
* Entry detail templates (`kind: 'detail'`): the content type a template is for. Matches the codegen DDL for the
|
|
298
|
+
* `detailApiId` field of page.type.ts (`unique`: one template per type and status). Adds a column and an index only.
|
|
299
|
+
*/
|
|
300
|
+
async up(db) {
|
|
301
|
+
await db.schema.alterTable('ct_opencloudcms_page').addColumn('detail_api_id', (0, kysely_1.sql) `varchar(64)`).execute();
|
|
302
|
+
await db.schema
|
|
303
|
+
.createIndex('ct_opencloudcms_page_detail_api_id_uq')
|
|
304
|
+
.on('ct_opencloudcms_page')
|
|
305
|
+
.columns(['status', 'detail_api_id'])
|
|
306
|
+
.unique()
|
|
307
|
+
.execute();
|
|
308
|
+
},
|
|
309
|
+
async down(db) {
|
|
310
|
+
// Destructive by design: the detail templates (kind 'detail') are deleted before the column goes. Pre-0009 code
|
|
311
|
+
// does not know the kind; its public by-id read (`GET /api/content/opencloudcmsPage/:id`) and admin lists would
|
|
312
|
+
// serve the rows as ordinary pages. Their l10n rows go by cascade; their versions and workflow rows are removed
|
|
313
|
+
// too, so nothing can restore them. Re-running `up` adds the column and index back, not the templates.
|
|
314
|
+
const templates = (0, kysely_1.sql) `(select document_id from ct_opencloudcms_page where kind = 'detail')`;
|
|
315
|
+
await (0, kysely_1.sql) `delete from ${kysely_1.sql.table(schema_1.SYSTEM_TABLES.entryVersions)} where content_type = 'opencloudcmsPage' and document_id in ${templates}`.execute(db);
|
|
316
|
+
await (0, kysely_1.sql) `delete from ${kysely_1.sql.table(schema_1.SYSTEM_TABLES.workflow)} where api_id = 'opencloudcmsPage' and document_id in ${templates}`.execute(db);
|
|
317
|
+
await (0, kysely_1.sql) `delete from ct_opencloudcms_page where kind = 'detail'`.execute(db);
|
|
318
|
+
await db.schema.dropIndex('ct_opencloudcms_page_detail_api_id_uq').ifExists().execute();
|
|
319
|
+
await db.schema.alterTable('ct_opencloudcms_page').dropColumn('detail_api_id').execute();
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
'0010_page_access': {
|
|
323
|
+
/**
|
|
324
|
+
* Page Access (page-actions goal 10): `access` ('public' | 'customer'), shared, `not null` default 'public'.
|
|
325
|
+
* Matches the codegen DDL for the `access` field of page.type.ts plus `not null` and the default.
|
|
326
|
+
*/
|
|
327
|
+
async up(db) {
|
|
328
|
+
await db.schema
|
|
329
|
+
.alterTable('ct_opencloudcms_page')
|
|
330
|
+
.addColumn('access', (0, kysely_1.sql) `varchar(16)`, (col) => col.notNull().defaultTo('public'))
|
|
331
|
+
.execute();
|
|
332
|
+
},
|
|
333
|
+
async down(db) {
|
|
334
|
+
// Pre-0010 code serves every published page to anyone: the published rows of `customer` pages are removed first
|
|
335
|
+
// (an unpublish: their drafts stay, without the setting), so rolling back never makes them public.
|
|
336
|
+
await (0, kysely_1.sql) `delete from ct_opencloudcms_page where status = 'published' and access = 'customer'`.execute(db);
|
|
337
|
+
await db.schema.alterTable('ct_opencloudcms_page').dropColumn('access').execute();
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
/* ----------------------------- project ---------------------------- */
|
|
342
|
+
class FileMigrationProvider {
|
|
343
|
+
dir;
|
|
344
|
+
constructor(dir) {
|
|
345
|
+
this.dir = dir;
|
|
346
|
+
}
|
|
347
|
+
async getMigrations() {
|
|
348
|
+
if (!fs.existsSync(this.dir))
|
|
349
|
+
return {};
|
|
350
|
+
const jiti = (0, jiti_1.createJiti)(path.join(this.dir, 'noop.js'), { moduleCache: false, fsCache: false });
|
|
351
|
+
const out = {};
|
|
352
|
+
const files = fs.readdirSync(this.dir).filter((f) => /^\d{14}_.+\.(ts|js)$/.test(f)).sort();
|
|
353
|
+
for (const file of files) {
|
|
354
|
+
const mod = await jiti.import(path.join(this.dir, file));
|
|
355
|
+
if (typeof mod.up !== 'function')
|
|
356
|
+
throw new Error(`Migration ${file} has no up() export`);
|
|
357
|
+
out[file.replace(/\.(ts|js)$/, '')] = mod;
|
|
358
|
+
}
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
exports.FileMigrationProvider = FileMigrationProvider;
|
|
363
|
+
const registeredSources = [];
|
|
364
|
+
/**
|
|
365
|
+
* Lets other packages (e.g. @opencloudcms/oauth2) contribute migrations to the core stream.
|
|
366
|
+
* Registering the same object again is a no-op; a key that already exists (built-in or
|
|
367
|
+
* from another source) throws.
|
|
368
|
+
*/
|
|
369
|
+
function registerCoreMigrations(source) {
|
|
370
|
+
if (registeredSources.includes(source))
|
|
371
|
+
return;
|
|
372
|
+
const taken = allCoreMigrations();
|
|
373
|
+
for (const key of Object.keys(source)) {
|
|
374
|
+
if (Object.hasOwn(taken, key))
|
|
375
|
+
throw new Error(`Core migration "${key}" is already registered`);
|
|
376
|
+
}
|
|
377
|
+
registeredSources.push(source);
|
|
378
|
+
}
|
|
379
|
+
/** Built-in core migrations merged with registered sources, sorted by key. */
|
|
380
|
+
function allCoreMigrations() {
|
|
381
|
+
const merged = { ...exports.coreMigrations };
|
|
382
|
+
for (const src of registeredSources)
|
|
383
|
+
Object.assign(merged, src);
|
|
384
|
+
const out = {};
|
|
385
|
+
for (const key of Object.keys(merged).sort())
|
|
386
|
+
out[key] = merged[key];
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Unordered on purpose: contributed sources are independent of the built-ins, and their keys
|
|
391
|
+
* (`oauth2_0001_init`) sort after every `000N_*`, so the next built-in would otherwise land before an
|
|
392
|
+
* already executed migration and Kysely would refuse to run.
|
|
393
|
+
*/
|
|
394
|
+
function coreMigrator(db) {
|
|
395
|
+
return new kysely_1.Migrator({
|
|
396
|
+
db,
|
|
397
|
+
provider: { getMigrations: async () => allCoreMigrations() },
|
|
398
|
+
allowUnorderedMigrations: true,
|
|
399
|
+
migrationTableName: 'opencms_core_migrations',
|
|
400
|
+
migrationLockTableName: 'opencms_core_migrations_lock',
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
function projectMigrator(db, migrationsDir) {
|
|
404
|
+
return new kysely_1.Migrator({
|
|
405
|
+
db,
|
|
406
|
+
provider: new FileMigrationProvider(migrationsDir),
|
|
407
|
+
migrationTableName: 'opencms_migrations',
|
|
408
|
+
migrationLockTableName: 'opencms_migrations_lock',
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function unwrap(stream, rs) {
|
|
412
|
+
const runs = (rs.results ?? []).map((r) => ({ stream, name: r.migrationName, direction: r.direction, status: r.status }));
|
|
413
|
+
if (rs.error) {
|
|
414
|
+
const err = rs.error instanceof Error ? rs.error : new Error(String(rs.error));
|
|
415
|
+
err.runs = runs;
|
|
416
|
+
err.message = `[${stream}] ${err.message}`;
|
|
417
|
+
throw err;
|
|
418
|
+
}
|
|
419
|
+
return runs;
|
|
420
|
+
}
|
|
421
|
+
/** Applies pending core migrations, then pending project migrations. */
|
|
422
|
+
async function migrateUp(db, migrationsDir) {
|
|
423
|
+
const core = unwrap('core', await coreMigrator(db).migrateToLatest());
|
|
424
|
+
const project = unwrap('project', await projectMigrator(db, migrationsDir).migrateToLatest());
|
|
425
|
+
return [...core, ...project];
|
|
426
|
+
}
|
|
427
|
+
/** Reverts the last `steps` project migrations (core migrations are never rolled back here). */
|
|
428
|
+
async function migrateDown(db, migrationsDir, steps = 1) {
|
|
429
|
+
const runs = [];
|
|
430
|
+
for (let i = 0; i < steps; i++) {
|
|
431
|
+
const r = unwrap('project', await projectMigrator(db, migrationsDir).migrateDown());
|
|
432
|
+
if (!r.length)
|
|
433
|
+
break;
|
|
434
|
+
runs.push(...r);
|
|
435
|
+
}
|
|
436
|
+
return runs;
|
|
437
|
+
}
|
|
438
|
+
async function migrationStatus(db, migrationsDir) {
|
|
439
|
+
const core = await coreMigrator(db).getMigrations();
|
|
440
|
+
const project = await projectMigrator(db, migrationsDir).getMigrations();
|
|
441
|
+
return [
|
|
442
|
+
...core.map((m) => ({ stream: 'core', name: m.name, executedAt: m.executedAt ?? null })),
|
|
443
|
+
...project.map((m) => ({ stream: 'project', name: m.name, executedAt: m.executedAt ?? null })),
|
|
444
|
+
];
|
|
445
|
+
}
|
|
446
|
+
async function pendingMigrations(db, migrationsDir) {
|
|
447
|
+
return (await migrationStatus(db, migrationsDir)).filter((m) => !m.executedAt);
|
|
448
|
+
}
|
|
449
|
+
//# sourceMapp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AE,CAAC,CAAC;KACxG,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,EAAe,EAAE,aAAqB;IAC5E,OAAO,CAAC,MAAM,eAAe,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AACjF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencloudcms/db",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "Database connection, system migrations and migrator for OpenCloudCMS",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/anhdev97/Open-CMS.git",
|
|
12
|
+
"directory": "packages/db"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/anhdev97/Open-CMS#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/anhdev97/Open-CMS/issues"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22"
|
|
20
|
+
},
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"jiti": "^2.4.0",
|
|
28
|
+
"kysely": "^0.28.0",
|
|
29
|
+
"pg": "^8.13.0",
|
|
30
|
+
"@opencloudcms/schema": "0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/pg": "^8.23.1"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
38
|
+
}
|
|
6
39
|
}
|