fix: Migration script fails on fresh installation

closes #6153
This commit is contained in:
Tom Moor
2023-11-14 07:42:53 -05:00
parent ff7f9d68d5
commit cd359f0e76
3 changed files with 24 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ export default async function main(exit = false) {
const work = async (page: number): Promise<void> => {
console.log(`Backfill user notification settings… page ${page}`);
const users = await User.findAll({
attributes: ["id", "notificationSettings"],
limit,
offset: page * limit,
order: [["createdAt", "ASC"]],

View File

@@ -13,9 +13,28 @@ export default async function main(exit = false, limit = 1000) {
let documents: Document[] = [];
await sequelize.transaction(async (transaction) => {
documents = await Document.unscoped().findAll({
attributes: {
exclude: ["state"],
},
attributes: [
"id",
"urlId",
"title",
"template",
"emoji",
"text",
"revisionCount",
"archivedAt",
"publishedAt",
"collaboratorIds",
"importId",
"parentDocumentId",
"lastModifiedById",
"createdById",
"templateId",
"teamId",
"collectionId",
"createdAt",
"updatedAt",
"deletedAt",
],
where: {
version: {
[Op.ne]: null,

View File

@@ -13,9 +13,7 @@ export default async function main(exit = false, limit = 1000) {
let revisions: Revision[] = [];
await sequelize.transaction(async (transaction) => {
revisions = await Revision.unscoped().findAll({
attributes: {
exclude: ["text"],
},
attributes: ["id", "title", "emoji"],
limit,
offset: page * limit,
order: [["createdAt", "ASC"]],