@@ -11,6 +11,7 @@ export default async function main(exit = false) {
|
|||||||
const work = async (page: number): Promise<void> => {
|
const work = async (page: number): Promise<void> => {
|
||||||
console.log(`Backfill user notification settings… page ${page}`);
|
console.log(`Backfill user notification settings… page ${page}`);
|
||||||
const users = await User.findAll({
|
const users = await User.findAll({
|
||||||
|
attributes: ["id", "notificationSettings"],
|
||||||
limit,
|
limit,
|
||||||
offset: page * limit,
|
offset: page * limit,
|
||||||
order: [["createdAt", "ASC"]],
|
order: [["createdAt", "ASC"]],
|
||||||
|
|||||||
@@ -13,9 +13,28 @@ export default async function main(exit = false, limit = 1000) {
|
|||||||
let documents: Document[] = [];
|
let documents: Document[] = [];
|
||||||
await sequelize.transaction(async (transaction) => {
|
await sequelize.transaction(async (transaction) => {
|
||||||
documents = await Document.unscoped().findAll({
|
documents = await Document.unscoped().findAll({
|
||||||
attributes: {
|
attributes: [
|
||||||
exclude: ["state"],
|
"id",
|
||||||
},
|
"urlId",
|
||||||
|
"title",
|
||||||
|
"template",
|
||||||
|
"emoji",
|
||||||
|
"text",
|
||||||
|
"revisionCount",
|
||||||
|
"archivedAt",
|
||||||
|
"publishedAt",
|
||||||
|
"collaboratorIds",
|
||||||
|
"importId",
|
||||||
|
"parentDocumentId",
|
||||||
|
"lastModifiedById",
|
||||||
|
"createdById",
|
||||||
|
"templateId",
|
||||||
|
"teamId",
|
||||||
|
"collectionId",
|
||||||
|
"createdAt",
|
||||||
|
"updatedAt",
|
||||||
|
"deletedAt",
|
||||||
|
],
|
||||||
where: {
|
where: {
|
||||||
version: {
|
version: {
|
||||||
[Op.ne]: null,
|
[Op.ne]: null,
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ export default async function main(exit = false, limit = 1000) {
|
|||||||
let revisions: Revision[] = [];
|
let revisions: Revision[] = [];
|
||||||
await sequelize.transaction(async (transaction) => {
|
await sequelize.transaction(async (transaction) => {
|
||||||
revisions = await Revision.unscoped().findAll({
|
revisions = await Revision.unscoped().findAll({
|
||||||
attributes: {
|
attributes: ["id", "title", "emoji"],
|
||||||
exclude: ["text"],
|
|
||||||
},
|
|
||||||
limit,
|
limit,
|
||||||
offset: page * limit,
|
offset: page * limit,
|
||||||
order: [["createdAt", "ASC"]],
|
order: [["createdAt", "ASC"]],
|
||||||
|
|||||||
Reference in New Issue
Block a user