Waavi / translation

Better translation management for Laravel
MIT License
359 stars 167 forks source link

After integration -> Unittest fails: Foreign Constraint #151

Closed Co0olCat closed 5 years ago

Co0olCat commented 5 years ago

Hi,

After adding translation package the unit test for the recepient (my) project fails: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 foreign key mismatch - "translator_translations" referencing "translator_languages" (SQL: INSERT INTO translator_languages (id, locale, name, created_at, updated_at, deleted_at) SELECT id, locale, name, created_at, updated_at, deleted_at FROM temptranslator_languages)

I am using in memory sqlite DB for unit tests:

In phpunit.xml:

With production DB (Postgres) -> every thing tests fine.

Commenting in /var/www/.../vendor/waavi/translation/database/migrations/2013_07_25_145958_create_translations_table.php -> line 25 with "foreign" -> resolves issue.

Please advise.

Thank you.

Kind regards, TY

midweste commented 5 years ago

Same issue here, but I'm using an actual .sqlite file for unit testing

midweste commented 5 years ago

Looks like a dbal/laravel issue when working with sqlite: https://github.com/laravel/framework/issues/24876 Nothing inherently wrong with the module, this can probably be closed

tim-kilian commented 4 years ago

I am facing the same issue.. The problem is, that the locale is not the primary key of the translator_languages table, whereby sqlite needs to reference primary keys. I also think that the locale should be the primary key for the langauges table.