I'm trying to use the System Versioned Tables feature of MariaDB 10.3 in Laravel. However, I'm getting the following exception whenever I try to run the artisan migration that alters the table.
C:\htdocs\Computers>php artisan migrate:fresh
Dropped all tables successfully.
Migration table created successfully.
PDOException : SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'row_start'
at C:\htdocs\Computers\database\migrations\2018_07_14_191112_add_system_version_to_computers.php:16
12| * @return void
13| */
14| public function up()
15| {
> 16| DB::connection()->getPdo()->exec("ALTER TABLE `COMPUTERS` ADD SYSTEM VERSIONING;");
17| }
18|
19| /**
20| * Reverse the migrations.
Exception trace:
1 PDO::exec("ALTER TABLE `COMPUTERS` ADD SYSTEM VERSIONING;")
C:\htdocs\Computers\database\migrations\2018_07_14_191112_add_system_version_to_computers.php:16
2 AddSystemVersionToComputers::up()
C:\htdocs\Computers\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:359
Please use the argument -v to see more details.
- I've tried this on an empty table as well as one that already has data
-
I've tried suppressing the PDO exceptions with the following but it acts as if it works but the system versioning is not added when I check the table
DB::connection()->getPdo()->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); -
I am able to add system versioning to the table if I execute the same SQL in HeidiSQL
- I've searched through the Laravel documentation and code for any methods that would allow me to add this table option when created but couldn't find anything.
I could manually work around this but I really want to include this in the Laravel migration files so it will be included in the Git repository.
Thanks in advance for any guidance given.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire