codestudiohq / laravel-totem

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

[TESTS] SQLite can't run migrations of totem #39

Closed Arkanius closed 7 years ago

Arkanius commented 7 years ago

Laravel has some problem with various itens in down method of migrations. One example of it is when you're trying to run tests in memory with SQLite.

I know that's really strange; but, I just installed Totem and all my tests stop passing accusing the same migration problem:

"Caused by Doctrine\DBAL\Driver\PDOException: SQLSTATE[HY000]: General error: 1 no such column: notification_phone_number"

The reason of it is because the down method of migration alter_tasks_table_add_notifications_fields has many drop options in a unique schema.

A possible fix is to separe it in "n" schemas, like:

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_phone_number');
    });

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_slack_webhook');
    });`

instead of:

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_phone_number');
        $table->dropColumn('notification_slack_webhook');
    });

Again, I know that it's strange, but, is a solution provided by own Taylor (https://github.com/laravel/framework/issues/2979)

roshangautam commented 7 years ago

Weird, my tests never fail and I use sqlite for testing as well. Also, you are not required to run totem tests unless you are developing something for totem. Can you help me understand how are totem tests triggering from your application ?

Arkanius commented 7 years ago

The problem is not about running tests of Totem, I published the vendor of Totem, so, I ran migration to create its tables. Now, my tests are trying to create the table of Totem. That's how I got this problem.

roshangautam commented 7 years ago

Got it. I will merge your pull request.