eve-seat / seat

SeAT 0x. [UNSUPPORTED]
https://github.com/eveseat/seat
MIT License
69 stars 38 forks source link

[BUGFIX] Added migration to set columns last_login and last_login_source... #343

Closed skarp2 closed 9 years ago

skarp2 commented 9 years ago

... columns as nullable. Must use raw queries to achieve this, so perhaps create conditionals to cater for other supported storage methods.

Solves this bug: Failing to install #333 and also an unreported bug when creating a user in back end.

This is the unreported bug that is fixed: When adding new user from back end: URI: /configuration/user/new-user

Exception message:
SQLSTATE[HY000]: General error: 1364 Field 'last_login' doesn't have a default value (SQL: insert into `seat_users` (`email`, `username`, `password`, `activated`, `updated_at`, `created_at`) values (email@address.com, username, KEY-HASH-HERE, 1, 2015-02-05 21:31:37, 2015-02-05 21:31:37))

Caveats

$user->last_login = new \DateTime;

Modify the User model; if last_login and last_login_source is not set, then add the following default values;

skarp2 commented 9 years ago

I now see that

DB::raw() 

is used extensively in the application. app/controllers folder has 73 occurrences. This means that this fix is absolutely the correct one, in my opinion, because the application is committed to SQL syntax anyway.

eve-seat commented 9 years ago

MySQL (and probably MariaDB) are the only supported DB's atm. This fix is ok for that ;)