outl1ne / nova-page-manager

Static page and region manager for Laravel Nova - designed for headless CMS's.
MIT License
178 stars 38 forks source link

Error migration 2019_06_10_000004_add_draft_fields_to_page #63

Closed shahruslan closed 3 years ago

shahruslan commented 3 years ago

Migration 2019_06_10_000004_add_draft_fields_to_page. When I roll back, I get this error. This is because you first delete the column published and then you delete the index. After deleting a column, the index is also deleted automatically. Therefore, I propose to do the following order of commands:

$table->dropForeign($pagesTableName . '_draft_parent_id_foreign');
$table->dropUnique('nova_page_manager_locale_slug_published_unique');
$table->unique(['locale', 'slug'], 'nova_page_manager_locale_slug_unique');

$table->index('locale_parent_id', 'nova_page_manager_locale_parent_id_workaround_index');
$table->dropUnique('nova_page_manager_locale_parent_id_locale_published_unique');
$table->unique(['locale_parent_id', 'locale'], 'nova_page_manager_locale_parent_id_locale_unique');
$table->dropIndex('nova_page_manager_locale_parent_id_workaround_index');

$table->dropColumn('draft_parent_id');
$table->dropColumn('published');
$table->dropColumn('preview_token');

For myself, I fixed these mistakes, but others may have problems.

Tarpsvo commented 3 years ago

Cheers! I reordered the down migration.