Open cars1n opened 1 week ago
Did you use php artisan schema:dump --prune
an any time.
To check this you now would have a file database/schema/mysql-schema.sql
.
I think as this package uses an in memory sqlite driver, the mysql syntax in that file is not fully supported.
btw I am getting the same error on my project.
If you're like me (and others here) that have MySQL migrations that are incompatible with SQLite, you can work around this by modifying vendor/recca0120/laravel-erd/src/Console/Commands/GenerateErd.php
:
my_temp_db
)GenerateErd::setupFakeDatabase()
:config(Arr::dot(array_map(static fn (array $config) => [
'driver' => 'mysql', <-- change to mysql
'database' => 'my_temp_db', <-- change to temp DB name
'prefix' => $config['prefix'] ?? '',
'foreign_key_constraints' => true,
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
], $this->backup['database.connections']), 'database.connections.'));
Might be worth a PR if the maintainers are open to it and I have some time to make this configurable.
I'm also getting this error and have pruned migrations down to a schema dump.
I am currently using laravel sail with mysql as the db. Everything works in communication with my mysql db container. It can run migrations fine, make changes, etc... but when I try to run the php artisan erd:generate in my docker container I get a sqlite error? I have double checked .env file, config/database.php file, docker-compose.yml file, as well as clearing cache and running migrations but nothing has worked. Same error still appears.
php artisan erd:generate
PDOException
SQLSTATE[HY000]: General error: 1 near "AUTO_INCREMENT": syntax error
at vendor/laravel/framework/src/Illuminate/Database/Schema/SqliteSchemaState.php:64 60▕ */ 61▕ public function load($path) 62▕ { 63▕ if ($this->connection->getDatabaseName() === ':memory:') { ➜ 64▕ $this->connection->getPdo()->exec($this->files->get($path)); 65▕ 66▕ return; 67▕ } 68▕
34 artisan:35 Illuminate\Foundation\Console\Kernel::handle()