]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix error when creating a fresh database
authorChocobozzz <florian.bigard@gmail.com>
Wed, 15 Nov 2017 10:25:53 +0000 (11:25 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 27 Nov 2017 18:40:52 +0000 (19:40 +0100)
client/src/app/+admin/follows/following-add/following-add.component.ts
server/initializers/database.ts
server/models/account/account.ts

index 0ceb4c1dbaadd0061b0821a58f8a0f3081c1694a..814c6f1a1c2230bd2d0ec48272894ba7677d5db9 100644 (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)
index 19b5a0466c60ed5b6ae84a799b99c5b9897b147b..0a716e4fb0fc34e95f84fa58bb9fc00ab86694b6 100644 (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)
+      }
     }
   }
 
index ee00c5aef926471ca7a81008437b3e9e027befb2..464105261a463bba2e58b03dae10cce89fc5ab29 100644 (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'
   })
 }