Open ninjasitm opened 4 years ago
Same issue using test environment with sqlite
testing.ERROR: SQLSTATE[HY000]: General error: 1 near "SET": syntax error (SQL: SET FOREIGN_KEY_CHECKS=1;) {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY000): SQLSTATE[HY000]: General error: 1 near \"SET\": syntax error (SQL: SET FOREIGN_KEY_CHECKS=1;) at /home/runner/work/app1t/app1t/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 near \"SET\": syntax error at /home/runner/work/app1t/app1t/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:63, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 near \"SET\": syntax error at /home/runner/work/app1t/app1t/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61)
You could add a Trait as mentioned here, it helped me: https://laracasts.com/discuss/channels/eloquent/foreign-key-constraints-on-seeding
Getting this error when seeding on PostgreSQL:
This is caused by:
This is found on line 173 in seedGeoFile.php;
Fortunately Laravel supports: