Fix error when creating a fresh database

pull/128/head
Chocobozzz 2017-11-15 11:25:53 +01:00
parent 6086242524
commit 59c857da59
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 7 additions and 3 deletions

View File

@ -94,6 +94,7 @@ export class FollowingAddComponent implements OnInit {
this.followService.follow(notEmptyHosts).subscribe(
status => {
this.notificationsService.success('Success', 'Follow request(s) sent!')
this.router.navigate([ '/admin/follows/following-list' ])
},
err => this.notificationsService.error('Error', err.message)

View File

@ -89,7 +89,12 @@ database.init = async (silent: boolean) => {
for (const modelName of Object.keys(database)) {
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)
}
}
}

View File

@ -255,7 +255,6 @@ function associate (models) {
name: 'accountId',
allowNull: false
},
as: 'following',
onDelete: 'cascade'
})
@ -264,7 +263,6 @@ function associate (models) {
name: 'targetAccountId',
allowNull: false
},
as: 'followers',
onDelete: 'cascade'
})
}