@strapi/database 5.0.0-beta.16 → 5.0.0-beta.17
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/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -2
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/internal-migrations/5.0.0-03-locale.d.ts.map +1 -1
- package/dist/migrations/internal-migrations/5.0.0-04-published-at.d.ts +3 -0
- package/dist/migrations/internal-migrations/5.0.0-04-published-at.d.ts.map +1 -0
- package/dist/migrations/internal-migrations/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -6360,7 +6360,8 @@ const createdLocale = {
|
|
|
6360
6360
|
if (!model) {
|
|
6361
6361
|
continue;
|
|
6362
6362
|
}
|
|
6363
|
-
|
|
6363
|
+
const hasLocaleColumn = await knex2.schema.hasColumn(meta.tableName, "locale");
|
|
6364
|
+
if (meta.attributes.locale && !hasLocaleColumn) {
|
|
6364
6365
|
await createLocaleColumn(knex2, meta.tableName);
|
|
6365
6366
|
}
|
|
6366
6367
|
}
|
|
@@ -6369,10 +6370,39 @@ const createdLocale = {
|
|
|
6369
6370
|
throw new Error("not implemented");
|
|
6370
6371
|
}
|
|
6371
6372
|
};
|
|
6373
|
+
const createPublishedAtColumn = async (db, tableName) => {
|
|
6374
|
+
await db.schema.alterTable(tableName, (table) => {
|
|
6375
|
+
table.string("published_at");
|
|
6376
|
+
});
|
|
6377
|
+
};
|
|
6378
|
+
const createdPublishedAt = {
|
|
6379
|
+
name: "5.0.0-04-created-published-at",
|
|
6380
|
+
async up(knex2, db) {
|
|
6381
|
+
for (const meta of db.metadata.values()) {
|
|
6382
|
+
const hasTable = await knex2.schema.hasTable(meta.tableName);
|
|
6383
|
+
if (!hasTable) {
|
|
6384
|
+
continue;
|
|
6385
|
+
}
|
|
6386
|
+
const uid = meta.uid;
|
|
6387
|
+
const model = strapi.getModel(uid);
|
|
6388
|
+
if (!model) {
|
|
6389
|
+
continue;
|
|
6390
|
+
}
|
|
6391
|
+
const hasPublishedAtColumn = await knex2.schema.hasColumn(meta.tableName, "published_at");
|
|
6392
|
+
if (meta.attributes.publishedAt && !hasPublishedAtColumn) {
|
|
6393
|
+
await createPublishedAtColumn(knex2, meta.tableName);
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
},
|
|
6397
|
+
async down() {
|
|
6398
|
+
throw new Error("not implemented");
|
|
6399
|
+
}
|
|
6400
|
+
};
|
|
6372
6401
|
const internalMigrations = [
|
|
6373
6402
|
renameIdentifiersLongerThanMaxLength,
|
|
6374
6403
|
createdDocumentId,
|
|
6375
|
-
createdLocale
|
|
6404
|
+
createdLocale,
|
|
6405
|
+
createdPublishedAt
|
|
6376
6406
|
];
|
|
6377
6407
|
const createInternalMigrationProvider = (db) => {
|
|
6378
6408
|
const context = { db };
|