Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix error when creating a fresh database

Chocobozzz59c857da5961
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts
index 0ceb4c1dba..814c6f1a1c 100644
--- a/client/src/app/+admin/follows/following-add/following-add.component.ts
+++ b/client/src/app/+admin/follows/following-add/following-add.component.ts
@@ -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)
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 19b5a0466c..0a716e4fb0 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -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)
+ }
}
}
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index ee00c5aef9..464105261a 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -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'
})
}