Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kashtanoff opened this issue Oct 13, 2016 · 10 comments

Comments

@kashtanoff
Copy link

kashtanoff commented Oct 13, 2016

$ 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"
    }
}

@kashtanoff kashtanoff changed the title migrate:rollback Call to a member function supportsSchemaTransactions() after last composer update migrate:rollback Call to a member function supportsSchemaTransactions() on null, after last composer update Oct 13, 2016
@themsaid
Copy link
Member

supportsSchemaTransactions() is not a core method.

@kashtanoff
Copy link
Author

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

i have problem from this commit 7a35d72#diff-a66c98fc0ca13ef8851970c40f8342d1

@ellej16
Copy link

ellej16 commented Oct 17, 2016

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! 😀

@ellej16
Copy link

ellej16 commented Oct 18, 2016

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

@ahmadazimi
Copy link

ahmadazimi commented Oct 22, 2016

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?

@rasmusdencker
Copy link

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

@ellej16
Copy link

ellej16 commented Oct 25, 2016

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: #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!

.

@OmarFaruque
Copy link

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.

@ellej16
Copy link

ellej16 commented Oct 26, 2016

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!

@OmarFaruque
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants