codestudiohq / laravel-totem

Manage Your Laravel Schedule From A Web Dashboard
MIT License
1.8k stars 224 forks source link

Migrations fail on MySQL 8 #255

Closed daniel-g-wood closed 3 years ago

daniel-g-wood commented 4 years ago

I've run the migrations against a MySQL database, and they are failing on the following migration: 2019_09_25_103421_update_task_results_duration_type

with the following 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 'character set collate '' not null default '0'' at line 1 (SQL: alter table `task_results` add `duration` decimal(24, 14) character set collate '' not null default '0')

Unfortunately this is not an easy one to design tests for. I temporarily pointed the tests at a temporary MySQL database and was able to reproduce the error. Removing this: ->charset('')->collation('')

from $table->decimal('duration', 24, 14)->default(0.0)->charset('')->collation('');

made the tests pass using the default SQLite database, but they failed using the MySQL database on ViewDashboardTest::view_dashboard_single_task_with_results until I added the RefreshDatabase trait.

I'm happy to submit a pull request that removes those two chained methods, but I'm unsure what they are there for, and I am concerned that removing them may break backwards compatibility.

qschmick commented 4 years ago

@daniel-g-wood Yes please open the PR, really appreciate it. This was my bad doing too many updates at once between this, work, and a few other projects. Meant to drop those lines and didn't 🤦 Thanks

daniel-g-wood commented 4 years ago

Closed the previous issue (with messy commit history) and opened this one instead: #258.

qschmick commented 3 years ago

Fixed in both v7 and v8. https://github.com/codestudiohq/laravel-totem/releases/tag/v7.0.3 https://github.com/codestudiohq/laravel-totem/releases/tag/v8.0.1