@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.mjs
CHANGED
|
@@ -6328,7 +6328,8 @@ const createdLocale = {
|
|
|
6328
6328
|
if (!model) {
|
|
6329
6329
|
continue;
|
|
6330
6330
|
}
|
|
6331
|
-
|
|
6331
|
+
const hasLocaleColumn = await knex2.schema.hasColumn(meta.tableName, "locale");
|
|
6332
|
+
if (meta.attributes.locale && !hasLocaleColumn) {
|
|
6332
6333
|
await createLocaleColumn(knex2, meta.tableName);
|
|
6333
6334
|
}
|
|
6334
6335
|
}
|
|
@@ -6337,10 +6338,39 @@ const createdLocale = {
|
|
|
6337
6338
|
throw new Error("not implemented");
|
|
6338
6339
|
}
|
|
6339
6340
|
};
|
|
6341
|
+
const createPublishedAtColumn = async (db, tableName) => {
|
|
6342
|
+
await db.schema.alterTable(tableName, (table) => {
|
|
6343
|
+
table.string("published_at");
|
|
6344
|
+
});
|
|
6345
|
+
};
|
|
6346
|
+
const createdPublishedAt = {
|
|
6347
|
+
name: "5.0.0-04-created-published-at",
|
|
6348
|
+
async up(knex2, db) {
|
|
6349
|
+
for (const meta of db.metadata.values()) {
|
|
6350
|
+
const hasTable = await knex2.schema.hasTable(meta.tableName);
|
|
6351
|
+
if (!hasTable) {
|
|
6352
|
+
continue;
|
|
6353
|
+
}
|
|
6354
|
+
const uid = meta.uid;
|
|
6355
|
+
const model = strapi.getModel(uid);
|
|
6356
|
+
if (!model) {
|
|
6357
|
+
continue;
|
|
6358
|
+
}
|
|
6359
|
+
const hasPublishedAtColumn = await knex2.schema.hasColumn(meta.tableName, "published_at");
|
|
6360
|
+
if (meta.attributes.publishedAt && !hasPublishedAtColumn) {
|
|
6361
|
+
await createPublishedAtColumn(knex2, meta.tableName);
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
},
|
|
6365
|
+
async down() {
|
|
6366
|
+
throw new Error("not implemented");
|
|
6367
|
+
}
|
|
6368
|
+
};
|
|
6340
6369
|
const internalMigrations = [
|
|
6341
6370
|
renameIdentifiersLongerThanMaxLength,
|
|
6342
6371
|
createdDocumentId,
|
|
6343
|
-
createdLocale
|
|
6372
|
+
createdLocale,
|
|
6373
|
+
createdPublishedAt
|
|
6344
6374
|
];
|
|
6345
6375
|
const createInternalMigrationProvider = (db) => {
|
|
6346
6376
|
const context = { db };
|