Skip to content

Commit

Permalink
fix: Migration script fails on fresh installation
Browse files Browse the repository at this point in the history
closes #6153
  • Loading branch information
tommoor committed Nov 14, 2023
1 parent ff7f9d6 commit cd359f0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"]],
Expand Down
25 changes: 22 additions & 3 deletions server/scripts/20230815063834-migrate-emoji-in-document-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]],
Expand Down

0 comments on commit cd359f0

Please sign in to comment.