craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

Can't install Craft on PostgreSQL 11 because of Install migration exception #4496

Closed michalochman closed 5 years ago

michalochman commented 5 years ago

Description

I can't install Craft because of an exception:

Exception 'craft\errors\MigrationException' with message 'An error occurred while executing the "craft\migrations\Install migration: The table does not exist: {{%fieldgroups}}'

I'm not sure why it happens, because craft doesn't report an error on that table:

> create table {{%fieldgroups}} ... done (time: 0.018s)

See full output below.

*** installing Craft
    > create table {{%assetindexdata}} ... done (time: 0.105s)
    > create table {{%assets}} ... done (time: 0.011s)
    > create table {{%assettransformindex}} ... done (time: 0.019s)
    > create table {{%assettransforms}} ... done (time: 0.023s)
    > create table {{%categories}} ... done (time: 0.010s)
    > create table {{%categorygroups}} ... done (time: 0.035s)
    > create table {{%categorygroups_sites}} ... done (time: 0.028s)
    > create table {{%content}} ... done (time: 0.014s)
    > create table {{%craftidtokens}} ... done (time: 0.023s)
    > create table {{%deprecationerrors}} ... done (time: 0.041s)
    > create table {{%elementindexsettings}} ... done (time: 0.037s)
    > create table {{%elements}} ... done (time: 0.014s)
    > create table {{%elements_sites}} ... done (time: 0.034s)
    > create table {{%resourcepaths}} ... done (time: 0.025s)
    > create table {{%sequences}} ... done (time: 0.013s)
    > create table {{%systemmessages}} ... done (time: 0.034s)
    > create table {{%entries}} ... done (time: 0.011s)
    > create table {{%entrydrafts}} ... done (time: 0.032s)
    > create table {{%entrytypes}} ... done (time: 0.033s)
    > create table {{%entryversions}} ... done (time: 0.042s)
    > create table {{%fieldgroups}} ... done (time: 0.018s)
    > create table {{%fieldlayoutfields}} ... done (time: 0.017s)
    > create table {{%fieldlayouts}} ... done (time: 0.016s)
    > create table {{%fieldlayouttabs}} ... done (time: 0.015s)
    > create table {{%fields}} ... done (time: 0.024s)
    > create table {{%globalsets}} ... done (time: 0.024s)
    > create table {{%info}} ... done (time: 0.027s)
    > create table {{%matrixblocks}} ... done (time: 0.013s)
    > create table {{%matrixblocktypes}} ... done (time: 0.039s)
    > create table {{%migrations}} ... done (time: 0.036s)
    > create table {{%plugins}} ... done (time: 0.030s)
    > create table {{%queue}} ... done (time: 0.027s)
    > create table {{%relations}} ... done (time: 0.018s)
    > create table {{%sections}} ... done (time: 0.030s)
    > create table {{%sections_sites}} ... done (time: 0.032s)
    > create table {{%sessions}} ... done (time: 0.016s)
    > create table {{%shunnedmessages}} ... done (time: 0.019s)
    > create table {{%sites}} ... done (time: 0.028s)
    > create table {{%sitegroups}} ... done (time: 0.014s)
    > create table {{%structureelements}} ... done (time: 0.015s)
    > create table {{%structures}} ... done (time: 0.015s)
    > create table {{%taggroups}} ... done (time: 0.035s)
    > create table {{%tags}} ... done (time: 0.010s)
    > create table {{%templatecacheelements}} ... done (time: 0.003s)
    > create table {{%templatecachequeries}} ... done (time: 0.024s)
    > create table {{%templatecaches}} ... done (time: 0.026s)
    > create table {{%tokens}} ... done (time: 0.027s)
    > create table {{%usergroups}} ... done (time: 0.031s)
    > create table {{%usergroups_users}} ... done (time: 0.018s)
    > create table {{%userpermissions}} ... done (time: 0.015s)
    > create table {{%userpermissions_usergroups}} ... done (time: 0.017s)
    > create table {{%userpermissions_users}} ... done (time: 0.018s)
    > create table {{%userpreferences}} ... done (time: 0.025s)
    > create table {{%users}} ... done (time: 0.029s)
    > create table {{%volumefolders}} ... done (time: 0.027s)
    > create table {{%volumes}} ... done (time: 0.025s)
    > create table {{%widgets}} ... done (time: 0.031s)
    > create index assetindexdata_sessionId_volumeId_idx on {{%assetindexdata}} (sessionId,volumeId) ... done (time: 0.013s)
    > create index assetindexdata_volumeId_idx on {{%assetindexdata}} (volumeId) ... done (time: 0.009s)
    > create index assets_filename_folderId_idx on {{%assets}} (filename,folderId) ... done (time: 0.009s)
    > create index assets_folderId_idx on {{%assets}} (folderId) ... done (time: 0.006s)
    > create index assets_volumeId_idx on {{%assets}} (volumeId) ... done (time: 0.010s)
    > create index assettransformindex_volumeId_assetId_location_idx on {{%assettransformindex}} (volumeId,assetId,location) ... done (time: 0.011s)
    > create unique index assettransforms_name_unq_idx on {{%assettransforms}} (name) ... done (time: 0.009s)
    > create unique index assettransforms_handle_unq_idx on {{%assettransforms}} (handle) ... done (time: 0.008s)
    > create index categories_groupId_idx on {{%categories}} (groupId) ... done (time: 0.008s)
    > create index categorygroups_name_idx on {{%categorygroups}} (name) ... done (time: 0.007s)
    > create index categorygroups_handle_idx on {{%categorygroups}} (handle) ... done (time: 0.007s)
    > create index categorygroups_structureId_idx on {{%categorygroups}} (structureId) ... done (time: 0.014s)
    > create index categorygroups_fieldLayoutId_idx on {{%categorygroups}} (fieldLayoutId) ... done (time: 0.010s)
    > create index categorygroups_dateDeleted_idx on {{%categorygroups}} (dateDeleted) ... done (time: 0.008s)
    > create unique index categorygroups_sites_groupId_siteId_unq_idx on {{%categorygroups_sites}} (groupId,siteId) ... done (time: 0.009s)
    > create index categorygroups_sites_siteId_idx on {{%categorygroups_sites}} (siteId) ... done (time: 0.011s)
    > create unique index content_elementId_siteId_unq_idx on {{%content}} (elementId,siteId) ... done (time: 0.012s)
    > create index content_siteId_idx on {{%content}} (siteId) ... done (time: 0.007s)
    > create index content_title_idx on {{%content}} (title) ... done (time: 0.008s)
    > create unique index deprecationerrors_key_fingerprint_unq_idx on {{%deprecationerrors}} (key,fingerprint) ... done (time: 0.008s)
    > create unique index elementindexsettings_type_unq_idx on {{%elementindexsettings}} (type) ... done (time: 0.008s)
    > create index elements_dateDeleted_idx on {{%elements}} (dateDeleted) ... done (time: 0.007s)
    > create index elements_fieldLayoutId_idx on {{%elements}} (fieldLayoutId) ... done (time: 0.007s)
    > create index elements_type_idx on {{%elements}} (type) ... done (time: 0.007s)
    > create index elements_enabled_idx on {{%elements}} (enabled) ... done (time: 0.011s)
    > create index elements_archived_dateCreated_idx on {{%elements}} (archived,dateCreated) ... done (time: 0.009s)
    > create unique index elements_sites_elementId_siteId_unq_idx on {{%elements_sites}} (elementId,siteId) ... done (time: 0.010s)
    > create index elements_sites_siteId_idx on {{%elements_sites}} (siteId) ... done (time: 0.013s)
    > create index elements_sites_slug_siteId_idx on {{%elements_sites}} (slug,siteId) ... done (time: 0.013s)
    > create index elements_sites_enabled_idx on {{%elements_sites}} (enabled) ... done (time: 0.010s)
    > create unique index systemmessages_key_language_unq_idx on {{%systemmessages}} (key,language) ... done (time: 0.008s)
    > create index systemmessages_language_idx on {{%systemmessages}} (language) ... done (time: 0.006s)
    > create index entries_postDate_idx on {{%entries}} (postDate) ... done (time: 0.007s)
    > create index entries_expiryDate_idx on {{%entries}} (expiryDate) ... done (time: 0.010s)
    > create index entries_authorId_idx on {{%entries}} (authorId) ... done (time: 0.012s)
    > create index entries_sectionId_idx on {{%entries}} (sectionId) ... done (time: 0.008s)
    > create index entries_typeId_idx on {{%entries}} (typeId) ... done (time: 0.009s)
    > create index entrydrafts_sectionId_idx on {{%entrydrafts}} (sectionId) ... done (time: 0.008s)
    > create index entrydrafts_entryId_siteId_idx on {{%entrydrafts}} (entryId,siteId) ... done (time: 0.008s)
    > create index entrydrafts_siteId_idx on {{%entrydrafts}} (siteId) ... done (time: 0.007s)
    > create index entrydrafts_creatorId_idx on {{%entrydrafts}} (creatorId) ... done (time: 0.009s)
    > create index entrytypes_name_sectionId_idx on {{%entrytypes}} (name,sectionId) ... done (time: 0.009s)
    > create index entrytypes_handle_sectionId_idx on {{%entrytypes}} (handle,sectionId) ... done (time: 0.008s)
    > create index entrytypes_sectionId_idx on {{%entrytypes}} (sectionId) ... done (time: 0.008s)
    > create index entrytypes_fieldLayoutId_idx on {{%entrytypes}} (fieldLayoutId) ... done (time: 0.013s)
    > create index entrytypes_dateDeleted_idx on {{%entrytypes}} (dateDeleted) ... done (time: 0.010s)
    > create index entryversions_sectionId_idx on {{%entryversions}} (sectionId) ... done (time: 0.007s)
    > create index entryversions_entryId_siteId_idx on {{%entryversions}} (entryId,siteId) ... done (time: 0.006s)
    > create index entryversions_siteId_idx on {{%entryversions}} (siteId) ... done (time: 0.009s)
    > create index entryversions_creatorId_idx on {{%entryversions}} (creatorId) ... done (time: 0.007s)
    > create unique index fieldgroups_name_unq_idx on {{%fieldgroups}} (name) ... done (time: 0.007s)
    > create unique index fieldlayoutfields_layoutId_fieldId_unq_idx on {{%fieldlayoutfields}} (layoutId,fieldId) ... done (time: 0.009s)
    > create index fieldlayoutfields_sortOrder_idx on {{%fieldlayoutfields}} (sortOrder) ... done (time: 0.007s)
    > create index fieldlayoutfields_tabId_idx on {{%fieldlayoutfields}} (tabId) ... done (time: 0.008s)
    > create index fieldlayoutfields_fieldId_idx on {{%fieldlayoutfields}} (fieldId) ... done (time: 0.007s)
    > create index fieldlayouts_dateDeleted_idx on {{%fieldlayouts}} (dateDeleted) ... done (time: 0.010s)
    > create index fieldlayouts_type_idx on {{%fieldlayouts}} (type) ... done (time: 0.008s)
    > create index fieldlayouttabs_sortOrder_idx on {{%fieldlayouttabs}} (sortOrder) ... done (time: 0.009s)
    > create index fieldlayouttabs_layoutId_idx on {{%fieldlayouttabs}} (layoutId) ... done (time: 0.008s)
    > create unique index fields_handle_context_unq_idx on {{%fields}} (handle,context) ... done (time: 0.009s)
    > create index fields_groupId_idx on {{%fields}} (groupId) ... done (time: 0.009s)
    > create index fields_context_idx on {{%fields}} (context) ... done (time: 0.007s)
    > create index globalsets_name_idx on {{%globalsets}} (name) ... done (time: 0.008s)
    > create index globalsets_handle_idx on {{%globalsets}} (handle) ... done (time: 0.008s)
    > create index globalsets_fieldLayoutId_idx on {{%globalsets}} (fieldLayoutId) ... done (time: 0.006s)
    > create index matrixblocks_ownerId_idx on {{%matrixblocks}} (ownerId) ... done (time: 0.011s)
    > create index matrixblocks_fieldId_idx on {{%matrixblocks}} (fieldId) ... done (time: 0.007s)
    > create index matrixblocks_typeId_idx on {{%matrixblocks}} (typeId) ... done (time: 0.008s)
    > create index matrixblocks_sortOrder_idx on {{%matrixblocks}} (sortOrder) ... done (time: 0.008s)
    > create index matrixblocks_ownerSiteId_idx on {{%matrixblocks}} (ownerSiteId) ... done (time: 0.009s)
    > create unique index matrixblocktypes_name_fieldId_unq_idx on {{%matrixblocktypes}} (name,fieldId) ... done (time: 0.008s)
    > create unique index matrixblocktypes_handle_fieldId_unq_idx on {{%matrixblocktypes}} (handle,fieldId) ... done (time: 0.007s)
    > create index matrixblocktypes_fieldId_idx on {{%matrixblocktypes}} (fieldId) ... done (time: 0.008s)
    > create index matrixblocktypes_fieldLayoutId_idx on {{%matrixblocktypes}} (fieldLayoutId) ... done (time: 0.014s)
    > create index migrations_pluginId_idx on {{%migrations}} (pluginId) ... done (time: 0.007s)
    > create index migrations_type_pluginId_idx on {{%migrations}} (type,pluginId) ... done (time: 0.009s)
    > create unique index plugins_handle_unq_idx on {{%plugins}} (handle) ... done (time: 0.006s)
    > create index queue_fail_timeUpdated_timePushed_idx on {{%queue}} (fail,timeUpdated,timePushed) ... done (time: 0.009s)
    > create index queue_fail_timeUpdated_delay_idx on {{%queue}} (fail,timeUpdated,delay) ... done (time: 0.010s)
    > create unique index relations_fieldId_sourceId_sourceSiteId_targetId_unq_idx on {{%relations}} (fieldId,sourceId,sourceSiteId,targetId) ... done (time: 0.008s)
    > create index relations_sourceId_idx on {{%relations}} (sourceId) ... done (time: 0.006s)
    > create index relations_targetId_idx on {{%relations}} (targetId) ... done (time: 0.006s)
    > create index relations_sourceSiteId_idx on {{%relations}} (sourceSiteId) ... done (time: 0.007s)
    > create index sections_handle_idx on {{%sections}} (handle) ... done (time: 0.006s)
    > create index sections_name_idx on {{%sections}} (name) ... done (time: 0.005s)
    > create index sections_structureId_idx on {{%sections}} (structureId) ... done (time: 0.012s)
    > create index sections_dateDeleted_idx on {{%sections}} (dateDeleted) ... done (time: 0.008s)
    > create unique index sections_sites_sectionId_siteId_unq_idx on {{%sections_sites}} (sectionId,siteId) ... done (time: 0.014s)
    > create index sections_sites_siteId_idx on {{%sections_sites}} (siteId) ... done (time: 0.010s)
    > create index sessions_uid_idx on {{%sessions}} (uid) ... done (time: 0.008s)
    > create index sessions_token_idx on {{%sessions}} (token) ... done (time: 0.005s)
    > create index sessions_dateUpdated_idx on {{%sessions}} (dateUpdated) ... done (time: 0.006s)
    > create index sessions_userId_idx on {{%sessions}} (userId) ... done (time: 0.011s)
    > create unique index shunnedmessages_userId_message_unq_idx on {{%shunnedmessages}} (userId,message) ... done (time: 0.010s)
    > create index sites_dateDeleted_idx on {{%sites}} (dateDeleted) ... done (time: 0.009s)
    > create index sites_handle_idx on {{%sites}} (handle) ... done (time: 0.008s)
    > create index sites_sortOrder_idx on {{%sites}} (sortOrder) ... done (time: 0.010s)
    > create index sitegroups_name_idx on {{%sitegroups}} (name) ... done (time: 0.009s)
    > create unique index structureelements_structureId_elementId_unq_idx on {{%structureelements}} (structureId,elementId) ... done (time: 0.009s)
    > create index structureelements_root_idx on {{%structureelements}} (root) ... done (time: 0.006s)
    > create index structureelements_lft_idx on {{%structureelements}} (lft) ... done (time: 0.007s)
    > create index structureelements_rgt_idx on {{%structureelements}} (rgt) ... done (time: 0.007s)
    > create index structureelements_level_idx on {{%structureelements}} (level) ... done (time: 0.005s)
    > create index structureelements_elementId_idx on {{%structureelements}} (elementId) ... done (time: 0.007s)
    > create index structures_dateDeleted_idx on {{%structures}} (dateDeleted) ... done (time: 0.008s)
    > create index taggroups_name_idx on {{%taggroups}} (name) ... done (time: 0.007s)
    > create index taggroups_handle_idx on {{%taggroups}} (handle) ... done (time: 0.005s)
    > create index taggroups_dateDeleted_idx on {{%taggroups}} (dateDeleted) ... done (time: 0.006s)
    > create index tags_groupId_idx on {{%tags}} (groupId) ... done (time: 0.013s)
    > create index templatecacheelements_cacheId_idx on {{%templatecacheelements}} (cacheId) ... done (time: 0.010s)
    > create index templatecacheelements_elementId_idx on {{%templatecacheelements}} (elementId) ... done (time: 0.006s)
    > create index templatecachequeries_cacheId_idx on {{%templatecachequeries}} (cacheId) ... done (time: 0.006s)
    > create index templatecachequeries_type_idx on {{%templatecachequeries}} (type) ... done (time: 0.006s)
    > create index templatecaches_cacheKey_siteId_expiryDate_path_idx on {{%templatecaches}} (cacheKey,siteId,expiryDate,path) ... done (time: 0.006s)
    > create index templatecaches_cacheKey_siteId_expiryDate_idx on {{%templatecaches}} (cacheKey,siteId,expiryDate) ... done (time: 0.007s)
    > create index templatecaches_siteId_idx on {{%templatecaches}} (siteId) ... done (time: 0.009s)
    > create unique index tokens_token_unq_idx on {{%tokens}} (token) ... done (time: 0.006s)
    > create index tokens_expiryDate_idx on {{%tokens}} (expiryDate) ... done (time: 0.006s)
    > create unique index usergroups_handle_unq_idx on {{%usergroups}} (handle) ... done (time: 0.008s)
    > create unique index usergroups_name_unq_idx on {{%usergroups}} (name) ... done (time: 0.007s)
    > create unique index usergroups_users_groupId_userId_unq_idx on {{%usergroups_users}} (groupId,userId) ... done (time: 0.009s)
    > create index usergroups_users_userId_idx on {{%usergroups_users}} (userId) ... done (time: 0.006s)
    > create unique index userpermissions_name_unq_idx on {{%userpermissions}} (name) ... done (time: 0.005s)
    > create unique index userpermissions_usergroups_permissionId_groupId_unq_idx on {{%userpermissions_usergroups}} (permissionId,groupId) ... done (time: 0.012s)
    > create index userpermissions_usergroups_groupId_idx on {{%userpermissions_usergroups}} (groupId) ... done (time: 0.012s)
    > create unique index userpermissions_users_permissionId_userId_unq_idx on {{%userpermissions_users}} (permissionId,userId) ... done (time: 0.009s)
    > create index userpermissions_users_userId_idx on {{%userpermissions_users}} (userId) ... done (time: 0.007s)
    > create index users_uid_idx on {{%users}} (uid) ... done (time: 0.010s)
    > create index users_verificationCode_idx on {{%users}} (verificationCode) ... done (time: 0.007s)
    > create unique index volumefolders_name_parentId_volumeId_unq_idx on {{%volumefolders}} (name,parentId,volumeId) ... done (time: 0.012s)
    > create index volumefolders_parentId_idx on {{%volumefolders}} (parentId) ... done (time: 0.009s)
    > create index volumefolders_volumeId_idx on {{%volumefolders}} (volumeId) ... done (time: 0.010s)
    > create index volumes_name_idx on {{%volumes}} (name) ... done (time: 0.008s)
    > create index volumes_handle_idx on {{%volumes}} (handle) ... done (time: 0.006s)
    > create index volumes_fieldLayoutId_idx on {{%volumes}} (fieldLayoutId) ... done (time: 0.008s)
    > create index volumes_dateDeleted_idx on {{%volumes}} (dateDeleted) ... done (time: 0.007s)
    > create index widgets_userId_idx on {{%widgets}} (userId) ... done (time: 0.012s)
    > create index elements_sites_uri_siteId_idx on {{%elements_sites}} (lower([[uri]]),siteId) ... done (time: 0.010s)
    > create index users_email_idx on {{%users}} (lower([[email]])) ... done (time: 0.010s)
    > create index users_username_idx on {{%users}} (lower([[username]])) ... done (time: 0.007s)
    > create table {{%searchindex}} ... done (time: 0.018s)
    > add primary key searchindex_elementId_attribute_fieldId_siteId_unq_idx on {{%searchindex}} (elementId,attribute,fieldId,siteId) ... done (time: 0.011s)
    > add foreign key assetindexdata_volumeId_fk: {{%assetindexdata}} (volumeId) references {{%volumes}} (id) ... done (time: 0.032s)
    > add foreign key assets_folderId_fk: {{%assets}} (folderId) references {{%volumefolders}} (id) ... done (time: 0.017s)
    > add foreign key assets_id_fk: {{%assets}} (id) references {{%elements}} (id) ... done (time: 0.015s)
    > add foreign key assets_volumeId_fk: {{%assets}} (volumeId) references {{%volumes}} (id) ... done (time: 0.009s)
    > add foreign key categories_groupId_fk: {{%categories}} (groupId) references {{%categorygroups}} (id) ... done (time: 0.016s)
    > add foreign key categories_id_fk: {{%categories}} (id) references {{%elements}} (id) ... done (time: 0.008s)
    > add foreign key categories_parentId_fk: {{%categories}} (parentId) references {{%categories}} (id) ... done (time: 0.005s)
    > add foreign key categorygroups_fieldLayoutId_fk: {{%categorygroups}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.011s)
    > add foreign key categorygroups_structureId_fk: {{%categorygroups}} (structureId) references {{%structures}} (id) ... done (time: 0.011s)
    > add foreign key categorygroups_sites_groupId_fk: {{%categorygroups_sites}} (groupId) references {{%categorygroups}} (id) ... done (time: 0.017s)
    > add foreign key categorygroups_sites_siteId_fk: {{%categorygroups_sites}} (siteId) references {{%sites}} (id) ... done (time: 0.012s)
    > add foreign key content_elementId_fk: {{%content}} (elementId) references {{%elements}} (id) ... done (time: 0.014s)
    > add foreign key craftidtokens_userId_fk: {{%craftidtokens}} (userId) references {{%users}} (id) ... done (time: 0.014s)
    > add foreign key content_siteId_fk: {{%content}} (siteId) references {{%sites}} (id) ... done (time: 0.011s)
    > add foreign key elements_fieldLayoutId_fk: {{%elements}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.009s)
    > add foreign key elements_sites_elementId_fk: {{%elements_sites}} (elementId) references {{%elements}} (id) ... done (time: 0.015s)
    > add foreign key elements_sites_siteId_fk: {{%elements_sites}} (siteId) references {{%sites}} (id) ... done (time: 0.009s)
    > add foreign key entries_authorId_fk: {{%entries}} (authorId) references {{%users}} (id) ... done (time: 0.015s)
    > add foreign key entries_id_fk: {{%entries}} (id) references {{%elements}} (id) ... done (time: 0.011s)
    > add foreign key entries_sectionId_fk: {{%entries}} (sectionId) references {{%sections}} (id) ... done (time: 0.016s)
    > add foreign key entries_parentId_fk: {{%entries}} (parentId) references {{%entries}} (id) ... done (time: 0.008s)
    > add foreign key entries_typeId_fk: {{%entries}} (typeId) references {{%entrytypes}} (id) ... done (time: 0.017s)
    > add foreign key entrydrafts_creatorId_fk: {{%entrydrafts}} (creatorId) references {{%users}} (id) ... done (time: 0.015s)
    > add foreign key entrydrafts_entryId_fk: {{%entrydrafts}} (entryId) references {{%entries}} (id) ... done (time: 0.008s)
    > add foreign key entrydrafts_siteId_fk: {{%entrydrafts}} (siteId) references {{%sites}} (id) ... done (time: 0.011s)
    > add foreign key entrydrafts_sectionId_fk: {{%entrydrafts}} (sectionId) references {{%sections}} (id) ... done (time: 0.008s)
    > add foreign key entrytypes_fieldLayoutId_fk: {{%entrytypes}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.009s)
    > add foreign key entrytypes_sectionId_fk: {{%entrytypes}} (sectionId) references {{%sections}} (id) ... done (time: 0.008s)
    > add foreign key entryversions_creatorId_fk: {{%entryversions}} (creatorId) references {{%users}} (id) ... done (time: 0.015s)
    > add foreign key entryversions_entryId_fk: {{%entryversions}} (entryId) references {{%entries}} (id) ... done (time: 0.009s)
    > add foreign key entryversions_siteId_fk: {{%entryversions}} (siteId) references {{%sites}} (id) ... done (time: 0.008s)
    > add foreign key entryversions_sectionId_fk: {{%entryversions}} (sectionId) references {{%sections}} (id) ... done (time: 0.008s)
    > add foreign key fieldlayoutfields_fieldId_fk: {{%fieldlayoutfields}} (fieldId) references {{%fields}} (id) ... done (time: 0.016s)
    > add foreign key fieldlayoutfields_layoutId_fk: {{%fieldlayoutfields}} (layoutId) references {{%fieldlayouts}} (id) ... done (time: 0.006s)
    > add foreign key fieldlayoutfields_tabId_fk: {{%fieldlayoutfields}} (tabId) references {{%fieldlayouttabs}} (id) ... done (time: 0.011s)
    > add foreign key fieldlayouttabs_layoutId_fk: {{%fieldlayouttabs}} (layoutId) references {{%fieldlayouts}} (id) ... done (time: 0.006s)
    > add foreign key fields_groupId_fk: {{%fields}} (groupId) references {{%fieldgroups}} (id) ... done (time: 0.008s)
    > add foreign key globalsets_fieldLayoutId_fk: {{%globalsets}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.015s)
    > add foreign key globalsets_id_fk: {{%globalsets}} (id) references {{%elements}} (id) ... done (time: 0.010s)
    > add foreign key matrixblocks_fieldId_fk: {{%matrixblocks}} (fieldId) references {{%fields}} (id) ... done (time: 0.015s)
    > add foreign key matrixblocks_id_fk: {{%matrixblocks}} (id) references {{%elements}} (id) ... done (time: 0.010s)
    > add foreign key matrixblocks_ownerId_fk: {{%matrixblocks}} (ownerId) references {{%elements}} (id) ... done (time: 0.009s)
    > add foreign key matrixblocks_ownerSiteId_fk: {{%matrixblocks}} (ownerSiteId) references {{%sites}} (id) ... done (time: 0.008s)
    > add foreign key matrixblocks_typeId_fk: {{%matrixblocks}} (typeId) references {{%matrixblocktypes}} (id) ... done (time: 0.014s)
    > add foreign key matrixblocktypes_fieldId_fk: {{%matrixblocktypes}} (fieldId) references {{%fields}} (id) ... done (time: 0.008s)
    > add foreign key matrixblocktypes_fieldLayoutId_fk: {{%matrixblocktypes}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.007s)
    > add foreign key migrations_pluginId_fk: {{%migrations}} (pluginId) references {{%plugins}} (id) ... done (time: 0.011s)
    > add foreign key relations_fieldId_fk: {{%relations}} (fieldId) references {{%fields}} (id) ... done (time: 0.016s)
    > add foreign key relations_sourceId_fk: {{%relations}} (sourceId) references {{%elements}} (id) ... done (time: 0.008s)
    > add foreign key relations_sourceSiteId_fk: {{%relations}} (sourceSiteId) references {{%sites}} (id) ... done (time: 0.007s)
    > add foreign key relations_targetId_fk: {{%relations}} (targetId) references {{%elements}} (id) ... done (time: 0.008s)
    > add foreign key sections_structureId_fk: {{%sections}} (structureId) references {{%structures}} (id) ... done (time: 0.007s)
    > add foreign key sections_sites_siteId_fk: {{%sections_sites}} (siteId) references {{%sites}} (id) ... done (time: 0.009s)
    > add foreign key sections_sites_sectionId_fk: {{%sections_sites}} (sectionId) references {{%sections}} (id) ... done (time: 0.006s)
    > add foreign key sessions_userId_fk: {{%sessions}} (userId) references {{%users}} (id) ... done (time: 0.014s)
    > add foreign key shunnedmessages_userId_fk: {{%shunnedmessages}} (userId) references {{%users}} (id) ... done (time: 0.009s)
    > add foreign key sites_groupId_fk: {{%sites}} (groupId) references {{%sitegroups}} (id) ... done (time: 0.009s)
    > add foreign key structureelements_elementId_fk: {{%structureelements}} (elementId) references {{%elements}} (id) ... done (time: 0.016s)
    > add foreign key structureelements_structureId_fk: {{%structureelements}} (structureId) references {{%structures}} (id) ... done (time: 0.008s)
    > add foreign key taggroups_fieldLayoutId_fk: {{%taggroups}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.009s)
    > add foreign key tags_groupId_fk: {{%tags}} (groupId) references {{%taggroups}} (id) ... done (time: 0.008s)
    > add foreign key tags_id_fk: {{%tags}} (id) references {{%elements}} (id) ... done (time: 0.007s)
    > add foreign key templatecacheelements_cacheId_fk: {{%templatecacheelements}} (cacheId) references {{%templatecaches}} (id) ... done (time: 0.012s)
    > add foreign key templatecacheelements_elementId_fk: {{%templatecacheelements}} (elementId) references {{%elements}} (id) ... done (time: 0.006s)
    > add foreign key templatecachequeries_cacheId_fk: {{%templatecachequeries}} (cacheId) references {{%templatecaches}} (id) ... done (time: 0.009s)
    > add foreign key templatecaches_siteId_fk: {{%templatecaches}} (siteId) references {{%sites}} (id) ... done (time: 0.009s)
    > add foreign key usergroups_users_groupId_fk: {{%usergroups_users}} (groupId) references {{%usergroups}} (id) ... done (time: 0.013s)
    > add foreign key usergroups_users_userId_fk: {{%usergroups_users}} (userId) references {{%users}} (id) ... done (time: 0.007s)
    > add foreign key userpermissions_usergroups_groupId_fk: {{%userpermissions_usergroups}} (groupId) references {{%usergroups}} (id) ... done (time: 0.012s)
    > add foreign key userpermissions_usergroups_permissionId_fk: {{%userpermissions_usergroups}} (permissionId) references {{%userpermissions}} (id) ... done (time: 0.007s)
    > add foreign key userpermissions_users_permissionId_fk: {{%userpermissions_users}} (permissionId) references {{%userpermissions}} (id) ... done (time: 0.007s)
    > add foreign key userpermissions_users_userId_fk: {{%userpermissions_users}} (userId) references {{%users}} (id) ... done (time: 0.006s)
    > add foreign key userpreferences_userId_fk: {{%userpreferences}} (userId) references {{%users}} (id) ... done (time: 0.007s)
    > add foreign key users_id_fk: {{%users}} (id) references {{%elements}} (id) ... done (time: 0.008s)
    > add foreign key users_photoId_fk: {{%users}} (photoId) references {{%assets}} (id) ... done (time: 0.007s)
    > add foreign key volumefolders_parentId_fk: {{%volumefolders}} (parentId) references {{%volumefolders}} (id) ... done (time: 0.005s)
    > add foreign key volumefolders_volumeId_fk: {{%volumefolders}} (volumeId) references {{%volumes}} (id) ... done (time: 0.007s)
    > add foreign key volumes_fieldLayoutId_fk: {{%volumes}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.006s)
    > add foreign key widgets_userId_fk: {{%widgets}} (userId) references {{%users}} (id) ... done (time: 0.010s)
    > populating the info table ... done
    > saving default site data ... Exception: The table does not exist: {{%fieldgroups}} (/app/vendor/yiisoft/yii2/db/ActiveRecord.php:438)
#0 /app/vendor/yiisoft/yii2/db/ActiveRecord.php(262): yii\db\ActiveRecord::getTableSchema()
#1 /app/vendor/yiisoft/yii2/db/ActiveRecord.php(234): yii\db\ActiveRecord::filterValidColumnNames(Object(craft\db\Connection), Array)
#2 /app/vendor/yiisoft/yii2/db/ActiveRecord.php(191): yii\db\ActiveRecord::filterCondition(Array, Array)
#3 /app/vendor/yiisoft/yii2/db/BaseActiveRecord.php(112): yii\db\ActiveRecord::findByCondition(Array)
#4 /app/vendor/craftcms/cms/src/services/Fields.php(1675): yii\db\BaseActiveRecord::findOne(Array)
#5 /app/vendor/craftcms/cms/src/services/Fields.php(302): craft\services\Fields->_getGroupRecord('e8c48d92-df77-4...')
#6 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(854): craft\services\Fields->handleChangedGroup(Object(craft\events\ConfigEvent))
#7 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#8 /app/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#9 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(545): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#10 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(927): craft\services\ProjectConfig->processConfigChanges('fieldGroups.e8c...')
#11 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(452): craft\services\ProjectConfig->_applyChanges(Array)
#12 /app/vendor/craftcms/cms/src/migrations/Install.php(1047): craft\services\ProjectConfig->applyConfigChanges(Array)
#13 /app/vendor/craftcms/cms/src/migrations/Install.php(73): craft\migrations\Install->insertDefaultData()
#14 /app/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\Install->safeUp()
#15 /app/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration->up(true)
#16 /app/vendor/craftcms/cms/src/console/controllers/InstallController.php(161): craft\db\MigrationManager->migrateUp(Object(craft\migrations\Install))
#17 [internal function]: craft\console\controllers\InstallController->actionCraft()
#18 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#19 /app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#20 /app/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array)
#21 /app/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array)
#22 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('install', Array)
#23 /app/vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('install', Array)
#24 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('install', Array)
#25 /app/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#26 /app/craft(22): yii\base\Application->run()
#27 {main}
Exception 'craft\errors\MigrationException' with message 'An error occurred while executing the "craft\migrations\Install migration: The table does not exist: {{%fieldgroups}}'

in /app/vendor/craftcms/cms/src/db/MigrationManager.php:260

Stack trace:
#0 /app/vendor/craftcms/cms/src/console/controllers/InstallController.php(161): craft\db\MigrationManager->migrateUp(Object(craft\migrations\Install))
#1 [internal function]: craft\console\controllers\InstallController->actionCraft()
#2 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#4 /app/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array)
#5 /app/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array)
#6 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('install', Array)
#7 /app/vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('install', Array)
#8 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('install', Array)
#9 /app/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#10 /app/craft(22): yii\base\Application->run()
#11 {main}

Steps to reproduce

  1. Create project with composer
  2. Configure database
  3. Run craft install

Additional info

config/db.php:

<?php

return [
    '*' => [
        'driver' => getenv('DB_DRIVER'),
        'server' => getenv('DB_SERVER'),
        'user' => getenv('DB_USER'),
        'password' => getenv('DB_PASSWORD'),
        'database' => getenv('DB_DATABASE'),
        'schema' => getenv('DB_SCHEMA'),
        'tablePrefix' => getenv('DB_TABLE_PREFIX'),
    ],
];

.env:

DB_DRIVER="pgsql"
DB_SERVER="db"
DB_USER="postgres"
DB_PASSWORD=""
DB_DATABASE="craft"
DB_SCHEMA="public"
DB_TABLE_PREFIX=""
michalochman commented 5 years ago

Looks like this is some Postgres 11 compatibility issue, I had no problem installing Craft on Postgres 10.

michalochman commented 5 years ago

Actually, I take my last comment back, I'm unable to install on a fresh Postgres 10.9 as well.

brandonkelly commented 5 years ago

Just tested with Postgres 10.9 and didn’t have any issues. Can you give me more details about your environment?

angrybrad commented 5 years ago

Curious about your environment as well... is the fieldgroups table the only missing one when you get that error?

michalochman commented 5 years ago

@angrybrad @brandonkelly must be some issue with my other config files – I haven't experienced any issues while setting up reproduction scenario on Docker (using both PostgreSQL 10.9 and 11.4) with no config other than .env file. I'll follow up if/when I find what was the root cause.

Can you give me more details about your environment?

I run it via pretty simple docker-compose setup, I'll share it when I find the cause.

Curious about your environment as well... is the fieldgroups table the only missing one when you get that error?

No tables were created in fact – not sure if Craft runs migrations using transactional DDL, but if it doesn't then that would be strange. The error pops up during a call to insertDefaultData step of install migration.

brandonkelly commented 5 years ago

I'll follow up if/when I find what was the root cause.

Cool, will close this for now. Let us know if you find something.

seanrabey commented 5 years ago

Hi all, I was having the same issue and came across this post. After some testing with different setups using vagrant and ansible to build a fresh box each test; it seems that if you change the database schema to anything other than "public" this error occurs. Hope that helps hone in on the issue - we would love to be able to use a different schema name :)

Thanks!

brandonkelly commented 5 years ago

@seanrabey that’s a Yii bug (https://github.com/yiisoft/yii2/issues/12763). I’ll ping them about it.

brandonkelly commented 5 years ago

@seanrabey Just looked into it a bit. If you want Craft to use a different schema, then you will need to change your search_path Postgres config setting to list that schema before public. Yii’s yii\db\Schema::$defaultSchema property (which Craft’s schema DB config setting maps to) is really just a way of telling Yii that it can safely omit that schema when building database queries. I’ve updated the setting’s docblock for the next release to clarify that.

hiasl commented 3 years ago

For more information: https://craftcms.stackexchange.com/questions/38405/why-do-postgres-schemas-different-from-public-not-work-with-craft/