Closed Hiobi closed 4 years ago
We need to find out if this issue is related to a bad old migration, or a fail of the newer migration that runs twice on beta 9.
I studied all the migration commits of the last few versions but couldn't find anything unusual, but still can't definitely guess what happens.
Do you have a backup of your database previous to the beta 9 migration ? Can you check if there is an icon
column in the tags
page before the migration ?
When you say clean install, you mean clean directory install, but existing database ?
If I remember correctly, other users have posted this same issue on the forums and Discord. Not sure if it is an extension or something, but it is definitely not a one-off. Still odd though.
I have seen these other reports. We need someone to provide us with reproducible steps, but so far I haven't seen any common factor in the reports.
Something else I wanted to say above: I understand you disabled tags before the update, and enabled it again after the update ?
This would make a difference because migrations can either be run as part of the Flarum update screen, but if the ext was disabled, then the migrations will only run once it's re-enabled. Still not sure if this could play any role in the error.
Do you have a backup of your database previous to the beta 9 migration ? Can you check if there is an
icon
column in thetags
page before the migration ?
Yes, I have one before the first try to update.
There is already a column icon
on flarum_tags
table.
When you say clean install, you mean clean directory install, but existing database ?
Yes! I meant a clean directory install on existing database. I tried to with a complete clean install, it's works.
Something else I wanted to say above: I understand you disabled tags before the update, and enabled it again after the update ?
Totally, I disabled all extensions then updated Flarum, and re-enabled all extensions.
@Hiobi thank you for those additional details.
Would you be able to share the content of your migrations
table ? You can do an SQL or CSV export of that table via a tool like phpMyAdmin. This might help us find where that column is coming from.
No prob!
It's ok if I paste here my dump .sql
?
Or do you need it somewhere else?
-- MySQL dump 10.13 Distrib 8.0.16, for Linux (x86_64)
--
-- Host: 0.0.0.0 Database: flarum
-- ------------------------------------------------------
-- Server version 5.6.44-86.0
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `flarum_migrations`
--
DROP TABLE IF EXISTS `flarum_migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `flarum_migrations` (
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`extension` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `flarum_migrations`
--
LOCK TABLES `flarum_migrations` WRITE;
/*!40000 ALTER TABLE `flarum_migrations` DISABLE KEYS */;
INSERT INTO `flarum_migrations` VALUES ('2015_02_24_000000_create_access_tokens_table',NULL),('2015_02_24_000000_create_api_keys_table',NULL),('2015_02_24_000000_create_config_table',NULL),('2015_02_24_000000_create_discussions_table',NULL),('2015_02_24_000000_create_email_tokens_table',NULL),('2015_02_24_000000_create_groups_table',NULL),('2015_02_24_000000_create_notifications_table',NULL),('2015_02_24_000000_create_password_tokens_table',NULL),('2015_02_24_000000_create_permissions_table',NULL),('2015_02_24_000000_create_posts_table',NULL),('2015_02_24_000000_create_users_discussions_table',NULL),('2015_02_24_000000_create_users_groups_table',NULL),('2015_02_24_000000_create_users_table',NULL),('2015_09_15_000000_create_auth_tokens_table',NULL),('2015_09_20_224327_add_hide_to_discussions',NULL),('2015_09_22_030432_rename_notification_read_time',NULL),('2015_10_07_130531_rename_config_to_settings',NULL),('2015_10_24_194000_add_ip_address_to_posts',NULL),('2015_09_21_011527_add_is_approved_to_discussions','flarum-approval'),('2015_09_21_011706_add_is_approved_to_posts','flarum-approval'),('2015_09_02_000000_add_flags_read_time_to_users_table','flarum-flags'),('2015_09_02_000000_create_flags_table','flarum-flags'),('2015_05_11_000000_create_posts_likes_table','flarum-likes'),('2015_09_04_000000_add_default_like_permissions','flarum-likes'),('2015_02_24_000000_add_locked_to_discussions','flarum-lock'),('2015_05_11_000000_create_mentions_posts_table','flarum-mentions'),('2015_05_11_000000_create_mentions_users_table','flarum-mentions'),('2015_02_24_000000_add_sticky_to_discussions','flarum-sticky'),('2015_05_11_000000_add_subscription_to_users_discussions_table','flarum-subscriptions'),('2015_05_11_000000_add_suspended_until_to_users_table','flarum-suspend'),('2015_09_14_000000_rename_suspended_until_column','flarum-suspend'),('2015_02_24_000000_create_discussions_tags_table','flarum-tags'),('2015_02_24_000000_create_tags_table','flarum-tags'),('2015_02_24_000000_create_users_tags_table','flarum-tags'),('2015_02_24_000000_set_default_settings','flarum-tags'),('2015_10_19_061223_make_slug_unique','flarum-tags'),('2015_10_31_040129_add_is_spam_to_posts','flarum-akismet'),('2016_01_11_000000_create_flagrow_images_table','flagrow-image-upload'),('2016_01_14_000000_create_socialbuttons_table','davis-socialprofile'),('2016_02_13_000000_create_links_table','sijad-links'),('2015_12_05_042721_change_access_tokens_columns',NULL),('2015_12_17_194247_change_settings_value_column_to_text',NULL),('2016_02_04_095452_add_slug_to_discussions',NULL),('2016_04_11_182821__create_pages_table','sijad-pages'),('2016_04_19_065618_change_links_columns','sijad-links'),('2016_01_13_000000_alter_flagrow_images_table','flagrow-image-upload'),('2016_06_20_000000_add_settings_social_list','avatar4eg-share-social'),('2016_08_28_180020_add_is_html','sijad-pages'),('2016_09_14_000000_add_linkedin_to_list','avatar4eg-share-social'),('2016_09_27_130538_add_is_best_answer_to_posts_table','wiwatsrt-best-answer'),('2016_09_28_130538_add_has_best_answer_to_discussions_table','wiwatsrt-best-answer'),('2016_10_20_000000_create_socialbuttons_column','davis-socialprofile'),('2016_10_21_000000_migrate_data_to_user_column','davis-socialprofile'),('2016_10_22_000000_drop_socialbuttons_table','davis-socialprofile'),('2016_11_03_000000_create_flagrow_files','flagrow-upload'),('2016_11_07_000000_add_remote_id','flagrow-upload'),('2016_11_04_125533_add_signature_to_users','xengine-signature'),('2017_01_20_000000_recipients','flagrow-byobu'),('2016_11_11_000000_add_markdown_string','flagrow-upload'),('2017_01_27_000000_recipients_groups','flagrow-byobu'),('2016_10_06_203438_add_default_best_answer_permissions','wiwatsrt-best-answer'),('2016_10_07_202338_add_best_answer_post_id_to_discussions_table','wiwatsrt-best-answer'),('2016_10_19_040234_add_one_signal_user_id_to_user_table','zurtr-onesignal'),('2017_03_25_013509_add_gender_to_users','reflar-user-management'),('2017_03_25_013808_create_strikes_table','reflar-user-management'),('2017_03_08_102708_add_emailed_to_posts','issyrocks12-filter'),('2017_04_14_000000_uuid','flagrow-upload'),('2017_04_14_000001_downloads_table','flagrow-upload'),('2017_04_19_000000_remove_markdown_string','flagrow-upload'),('2017_04_19_000001_add_tag','flagrow-upload'),('2017_04_19_000002_add_relations','flagrow-upload'),('2017_05_95_134912_add_discussion_id_to_strikes','reflar-user-management'),('2017_05_09_flagrow_fields_table','flagrow-masquerade'),('2017_05_15_flagrow_answers_table','flagrow-masquerade'),('2017_04_07_114138_add_is_private_to_discussions',NULL),('2017_04_07_114138_add_is_private_to_posts',NULL),('2017_04_09_152230_change_posts_content_column_to_mediumtext',NULL),('2017_07_22_000000_add_default_permissions','flarum-approval'),('2017_07_22_000000_add_default_permissions','flarum-flags'),('2017_07_22_000000_add_default_permissions','flarum-lock'),('2017_07_22_000000_add_default_permissions','flarum-sticky'),('2017_07_22_000000_add_default_permissions','flarum-suspend'),('2017_07_22_000000_add_default_permissions','flarum-tags'),('2017_07_22_000000_is_private','flagrow-byobu'),('2016_07_17_000000_add_default_reaction_permissions','reflar-reactions'),('2016_07_17_000000_create_posts_reactions_table','reflar-reactions'),('2017_07_22_000000_create_reactions_table','reflar-reactions'),('2017_09_26_01_create_flagrow_mason_fields_table','flagrow-mason'),('2017_09_26_02_create_flagrow_mason_answers_table','flagrow-mason'),('2017_09_26_03_create_flagrow_mason_discussion_answer_table','flagrow-mason'),('2017_11_07_223624_discussions_add_views','michaelbelgium-discussion-views'),('2017_06_14_flagrow_fields_on_bio','flagrow-masquerade'),('2018_01_26_01_create_polls_table','reflar-polls'),('2018_02_17_01_add_userid','reflar-polls'),('2018_02_17_01_create_polls_table.1','reflar-polls'),('2018_04_27_203645_add_default_poll_permissions','reflar-polls'),('2018_05_02_142343_add_poll_expire_date','reflar-polls'),('2018_05_20_000000_add_cache_valid_to_users','reflar-uncache'),('2017_04_09_000000_create_bazaar_tasks_table','flagrow-bazaar'),('2017_10_04_create_flagrow_canned_messages_table','flagrow-canned-messages'),('2018_08_08_192410_add_icon_to_tags','reflar-koseki'),('2018_01_11_093900_change_access_tokens_columns',NULL),('2018_01_11_094000_change_access_tokens_add_foreign_keys',NULL),('2018_01_11_095000_change_api_keys_columns',NULL),('2018_01_11_101800_rename_auth_tokens_to_registration_tokens',NULL),('2018_01_11_102000_change_registration_tokens_rename_id_to_token',NULL),('2018_01_11_102100_change_registration_tokens_created_at_to_datetime',NULL),('2018_01_11_120604_change_posts_table_to_innodb',NULL),('2018_01_11_155200_change_discussions_rename_columns',NULL),('2018_01_11_155300_change_discussions_add_foreign_keys',NULL),('2018_01_15_071700_rename_users_discussions_to_discussion_user',NULL),('2018_01_15_071800_change_discussion_user_rename_columns',NULL),('2018_01_15_071900_change_discussion_user_add_foreign_keys',NULL),('2018_01_15_072600_change_email_tokens_rename_id_to_token',NULL),('2018_01_15_072700_change_email_tokens_add_foreign_keys',NULL),('2018_01_15_072800_change_email_tokens_created_at_to_datetime',NULL),('2018_01_18_130400_rename_permissions_to_group_permission',NULL),('2018_01_18_130500_change_group_permission_add_foreign_keys',NULL),('2018_01_18_130600_rename_users_groups_to_group_user',NULL),('2018_01_18_130700_change_group_user_add_foreign_keys',NULL),('2018_01_18_133000_change_notifications_columns',NULL),('2018_01_18_133100_change_notifications_add_foreign_keys',NULL),('2018_01_18_134400_change_password_tokens_rename_id_to_token',NULL),('2018_01_18_134500_change_password_tokens_add_foreign_keys',NULL),('2018_01_18_134600_change_password_tokens_created_at_to_datetime',NULL),('2018_01_18_135000_change_posts_rename_columns',NULL),('2018_01_18_135100_change_posts_add_foreign_keys',NULL),('2018_01_30_112238_add_fulltext_index_to_discussions_title',NULL),('2018_01_30_220100_create_post_user_table',NULL),('2018_01_30_222900_change_users_rename_columns',NULL),('2018_07_21_000000_seed_default_groups',NULL),('2018_07_21_000100_seed_default_group_permissions',NULL),('2018_09_15_041340_add_users_indicies',NULL),('2018_09_15_041828_add_discussions_indicies',NULL),('2018_09_15_043337_add_notifications_indices',NULL),('2018_09_15_043621_add_posts_indices',NULL),('2018_09_22_004100_change_registration_tokens_columns',NULL),('2018_09_22_004200_create_login_providers_table',NULL),('2018_10_08_144700_add_shim_prefix_to_group_icons',NULL),('2018_09_29_060444_replace_emoji_shorcuts_with_unicode','flarum-emoji'),('2018_06_27_101500_change_flags_rename_time_to_created_at','flarum-flags'),('2018_06_27_101600_change_flags_add_foreign_keys','flarum-flags'),('2018_06_27_105100_change_users_rename_flags_read_time_to_read_flags_at','flarum-flags'),('2018_09_15_043621_add_flags_indices','flarum-flags'),('2018_06_27_100600_rename_posts_likes_to_post_likes','flarum-likes'),('2018_06_27_100700_change_post_likes_add_foreign_keys','flarum-likes'),('2018_09_15_043621_add_discussions_indices','flarum-lock'),('2018_06_27_102000_rename_mentions_posts_to_post_mentions_post','flarum-mentions'),('2018_06_27_102100_rename_mentions_users_to_post_mentions_user','flarum-mentions'),('2018_06_27_102200_change_post_mentions_post_rename_mentions_id_to_mentions_post_id','flarum-mentions'),('2018_06_27_102300_change_post_mentions_post_add_foreign_keys','flarum-mentions'),('2018_06_27_102400_change_post_mentions_user_rename_mentions_id_to_mentions_user_id','flarum-mentions'),('2018_06_27_102500_change_post_mentions_user_add_foreign_keys','flarum-mentions'),('2018_09_15_043621_add_discussions_indices','flarum-sticky'),('2018_06_27_111400_change_users_rename_suspend_until_to_suspended_until','flarum-suspend'),('2018_06_27_085200_change_tags_columns','flarum-tags'),('2018_06_27_085300_change_tags_add_foreign_keys','flarum-tags'),('2018_06_27_090400_rename_users_tags_to_tag_user','flarum-tags'),('2018_06_27_100100_change_tag_user_rename_read_time_to_marked_as_read_at','flarum-tags'),('2018_06_27_100200_change_tag_user_add_foreign_keys','flarum-tags'),('2018_06_27_103000_rename_discussions_tags_to_discussion_tag','flarum-tags'),('2018_06_27_103100_add_discussion_tag_foreign_keys','flarum-tags'),('2017_10_16_000000_add_command_to_tasks_table','flagrow-bazaar'),('2018_11_21_000000_alter_tasks_change_output','flagrow-bazaar'),('2018_11_30_141817_discussions_rename_views','michaelbelgium-discussion-views'),('2018_04_30_create_flagrow_terms_policies','flagrow-terms'),('2018_04_30_create_flagrow_terms_policy_user','flagrow-terms'),('2018_08_02_124505_rename_posts_reactions_to_post_reactions','reflar-reactions'),('2018_08_02_133402_change_reaction_id','reflar-reactions'),('2018_08_02_200500_change_post_reactions_add_foreign_keys','reflar-reactions'),('2017_11_29_204708_users_add_views','michaelbelgium-profile-views'),('2017_12_28_091742_add_unique','michaelbelgium-profile-views'),('2018_12_01_095958_rename_table_profile_views','michaelbelgium-profile-views'),('2018_12_01_100540_rename_remove_columns','michaelbelgium-profile-views'),('2018_12_01_103657_add_viewer_id','michaelbelgium-profile-views'),('2019_01_12_103741_drop_ip_views','michaelbelgium-profile-views'),('2019_01_12_104853_add_visited_at_views','michaelbelgium-profile-views'),('2018_01_10_000000_migrate_extension_settings','fof-recaptcha'),('2019_02_05_000000_migrate_from_fa_4','fof-socialprofile'),('2019_02_05_000001_create_socialbuttons_column','fof-socialprofile'),('2016_04_11_182821__create_pages_table','fof-pages'),('2016_08_28_180020_add_is_html','fof-pages'),('2016_02_13_000000_create_links_table','fof-links'),('2016_04_19_065618_change_links_columns','fof-links'),('2018_05_01_000000_add_frontpage_table','fof-frontpage'),('2018_05_02_000000_add_default_permissions','fof-frontpage'),('2017_04_09_224815_create_posts_votes_table','reflar-gamification'),('2017_04_09_225024_add_votes_to_users','reflar-gamification'),('2017_04_24_094425_add_hotness_to_discussions','reflar-gamification'),('2017_04_25__133721_add_default_vote_permissions','reflar-gamification'),('2017_04_26_202436_create_users_ranks_table','reflar-gamification'),('2017_04_26_202644_create_ranks_table','reflar-gamification'),('2017_08_11_225322_add_default_ranking_permission','reflar-gamification'),('2017_09_05_214452_add_time_attribute_to_users','reflar-gamification'),('2018_08_02_110300_rename_users_ranks_to_rank_user','reflar-gamification'),('2018_08_02_110400_rename_posts_votes_to_post_votes','reflar-gamification'),('2017_09_08_102758_add_2fa_secret_to_users','reflar-twofactor'),('2018_12_04_10_add_authy_fields_to_users','reflar-twofactor'),('2018_09_21_000000_create_geotags_table','reflar-geotags'),('2018_08_9_000000_create_webhooks_table','reflar-webhooks'),('2018_12_10_000000_make_error_nullable','reflar-webhooks'),('2017_10_04_create_flagrow_linguist_strings_table','flagrow-linguist'),('2019_06_17_000000_add_settings_social_list','fof-share-social'),('2019_06_10_01_rename_permissions','fof-masquerade'),('2019_06_10_02_rename_flagrow_tables','fof-masquerade'),('2019_06_10_03_create_fields_table','fof-masquerade'),('2019_06_10_04_create_answers_table','fof-masquerade'),('2019_06_11_000000_add_subscription_to_users_tags_table','fof-follow-tags');
/*!40000 ALTER TABLE `flarum_migrations` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-08-02 19:48:57
The culprit seems to be reflar/koseki @ https://github.com/ReFlar/koseki/blob/master/migrations/2018_08_08_192410_add_icon_to_tags.php
('2018_08_08_192410_add_icon_to_tags','reflar-koseki')
Fantastic ! How do we fix this mess though ? :sweat_smile:
Is it core responsibility to handle for possible existing columns ?
If we do handle it I feel the best would be to drop the column if it exists in the core migration so we can re-create it according to core specs.
But this would require tagging a patch release... Maybe best putting a warning in the beta 9 release notes about this known issue.
Hm, the "Uninstall" button errors in versions earlier than beta 9, so they can't roll back migrations that way.
I could make an update to reflar/koseki that drops the icon column, though one would still need a warning in the release notes about needing to update koseki and migrating before updating to beta 9.
Yeah, I don't think it's core responsibility to handle for possible existing columns.
Agreed. Unfortunate coincidence.
Bug Report
Hi ! Everything seems to work perfect after upgrading beta9, you make an awesome job! I encounter only one issue with tags's extension. :)
Current Behavior Impossible to enabling Tags extension on beta9.
Steps to Reproduce
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'icon' (SQL: alter table
flarum_tagsadd
iconvarchar(100) null)
Tested on pre-existant Flarum directory upgrade and on a clean install. Same error happened. With or without any others extensions enabled.
Expected Behavior Enabling Tag extension on beta9.
Solved by I solved my issue by dropping column and reactivate extension:
Environment
Output logs
php flarum info
Sentry.io