chore: upgrade sequelize (#965)

* 0.18.0

* chore: Upgrade sequelize 4 -> 5

* fix: migrations v5 support

* fix: Majority of test failures

* fix: the rest of v5 tests
This commit is contained in:
Tom Moor
2019-06-23 15:49:45 -07:00
committed by GitHub
parent 595adeb55f
commit 32f83311f6
35 changed files with 260 additions and 7662 deletions

View File

@@ -23,7 +23,7 @@ export default class Notifications {
// wait until the user has finished editing
if (!event.done) return;
const document = await Document.findById(event.modelId);
const document = await Document.findByPk(event.modelId);
if (!document) return;
const { collection } = document;
@@ -32,7 +32,6 @@ export default class Notifications {
const notificationSettings = await NotificationSetting.findAll({
where: {
userId: {
// $FlowFixMe
[Op.ne]: document.lastModifiedById,
},
teamId: document.teamId,
@@ -73,7 +72,7 @@ export default class Notifications {
}
async collectionCreated(event: Event) {
const collection = await Collection.findById(event.modelId, {
const collection = await Collection.findByPk(event.modelId, {
include: [
{
model: User,
@@ -88,7 +87,6 @@ export default class Notifications {
const notificationSettings = await NotificationSetting.findAll({
where: {
userId: {
// $FlowFixMe
[Op.ne]: collection.createdById,
},
teamId: collection.teamId,

View File

@@ -60,7 +60,7 @@ export default class Slack {
// lets not send a notification on every autosave update
if (event.autosave) return;
const document = await Document.findById(event.modelId);
const document = await Document.findByPk(event.modelId);
if (!document) return;
// never send information on draft documents
@@ -76,7 +76,7 @@ export default class Slack {
});
if (!integration) return;
const team = await Team.findById(document.teamId);
const team = await Team.findByPk(document.teamId);
let text = `${document.createdBy.name} published a new document`;

View File

@@ -17,7 +17,7 @@ export default class Websockets {
case 'documents.unpin':
case 'documents.update':
case 'documents.delete': {
const document = await Document.findById(event.modelId, {
const document = await Document.findByPk(event.modelId, {
paranoid: false,
});
const documents = [await presentDocument(document)];
@@ -32,7 +32,7 @@ export default class Websockets {
});
}
case 'documents.create': {
const document = await Document.findById(event.modelId);
const document = await Document.findByPk(event.modelId);
const documents = [await presentDocument(document)];
const collections = [await presentCollection(document.collection)];
@@ -78,7 +78,7 @@ export default class Websockets {
return;
}
case 'collections.create': {
const collection = await Collection.findById(event.modelId, {
const collection = await Collection.findByPk(event.modelId, {
paranoid: false,
});
const collections = [await presentCollection(collection)];
@@ -106,7 +106,7 @@ export default class Websockets {
}
case 'collections.update':
case 'collections.delete': {
const collection = await Collection.findById(event.modelId, {
const collection = await Collection.findByPk(event.modelId, {
paranoid: false,
});
const collections = [await presentCollection(collection)];