HD3D I'm not sure whether there's an issue with Gamification itself or not, but to solve this you will need to manually add/remove columns to the database, or add the migration to the migrations table to tell Flarum it has already run so it can skip it.

You can see what each migration does here https://github.com/FriendsOfFlarum/gamification/tree/master/migrations Gamification has a lot of them. I think your error happens in https://github.com/FriendsOfFlarum/gamification/blob/3b9619ef779e38391c23ed97018136c07fcf6176/migrations/2020_07_09_000000_change_post_votes_type_column.php . If you already have that column, you can manually add an entry for 2020_07_09_000000_change_post_votes_type_column - fof-gamification in the migrations table.

Seeing that migration has a big loop in it, I suspect you tried to run it once on a large amount of data and it must have failed mid-way. To avoid this in the future, always try to run php flarum migrate from the command line instead of disabling and re-enabling extensions, and make sure the command line has unlimited execution time and enough memory.

If the script indeed failed during that migration, you most likely have a partially migrated database from simple votes to value-based votes. You would know if that's the case if you still have the type column on post_votes which is supposed to be deleted at the end of the migration. You might want to restore from backup and attempt the migration again to make sure your database integrity is good.

    clarkwinkelmann Yes I do have type column on post_votes

    I'm not good at database so I don't think I can perform above steps, but if I restore yesterday's backup of database, is it not gonna delete all posts and discussions from yesterday till now?

    I don't want to lose posts at all, so what should I do? I mean if it is that hard to fix it then can I still run my forum normally without gamification with that error or is removing gamification and reinstalling it gonna fix the database itself?

    Currently my forum is running fine without gamification extension enabled.

      HD3D I think the easiest solution might be to remove the value column manually, enable the extension by adding the fof-gamification ID to the list of enabled extensions in the enabled_extensions key in the settings table (it's a JSON-encoded array), then run php flarum migrate.

      Enabling the extension via the frontend would probably result in the same error happening again if it's due to the request timing out, so enabling it by editing the settings table then running the migration on the command line should succeed.

      Obviously, it's best to make one more backup just before this procedure.

      To prevent this kind of issue for happening again (assuming it was a request timeout that created the issue in the first place), you should always have all extensions enabled while you perform an update, so that you can run php flarum migrate. But I know there's a bit of a contradiction here with Flarum update steps since Flarum update recommends disabling extensions, but then this leads to migrations running on the web server instead of the command line and could time out migrations like these.

      I hope my explanations are not too confusing 😅

        clarkwinkelmann 😕
        It is more than confusing sir.

        If you can guide me though the exact steps I need to follow but what you're telling me all just hints, that's where I have no idea how to follow because I don't have good knowledge in mysql.
        All I have is phpmyadmin so it will be a lot easier if you can help me with the commands that need to run to fix gamification.

        But if it is that hard, I better not mess up with the database, so is it safe to remove the gamification extension through ssh and reinstall or it or just remove it and run the forum without it?

          HD3D you might want to use the help of a freelancer to cleanly update or remove the extension at this point.

          Keeping the database like it is with the extension disabled is probably fine, and you can remove the extension with Composer. However you can't re-install the extension without first manually fixing the database.

          0.3.1

          • Beta 14
          • Small change to hotness algorithm
          • Use native sort for trending

          php flarum cache:clear

            😢 I’ve never been able to use this extension. I’ve tried using it off and on since beta 8. There’s always an error either visible or in my logs. Each time I install it there’s something different. This time there’s an error in the admin that says “couldn’t load full version of site.” And when I upvote/downvote in the frontend, I get the oops I did it again error and the vote count doesn’t change. But, I can refresh the page and then the vote count changes. Maybe this extension doesn’t like shared hosting. Because that’s the type of hosting I use and again, it’s never worked right for me. 🤷‍♂️

            And, I’ll add it’s just this extension. I never have log errors or visible errors typically. I say this because I think this speaks to the fact that my Flarum installations are installed correctly.

            [2020-12-05 04:16:03] flarum.ERROR: BadMethodCallException: Call to undefined method Flarum\Post\CommentPost::votes() in  /vendor/illuminate/support/Traits/ForwardsCalls.php:50
            Stack trace:
            #0  /vendor/illuminate/support/Traits/ForwardsCalls.php(36): Illuminate\Database\Eloquent\Model::throwBadMethodCallException('votes')
            #1  /vendor/illuminate/database/Eloquent/Model.php(1622): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'votes', Array)
            #2  /vendor/flarum/core/src/Database/AbstractModel.php(205): Illuminate\Database\Eloquent\Model->__call('votes', Array)
            #3  /vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php(206): Flarum\Database\AbstractModel->__call('votes', Array)
            #4  /vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php(135): FoF\Gamification\Listeners\SaveVotesToDatabase->pushNewVote(Object(FoF\Gamification\Vote))
            #5  /vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php(97): FoF\Gamification\Listeners\SaveVotesToDatabase->vote(Object(Flarum\Post\CommentPost), false, false, Object(Flarum\User\User), Object(Flarum\User\User))
            #6  /vendor/illuminate/events/Dispatcher.php(389): FoF\Gamification\Listeners\SaveVotesToDatabase->handle(Object(Flarum\Post\Event\Saving))
            #7  /vendor/illuminate/events/Dispatcher.php(218): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}('Flarum\\Post\\Eve...', Array)
            #8  /vendor/flarum/core/src/Post/Command/EditPostHandler.php(79): Illuminate\Events\Dispatcher->dispatch('Flarum\\Post\\Eve...')
            #9  /vendor/illuminate/bus/Dispatcher.php(90): Flarum\Post\Command\EditPostHandler->handle(Object(Flarum\Post\Command\EditPost))
            #10  /vendor/illuminate/pipeline/Pipeline.php(130): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Flarum\Post\Command\EditPost))
            #11  /vendor/illuminate/pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Flarum\Post\Command\EditPost))
            #12  /vendor/illuminate/bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
            #13  /vendor/illuminate/bus/Dispatcher.php(76): Illuminate\Bus\Dispatcher->dispatchNow(Object(Flarum\Post\Command\EditPost))
            #14  /vendor/flarum/core/src/Api/Controller/UpdatePostController.php(57): Illuminate\Bus\Dispatcher->dispatch(Object(Flarum\Post\Command\EditPost))
            #15  /vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(96): Flarum\Api\Controller\UpdatePostController->data(Object(Laminas\Diactoros\ServerRequest), Object(Tobscure\JsonApi\Document))
            #16  /vendor/flarum/core/src/Http/RouteHandlerFactory.php(38): Flarum\Api\Controller\AbstractSerializeController->handle(Object(Laminas\Diactoros\ServerRequest))
            #17  /vendor/flarum/core/src/Http/Middleware/DispatchRoute.php(65): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}(Object(Laminas\Diactoros\ServerRequest), Array)
            #18  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\DispatchRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
            #19  /vendor/flarum/core/src/Http/Middleware/SetLocale.php(50): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #20  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #21  /vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(45): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #22  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #23  /vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(55): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #24  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #25  /vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(32): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #26  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #27  /vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #28  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #29  /vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #30  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #31  /vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #32  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Api\Middleware\FakeHttpMethods->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #33  /vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #34  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #35  /vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #36  /vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #37  /vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #38  /vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #39  /vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\RequestHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #40  /vendor/middlewares/base-path-router/src/BasePathRouter.php(97): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #41  /vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #42  /vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(42): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #43  /vendor/laminas/laminas-stratigility/src/Next.php(61): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #44  /vendor/middlewares/base-path/src/BasePath.php(53): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #45  /vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #46  /vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #47  /vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(73): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
            #48  /vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
            #49  /vendor/flarum/core/src/Http/Server.php(42): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()

              Thank you very much for your time & update, but the extension seems to work and has settings and all, but this error shows up:

              Uncaught TypeError: Cannot convert undefined or null to object
                  at Function.keys (<anonymous>)
                  at Function.b [as route] (router.js:42)
                  at Object.app.extensionSettings.fof-gamification (addSettingsPage.js:9)
                  at e.n.mount (AdminApplication.js:47)
                  at e.boot (Application.js:176)
                  at admin:88

              Still, nothing seems to break at all... I can configure the settings, but it reports that something is wrong with them. Weird.

              php flarum info:

              Flarum core 0.1.0-beta.14.1
              PHP version: 7.2.24-0ubuntu0.18.04.7
              Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection, SPL, sodium, session, standard, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, json, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache
              +-------------------------------------+------------------+------------------------------------------+
              | Flarum Extensions                   |                  |                                          |
              +-------------------------------------+------------------+------------------------------------------+
              | ID                                  | Version          | Commit                                   |
              +-------------------------------------+------------------+------------------------------------------+
              | flarum-approval                     | v0.1.0-beta.14   |                                          |
              | flarum-bbcode                       | v0.1.0-beta.12   |                                          |
              | flarum-emoji                        | v0.1.0-beta.14   |                                          |
              | flarum-lang-english                 | v0.1.0-beta.14.1 |                                          |
              | flarum-flags                        | v0.1.0-beta.14.1 |                                          |
              | flarum-likes                        | v0.1.0-beta.14   |                                          |
              | flarum-lock                         | v0.1.0-beta.14   |                                          |
              | flarum-markdown                     | v0.1.0-beta.14   |                                          |
              | flarum-mentions                     | v0.1.0-beta.14   |                                          |
              | flarum-statistics                   | v0.1.0-beta.14   |                                          |
              | flarum-sticky                       | v0.1.0-beta.14   |                                          |
              | flarum-subscriptions                | v0.1.0-beta.14   |                                          |
              | flarum-suspend                      | v0.1.0-beta.14   |                                          |
              | fof-sitemap                         | 0.5.4            |                                          |
              | migratetoflarum-canonical           | 0.2.2            |                                          |
              | clarkwinkelmann-author-change       | 0.2.1            |                                          |
              | neercsys-bosanski                   | v0.37            |                                          |
              | neercsys-lang-bosanski              | v0.14            |                                          |
              | tiu-ram0n-brazilian-portuguese      | 1.1.22           |                                          |
              | clarkwinkelmann-create-user-modal   | 1.1.0            |                                          |
              | madnest-lang-czech                  | v0.1.0-beta.14.1 |                                          |
              | clarkwinkelmann-emojionearea        | 0.3.0            |                                          |
              | fof-doorman                         | 0.2.0            |                                          |
              | askvortsov-moderator-warnings       | v0.3.2           |                                          |
              | fof-analytics                       | 0.10.1           |                                          |
              | fof-bbcode-details                  | 0.1.0            |                                          |
              | fof-ban-ips                         | 0.3.0            |                                          |
              | kakifrucht-de                       | 0.13.1           |                                          |
              | michaelbelgium-discussion-views     | v5.0.0           |                                          |
              | michaelbelgium-dutch                | v7.1.0           |                                          |
              | flarum-embed                        | v0.1.0-beta.14   |                                          |
              | fof-best-answer                     | 0.2.0            |                                          |
              | fof-default-group                   | 0.2.0            |                                          |
              | fof-default-user-preferences        | 0.2.0            |                                          |
              | fof-drafts                          | 0.2.1            |                                          |
              | fof-filter                          | 0.1.0-beta.3     |                                          |
              | fof-upload                          | 0.11.2           |                                          |
              | clarkwinkelmann-first-post-approval | 0.1.2            |                                          |
              | flarum-tags                         | v0.1.0-beta.14   |                                          |
              | askvortsov-categories               | v1.1.0           |                                          |
              | fof-byobu                           | 0.6.0-beta.2     |                                          |
              | fof-formatting                      | 0.2.0            |                                          |
              | fof-gamification                    | 0.3.1            | 60f48bd67e7659b8524e9a46c6db5a644a64b145 |
              +-------------------------------------+------------------+------------------------------------------+
              Debug mode: ON

              I am testing beta.14 upgrade on a test FreeFlarum beta.14 forum. If this error would be fixed, that'd be perfect. Thanks.

                0.3.2

                • Patch up a few remaining issues (SKevo 010101 )
                • Replace deprecated code
                Updating
                composer require fof/gamification
                php flarum cache:clear

                  karaok Thanks for working on this. This update didn’t resolve my issue. Voting triggers the error log in my post above.

                    SKevo Glad that's fixed it for you

                    010101 This is annoying me that it's not behaving for you. Could you please share your php flarum info? I'd like to replicate your setup as closely as possible to see if I can get to the bottom of this for you

                      karaok

                      Flarum core 0.1.0-beta.14.1
                      PHP version: 7.4.13
                      Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, enchant, hash, fileinfo, filter, ftp, gd, gettext, gmp, SPL, iconv, session, intl, json, mbstring, standard, mysqlnd, pcntl, mysqli, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, imap, shmop, SimpleXML, soap, sockets, sodium, exif, sysvmsg, sysvsem, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, memcached, ionCube Loader, Zend OPcache
                      +-------------------------------------+------------------+--------+
                      | Flarum Extensions                   |                  |        |
                      +-------------------------------------+------------------+--------+
                      | ID                                  | Version          | Commit |
                      +-------------------------------------+------------------+--------+
                      | flarum-approval                     | v0.1.0-beta.14   |        |
                      | flarum-emoji                        | v0.1.0-beta.14   |        |
                      | flarum-lang-english                 | v0.1.0-beta.14.1 |        |
                      | flarum-flags                        | v0.1.0-beta.14.1 |        |
                      | flarum-lock                         | v0.1.0-beta.14   |        |
                      | flarum-mentions                     | v0.1.0-beta.14   |        |
                      | flarum-statistics                   | v0.1.0-beta.14   |        |
                      | flarum-sticky                       | v0.1.0-beta.14   |        |
                      | flarum-subscriptions                | v0.1.0-beta.14   |        |
                      | flarum-suspend                      | v0.1.0-beta.14   |        |
                      | flarum-tags                         | v0.1.0-beta.14   |        |
                      | fof-linguist                        | 0.4.4            |        |
                      | clarkwinkelmann-first-post-approval | 0.1.2            |        |
                      | fof-user-bio                        | 0.3.1            |        |
                      | fof-upload                          | 0.11             |        |
                      | clarkwinkelmann-bookmarks           | 0.1.1            |        |
                      | fof-drafts                          | 0.2.0            |        |
                      | fof-ignore-users                    | 0.2.0            |        |
                      | fof-links                           | 0.4.1            |        |
                      | fof-merge-discussions               | 0.4.0            |        |
                      | fof-nightmode                       | 0.6.0            |        |
                      | fof-profile-image-crop              | 0.2.0            |        |
                      | fof-share-social                    | 0.2.0            |        |
                      | fof-spamblock                       | 0.3.0            |        |
                      | fof-split                           | 0.5.0            |        |
                      | fof-stopforumspam                   | 0.3.1            |        |
                      | zerosonesfun-hashtags               | 3.7              |        |
                      | zerosonesfun-elint                  | 1.8              |        |
                      | askvortsov-pwa                      | v1.1.2           |        |
                      | fof-terms                           | 0.5.0            |        |
                      | flarum-pusher                       | v0.1.0-beta.14.1 |        |
                      | fof-pages                           | 0.5.0            |        |
                      | v17development-seo                  | 1.4              |        |
                      | fof-sitemap                         | 0.5.4            |        |
                      | zerosonesfun-chords                 | 1.2              |        |
                      | fof-oauth                           | 0.1.0            |        |
                      | fof-gamification                    | 0.3.2            |        |
                      +-------------------------------------+------------------+--------+

                        010101 thanks for sharing.

                        I've replicated your install as closely as I can, and am able to vote without error.

                        That said, I see you have pusher enabled, could you try disabling that for a moment and seeing if that helps at all? I'm not currently in a position to setup pusher locally...

                          karaok That’s it. It’s Pusher. And I really don’t care about live updates and so if this can’t be fixed for a while I’m cool with keeping Pusher disabled.

                          Yay, finally for the first time in a year or more I can use this extension! Thank you!! 🙏

                          To think, I just had to disable Pusher... I disabled other extensions trying to fix this but I never disabled Pusher... I just didn’t think Pusher could be the issue. 😳

                            010101 Great 🙂 I'm not that familiar with how pusher works, so I'd ping @Kyrne or @datitisev for a potential fix.. Might also be worth opening an issue on the repo with the log output if/when you have a moment