nerds-and-company / schematic

Craft Setup Sync
MIT License
136 stars 14 forks source link

"No mapping found for source" appearing during export #172

Closed mtnorthrop closed 5 years ago

mtnorthrop commented 5 years ago

Hello, there is a good chance that this is not a bug in this plugin specifically, but I'm seeing behavior that I don't understand and am not able to fix.

When running the export command in the terminal, I'm seeing this output:

Exporting fields
No mapping found for source section:3

The "No mapping found..." message seems to be from the 'fields' export. Also, in the terminal, Schematic reports that it is 'Exporting fields' twice: Once near the beginning and once at the very end, making me believe that it's trying to export fields twice, which seems strange to me:

Exporting plugins
Exporting sites
Exporting volumes
Exporting assetTransforms
Exporting fields
No mapping found for source section:3
Exporting generalSettings
Exporting sections
Exporting globalSets
Exporting categoryGroups
Exporting tagGroups
Exporting userGroups
Exporting userSettings
Exporting elementIndexSettings
Exporting fields
No mapping found for source section:3
Exporting userGroups
Exported schema to config/schema.yml

I started noticing this behavior after I:

  1. Created a new Fields group
  2. Moved fields from an old group into the new group
  3. Deleted the old group
  4. Deleted a Section that was using fields in the old group

I'm guessing that the issue has appeared due to my deleting the field group and/or the section. Would anybody be able to give me an idea why I'm seeing the "No mapping found..." message, why Schematic reports it's exporting fields twice, and what I could do to fix these issues? I'd be very appreciative for any hints!

bvangennep commented 5 years ago

Schematic needs to import fields twice because of sources that are imported later. Because of the current implementation fields are also exported twice.

The error indicates a field has a source 'section:3' but that a section with id 3 can not be found. 'section:3' should still be in the database somewhere. At the top of my head in the fields table.

mtnorthrop commented 5 years ago

@bvangennep Thank you very much for your response.

By checking the fields table and searching for 'section:3' in the settings field, I discovered that an Entry field still existed that referred to the deleted section. After deleting this Entry field, Schematic ran without reporting any errors.

Thanks again; I appreciate you taking the time to respond. I'll close this issue now, and I hope it will be a helpful reference to others who make the same mistake I did in the future.