Migrate atlasId -> collectionId
This commit is contained in:
@ -53,7 +53,7 @@ const Collection = sequelize.define(
|
||||
// Create intro document if first collection for team
|
||||
const document = await Document.create({
|
||||
parentDocumentId: null,
|
||||
atlasId: collection.id,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
@ -78,7 +78,7 @@ const Collection = sequelize.define(
|
||||
Collection.associate = models => {
|
||||
Collection.hasMany(models.Document, {
|
||||
as: 'documents',
|
||||
foreignKey: 'atlasId',
|
||||
foreignKey: 'collectionId',
|
||||
onDelete: 'cascade',
|
||||
});
|
||||
Collection.belongsTo(models.Team, {
|
||||
@ -99,7 +99,7 @@ Collection.associate = models => {
|
||||
Collection.addHook('afterDestroy', async model => {
|
||||
await Document.destroy({
|
||||
where: {
|
||||
atlasId: model.id,
|
||||
collectionId: model.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user