Framework: migrate:rollback Call to a member function supportsSchemaTransactions() on null, after last composer update

Created on 13 Oct 2016  路  10Comments  路  Source: laravel/framework

$ php artisan migrate:rollback
PHP Fatal error:  Call to a member function supportsSchemaTransactions() on null in C:\work\gfadmin\vendor\laravel\framework\src\Illuminate\Database
\Migrations\Migrator.php on line 376

composer.json contents:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "appzcoder/crud-generator": "^1.1",
        "laravelcollective/html": "^5.2",
        "graham-campbell/flysystem": "^3.4",
        "folklore/image": "^0.3.10",
        "spatie/laravel-permission": "^1.5"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

Most helpful comment

Hi @dondencker and @ahmadazimi , As far as I checked jensessegers/laravel-mongodb's source code, it's missing a few key methods/attributes introduced by this particular PR: https://github.com/laravel/framework/pull/15780 . If I remember correctly, one of those are: getSchemaGrammar() and useDefaultSchemaGrammar() on Connection.php (With this being the culprit behind your troubles).

As @dondencker has pointed out rolling back to v5.3.18 works, that could be the easiest route to take, though if you can contact/make a pull request for laravel-mongodb to keep it up to date that'd be lovely.

Cheers!

.

All 10 comments

supportsSchemaTransactions() is not a core method.

this method used in laravel/framework/src/Illuminate/Database
/Migrations/Migrator.php

i have problem from this commit https://github.com/laravel/framework/commit/7a35d728582bdf33a335f82a37cb4bf52cb598d2#diff-a66c98fc0ca13ef8851970c40f8342d1

Hi @kashtanoff ! Facing the same issue you're having, I dug into the framework a bit and replaced
$grammar = $connection->getSchemaGrammar();
(rather, added) with this:
if (is_null($grammar = $connection->getSchemaGrammar())) { $connection->useDefaultSchemaGrammar(); $grammar = $connection->getSchemaGrammar(); }
you should be able to use rollback after doing so.
I know it's hacky as of the moment(and that it should be fixed in the future) but it worked for me.

Hope I helped you out on this! 馃榾

@kashtanoff do a composer update now, they fixed it already 馃榾

I'm using latest version 5.3.19 but I'm still facing this problem when using a custom connection (mongodb) in my migration class.

I've used jenssegers/laravel-mongodb as my mongodb package.
Before upgrading to the 5.3 it works fine but now after upgrading to 5.3 when I try to migrate my mongodb connection migrations class, the following error occurred:

PHP Fatal error:  Call to a member function supportsSchemaTransactions() on null in /private/var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 378
class CreateLogTable extends Migration {
    protected $connection = 'mongodb';
    public function up() {}
}

@ellej16 #15892
$connection->getSchemaGrammar() still is null!

Can anyone help me please?

+1 to @ahmadazimi. Rolled back to Laravel v5.3.18, which works.

Hi @dondencker and @ahmadazimi , As far as I checked jensessegers/laravel-mongodb's source code, it's missing a few key methods/attributes introduced by this particular PR: https://github.com/laravel/framework/pull/15780 . If I remember correctly, one of those are: getSchemaGrammar() and useDefaultSchemaGrammar() on Connection.php (With this being the culprit behind your troubles).

As @dondencker has pointed out rolling back to v5.3.18 works, that could be the easiest route to take, though if you can contact/make a pull request for laravel-mongodb to keep it up to date that'd be lovely.

Cheers!

.

FatalErrorException in MediaController.php line 23:
Call to a member function store() on null

Showing this issue when i try to store my image to folder.

Hi @OmarFaruque , I think you should post that somewhere else, this specific thread is for migration files not being rolled back (and the current topic being laravel-mongodb encountering the same issue).
Oh, and do post your code/ snippet of the code being encountered for your issue wherever you plan on taking that issue.

Hope you find the answer to your problem!

Thanks @ellej16 for your replay, my problem Also solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shopblocks picture shopblocks  路  3Comments

kerbylav picture kerbylav  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

CupOfTea696 picture CupOfTea696  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments