tracker: Laravel 5.4 migration problem
When installing tracker on fresh Laravel 5.4 i get this error:
PHP Fatal error: Call to a member function getCode() on null in D:\_Instal\xampp\htdocs\cheebamba\vendor\laravel\framework\src\Illuminate\Database\QueryException.php on line 38
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getCode() on null
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 23 (5 by maintainers)
For those having
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'updated_at'
, you have to setstrict => false
on your database connection:I did edit create_tracker_agents_table.php and changed ,
$table->string('name')->unique();
to
$table->string('name',255);
and then added
$table->unique('name');
so my create would look like this,
$table->bigIncrements('id');
$table->string('name',255);
$table->string('browser')->index();
$table->string('browser_version');
$table->timestamp('created_at')->index();
$table->timestamp('updated_at')->index();
$table->unique('name');
and then edited fix_agent_name.php and changed
$table->mediumText('name')->unique()->change();
to
$table->string('name',255)->unique()->change();
for me this solved that key length problem and everything migrated successfully.
Solved it.
2017_01_31_311101_fix_agent_name.php
.2015_03_07_311076_create_tracker_agents_table.php
, changeline 26
fromto
I just removed the ‘fix_agent_name’ migration and everything worked as intented
Yes, this error got fixed, but now im getting on newest Laravel and newest xampp and easyphp this error:
Laravel’s default $table->timestamps() migration method calls nullable() on created_at and updated_at, so why aren’t we doing this when calling timestamp(‘created_at’)->index() ? Why not do this in each of the migrations: