lundi 11 janvier 2016

DISABLE TRIGGER ALL with Laravel DB Seeding Error

I have inherited a project. They have used a database seeder. They have this method;

private function cleanDatabase()
    {
        foreach ($this->tables as $tableName) {
            DB::statement("ALTER TABLE $tableName DISABLE TRIGGER ALL");
            DB::statement("TRUNCATE TABLE $tableName CASCADE");
            DB::statement("ALTER TABLE $tableName ENABLE TRIGGER ALL");
        }
    }

When I run the php artisan db:seed I get the error;

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER ALL' at line 1

This is the only script with it in, so something must be wrong here. I have never used DISABLE TRIGGER ALL in my life so not even sure what it does.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire