Fix error when creating a fresh database
This commit is contained in:
parent
6086242524
commit
59c857da59
|
@ -94,6 +94,7 @@ export class FollowingAddComponent implements OnInit {
|
||||||
this.followService.follow(notEmptyHosts).subscribe(
|
this.followService.follow(notEmptyHosts).subscribe(
|
||||||
status => {
|
status => {
|
||||||
this.notificationsService.success('Success', 'Follow request(s) sent!')
|
this.notificationsService.success('Success', 'Follow request(s) sent!')
|
||||||
|
this.router.navigate([ '/admin/follows/following-list' ])
|
||||||
},
|
},
|
||||||
|
|
||||||
err => this.notificationsService.error('Error', err.message)
|
err => this.notificationsService.error('Error', err.message)
|
||||||
|
|
|
@ -89,7 +89,12 @@ database.init = async (silent: boolean) => {
|
||||||
|
|
||||||
for (const modelName of Object.keys(database)) {
|
for (const modelName of Object.keys(database)) {
|
||||||
if ('associate' in database[modelName]) {
|
if ('associate' in database[modelName]) {
|
||||||
database[modelName].associate(database)
|
try {
|
||||||
|
database[modelName].associate(database)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Cannot associate model %s.', modelName, err)
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,6 @@ function associate (models) {
|
||||||
name: 'accountId',
|
name: 'accountId',
|
||||||
allowNull: false
|
allowNull: false
|
||||||
},
|
},
|
||||||
as: 'following',
|
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -264,7 +263,6 @@ function associate (models) {
|
||||||
name: 'targetAccountId',
|
name: 'targetAccountId',
|
||||||
allowNull: false
|
allowNull: false
|
||||||
},
|
},
|
||||||
as: 'followers',
|
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue