Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLSTATE[42S02]: Base table or view not found: 1146 Table '[tablename' doesn't exist #1664

Closed
darylknight opened this issue Nov 29, 2024 · 3 comments
Assignees
Labels
issue Something isn't working correctly

Comments

@darylknight
Copy link

What happened?

I just updated Freeform from 4.x to 5.x, then visited the Submissions page. A toast notification appeared that was taller than my screen. I copied all the text from it and it looks like the submissions page is trying to use the wrong table names compared to what's in the database if the form title has numbers in it.

Error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.freeform_submissions_sb_1_3_8_3_annualreportingforfros_14' doesn't exist

Actual table name in the database: freeform_submissions_sb1383Annualreportingforfros_14

Errors and Stack Trace (if available)

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.freeform_submissions_sb_1_3_8_3_annualreportingforfros_14' doesn't exist The SQL being executed was: SELECT `elements`.`id`, `elements`.`canonicalId`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateLastMerged`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`id` AS `siteSettingsId`, `elements_sites`.`slug`, `elements_sites`.`siteId`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, freeform_submissions.`formId`, freeform_submissions.`userId`, freeform_submissions.`statusId`, freeform_submissions.`incrementalId`, freeform_submissions.`token`, freeform_submissions.`isSpam`, freeform_submissions.`ip`, `fc1`.`fullname_1` as `form_1__fullname_1`, `fc1`.`email_2` as `form_1__email_2`, `fc1`.`city_3` as `form_1__city_3`, `fc1`.`subject_4` as `form_1__subject_4`, `fc1`.`message_5` as `form_1__message_5`, `fc2`.`language_6` as `form_2__language_6`, `fc2`.`fullname_7` as `form_2__fullname_7`, `fc2`.`address_8` as `form_2__address_8`, `fc2`.`city_9` as `form_2__city_9`, `fc2`.`st_10` as `form_2__st_10`, `fc2`.`zip_11` as `form_2__zip_11`, `fc2`.`phone_12` as `form_2__phone_12`, `fc2`.`email_13` as `form_2__email_13`, `fc2`.`message_14` as `form_2__message_14`, `fc6`.`firstname_45` as `form_6__firstname_45`, `fc6`.`lastname_46` as `form_6__lastname_46`, `fc6`.`email_47` as `form_6__email_47`, `fc6`.`ok5_brbxap_48` as `form_6__ok5_brbxap_48`, `fc4`.`fullname_25` as `form_4__fullname_25`, `fc4`.`phone_26` as `form_4__phone_26`, `fc4`.`email_27` as `form_4__email_27`, `fc4`.`yesyoumaycontactmeforfurtherdetails_28` as `form_4__yesyoumaycontactmeforfurtherdetails_28`, `fc4`.`establishmenteventname_29` as `form_4__establishmenteventname_29`, `fc4`.`jurisdiction1_30` as `form_4__jurisdiction1_30`, `fc4`.`datevisited_31` as `form_4__datevisited_31`, `fc4`.`producttype_32` as `form_4__producttype_32`, `fc4`.`detailsaboutmyconcern_33` as `form_4__detailsaboutmyconcern_33`, `fc4`.`supportingdocumentation_34` as `form_4__supportingdocumentation_34`, `fc5`.`establishmenteventname_35` as `form_5__establishmenteventname_35`, `fc5`.`fullname_36` as `form_5__fullname_36`, `fc5`.`phone_37` as `form_5__phone_37`, `fc5`.`email_38` as `form_5__email_38`, `fc5`.`citytown_39` as `form_5__citytown_39`, `fc5`.`submissiondate_40` as `form_5__submissiondate_40`, `fc5`.`exemptionrequesttype_41` as `form_5__exemptionrequesttype_41`, `fc5`.`commonexemptions_42` as `form_5__commonexemptions_42`, `fc5`.`undue_43` as `form_5__undue_43`, `fc5`.`supportingdocumentation_44` as `form_5__supportingdocumentation_44`, `fc3`.`submissiondate_15` as `form_3__submissiondate_15`, `fc3`.`nameofbusiness_16` as `form_3__nameofbusiness_16`, `fc3`.`address_17` as `form_3__address_17`, `fc3`.`city_18` as `form_3__city_18`, `fc3`.`fullname_19` as `form_3__fullname_19`, `fc3`.`email_20` as `form_3__email_20`, `fc3`.`phone_21` as `form_3__phone_21`, `fc3`.`onsitefoodwaretype_22` as `form_3__onsitefoodwaretype_22`, `fc3`.`description_23` as `form_3__description_23`, `fc3`.`uploadw9_24` as `form_3__uploadw9_24`, `fc7`.`fullname_49` as `form_7__fullname_49`, `fc7`.`phone_50` as `form_7__phone_50`, `fc7`.`submissiondate_51` as `form_7__submissiondate_51`, `fc7`.`email_52` as `form_7__email_52`, `fc7`.`nameofbusiness_53` as `form_7__nameofbusiness_53`, `fc7`.`citytown_54` as `form_7__citytown_54`, `fc7`.`description_55` as `form_7__description_55`, `fc9`.`fullname_67` as `form_9__fullname_67`, `fc9`.`email_68` as `form_9__email_68`, `fc9`.`phone_69` as `form_9__phone_69`, `fc9`.`citytown_70` as `form_9__citytown_70`, `fc9`.`volunteerinterest_71` as `form_9__volunteerinterest_71`, `fc9`.`message_72` as `form_9__message_72`, `fc11`.`fullname_83` as `form_11__fullname_83`, `fc11`.`address_84` as `form_11__address_84`, `fc11`.`email_85` as `form_11__email_85`, `fc11`.`phone_86` as `form_11__phone_86`, `fc11`.`uploadw9_87` as `form_11__uploadw9_87`, `fc11`.`supportingdocumentation_88` as `form_11__supportingdocumentation_88`, `fc12`.`fullname_90` as `form_12__fullname_90`, `fc12`.`email_91` as `form_12__email_91`, `fc12`.`phone_92` as `form_12__phone_92`, `fc10`.`fullname_73` as `form_10__fullname_73`, `fc10`.`phone_74` as `form_10__phone_74`, `fc10`.`email_75` as `form_10__email_75`, `fc10`.`yesyoumaycontactmeforfurtherdetails_76` as `form_10__yesyoumaycontactmeforfurtherdetails_76`, `fc10`.`nameofbusiness_77` as `form_10__nameofbusiness_77`, `fc10`.`jurisdiction1_78` as `form_10__jurisdiction1_78`, `fc10`.`datevisited_79` as `form_10__datevisited_79`, `fc10`.`violationtype_80` as `form_10__violationtype_80`, `fc10`.`detailsaboutmyconcern_81` as `form_10__detailsaboutmyconcern_81`, `fc15`.`applicationsubmissiondate_124` as `form_15__applicationsubmissiondate_124`, `fc15`.`establishmenteventname_125` as `form_15__establishmenteventname_125`, `fc15`.`citytown_126` as `form_15__citytown_126`, `fc15`.`address_127` as `form_15__address_127`, `fc15`.`fullname_128` as `form_15__fullname_128`, `fc15`.`emailaddress_129` as `form_15__emailaddress_129`, `fc15`.`phone_130` as `form_15__phone_130`, `fc15`.`description1_131` as `form_15__description1_131`, `fc15`.`number_132` as `form_15__number_132`, `fc15`.`uploadw9_133` as `form_15__uploadw9_133`, `fc14`.`applicationsubmissiondate_101` as `form_14__applicationsubmissiondate_101`, `fc14`.`nameofbusiness_102` as `form_14__nameofbusiness_102`, `fc14`.`firstname_103` as `form_14__firstname_103`, `fc14`.`lastname_104` as `form_14__lastname_104`, `fc14`.`jobtitle_105` as `form_14__jobtitle_105`, `fc14`.`emailaddress_106` as `form_14__emailaddress_106`, `fc14`.`fullname_108` as `form_14__fullname_108`, `fc14`.`submitterjobtitle_109` as `form_14__submitterjobtitle_109`, `fc14`.`email_110` as `form_14__email_110`, `fc14`.`agreements_112` as `form_14__agreements_112`, `fc14`.`writtenagreements_113` as `form_14__writtenagreements_113`, `fc14`.`number_115` as `form_14__number_115`, `fc14`.`signature_117` as `form_14__signature_117`, `fc14`.`description1_119` as `form_14__description1_119`, `fc14`.`description_120` as `form_14__description_120`, `fc14`.`upload_121` as `form_14__upload_121`, `fc14`.`yeslearnmore_122` as `form_14__yeslearnmore_122`, `fc14`.`detailsaboutmyconcern_123` as `form_14__detailsaboutmyconcern_123`, `fc13`.`candidatename_93` as `form_13__candidatename_93`, `fc13`.`email_94` as `form_13__email_94`, `fc13`.`phone_95` as `form_13__phone_95`, `fc13`.`organization_96` as `form_13__organization_96`, `fc13`.`topic_97` as `form_13__topic_97`, `fc13`.`neworupdatedentry_98` as `form_13__neworupdatedentry_98`, `fc8`.`fullname_56` as `form_8__fullname_56`, `fc8`.`phone_57` as `form_8__phone_57`, `fc8`.`email_58` as `form_8__email_58`, `fc8`.`yesyoumaycontactmeforfurtherdetails_59` as `form_8__yesyoumaycontactmeforfurtherdetails_59`, `fc8`.`nameofentity_60` as `form_8__nameofentity_60`, `fc8`.`jurisdiction_61` as `form_8__jurisdiction_61`, `fc8`.`datevisited_62` as `form_8__datevisited_62`, `fc8`.`description_63` as `form_8__description_63`, `fc8`.`supportingdocumentation_64` as `form_8__supportingdocumentation_64`, `fc8`.`subject_65` as `form_8__subject_65`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_alertBackgroundColor`, `content`.`field_alertEndDate`, `content`.`field_alertStartDate`, `content`.`field_alertText`, `content`.`field_codeBody`, `content`.`field_codeFooter`, `content`.`field_codeHead`, `content`.`field_eventEmail`, `content`.`field_eventLocationTitle`, `content`.`field_eventPhone`, `content`.`field_eventShortDescription`, `content`.`field_eventWebsite`, `content`.`field_articleExtract`, `content`.`field_facebook`, `content`.`field_googlePlus`, `content`.`field_instagram`, `content`.`field_linkTarget`, `content`.`field_listingType`, `content`.`field_materialCDGuide`, `content`.`field_materialCode`, `content`.`field_materialDescription`, `content`.`field_materialGuide`, `content`.`field_materialNotes`, `content`.`field_materialPublic`, `content`.`field_materialRid`, `content`.`field_materialWwwResidential`, `content`.`field_materialDisclaimer`, `content`.`field_meetingDescription`, `content`.`field_meetingCalendar`, `content`.`field_noticeDescription`, `content`.`field_pageIntro`, `content`.`field_pinterest`, `content`.`field_reportDescription`, `content`.`field_rfpDescription`, `content`.`field_seoDescription`, `content`.`field_seoTitle`, `content`.`field_siteAreaCode`, `content`.`field_siteDaysHours`, `content`.`field_siteEmailAddress`, `content`.`field_sitePhone`, `content`.`field_siteWebsite`, `content`.`field_subscribeBar`, `content`.`field_twitter`, `content`.`field_youtube`, `content`.`field_internalCellPhone`, `content`.`field_internalEmailAddress`, `content`.`field_internalFirstName`, `content`.`field_internalJobTitle`, `content`.`field_internalLastName`, `content`.`field_internalMailingAddressSameAsSiteAddress`, `content`.`field_internalNotes`, `content`.`field_internalPhone`, `content`.`field_internalPreferredDeliveryMethod`, `content`.`field_internalRecyclingGuide` FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId` FROM `elements` `elements` INNER JOIN `freeform_submissions` `freeform_submissions` ON `freeform_submissions`.`id` = `elements`.`id` INNER JOIN `freeform_statuses` `sub_freeform_statuses` ON sub_freeform_statuses.`id` = freeform_submissions.`statusId` LEFT JOIN `freeform_submissions_contactform_1` `fc1` ON `fc1`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_orderpublication_2` `fc2` ON `fc2`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_subscribe_6` `fc6` ON `fc6`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_reportabusinessusingpolystyrene_4` `fc4` ON `fc4`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_disposablefoodservicewareandpolystyr_5` `fc5` ON `fc5`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_reusablefoodwaregrantform_3` `fc3` ON `fc3`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_zerowastebusinessshoutout_7` `fc7` ON `fc7`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostgiveaway_9` `fc9` ON `fc9`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostrebateclaim_11` `fc11` ON `fc11`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostfacilitytourinterest_12` `fc12` ON `fc12`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_carryoutbagordinancecomplaintform_10` `fc10` ON `fc10`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_frocapacitybuildingminigrantapplicat_15` `fc15` ON `fc15`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_sb_1_3_8_3_annualreportingforfros_14` `fc14` ON `fc14`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_speakersbureau_13` `fc13` ON `fc13`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_sb_1_3_8_3_complaint_8` `fc8` ON `fc8`.`id` = `freeform_submissions`.`id` INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id` INNER JOIN `content` `content` ON `content`.`elementId` = `elements`.`id` WHERE (freeform_submissions.`formId` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) AND (freeform_submissions.`isSpam`=FALSE) AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`elements`.`draftId` IS NULL) AND (`elements`.`revisionId` IS NULL) ORDER BY freeform_submissions.`dateCreated` DESC LIMIT 100) `subquery` INNER JOIN `elements` `elements` ON `elements`.`id` = `subquery`.`elementsId` INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId` INNER JOIN `freeform_submissions` `freeform_submissions` ON `freeform_submissions`.`id` = `subquery`.`elementsId` INNER JOIN `freeform_forms` `freeform_forms` ON freeform_forms.`id` = freeform_submissions.`formId` INNER JOIN `freeform_statuses` `freeform_statuses` ON freeform_statuses.`id` = freeform_submissions.`statusId` LEFT JOIN `freeform_submissions_contactform_1` `fc1` ON `fc1`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_orderpublication_2` `fc2` ON `fc2`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_subscribe_6` `fc6` ON `fc6`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_reportabusinessusingpolystyrene_4` `fc4` ON `fc4`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_disposablefoodservicewareandpolystyr_5` `fc5` ON `fc5`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_reusablefoodwaregrantform_3` `fc3` ON `fc3`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_zerowastebusinessshoutout_7` `fc7` ON `fc7`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostgiveaway_9` `fc9` ON `fc9`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostrebateclaim_11` `fc11` ON `fc11`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_compostfacilitytourinterest_12` `fc12` ON `fc12`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_carryoutbagordinancecomplaintform_10` `fc10` ON `fc10`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_frocapacitybuildingminigrantapplicat_15` `fc15` ON `fc15`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_sb_1_3_8_3_annualreportingforfros_14` `fc14` ON `fc14`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_speakersbureau_13` `fc13` ON `fc13`.`id` = `freeform_submissions`.`id` LEFT JOIN `freeform_submissions_sb_1_3_8_3_complaint_8` `fc8` ON `fc8`.`id` = `freeform_submissions`.`id` INNER JOIN `content` `content` ON `content`.`id` = `subquery`.`contentId` ORDER BY freeform_submissions.`dateCreated` DESC

How can we reproduce this?

  1. Have a Form in Freeform 4 with numbers in the title?
  2. Upgrade to Freeform 5.7.3
  3. Visit the Submissions section

Freeform Edition

Pro

Freeform Version

5.7.3

Craft Version

4.11.3

When did this issue start?

After upgrading from older Freeform version

Previous Freeform Version

4.1.21

@darylknight darylknight added the issue Something isn't working correctly label Nov 29, 2024
@seandelaney
Copy link
Contributor

Sorry for the trouble you're experiencing @darylknight

There is a PR with a fix for this issue. It will be available in the next release.

@kjmartens
Copy link
Contributor

Hi @darylknight,

Sorry about this. We've released Freeform 5.7.4 now, which will resolve the issue.

You can either do one of the following:

  1. Revert to the original Freeform 4.x version and try the migration to 5.x (5.7.4) again. OR...
  2. I believe you can get away with just resaving each form individually in the form builder. That will regenerate the database table names and correct the issue.

Please let us know if you have any further questions or issues. 🙂

@kjmartens kjmartens self-assigned this Nov 29, 2024
@darylknight
Copy link
Author

Thanks Sean, Kelsey, this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

3 participants