Open noogen opened 2 years ago
interesting. wonder why this has never popped up before. Probably my Mysql server defaults to the default innodb. i assume your default mysql server engine is set to MyISAM ? so the migrations that do not specify ->engine are going myISAM ? anyhow I agree on the above change. thank you
Yes, I created my database from the cpanel
wizard and it defaulted to MyISAM.
... hah! Eureka, I didn't realize but I just did a search and found similar issue in the past that user didn't really know what happened: https://github.com/cytech/BillingTrack/issues/43
Receiving the following error during initial migration using
php artisan migrate:fresh --seed
or visityour.site.com/setup
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1005 Can't create table xxx.#clients (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table 'clients' add constraint 'clients_industry_id_foreign' foreign key ('industry_id') references 'industries' ('id') on delete no action on update no action)
To Reproduce Steps to reproduce the behavior:
.env
file, database creation, etc....php artisan migrate:fresh --seed
or visityour.site.com/setup
Expected behavior Should not error.
Desktop/Smartphone: Should not matter.
Additional context Issue is due to database engine difference between
clients
InnoDB andindustries
MyISAM table.Instead of manually define database engine everywhere, I recommend to define it at the global/configuration area? https://github.com/cytech/BillingTrack/blob/master/config/database.php#L25