verbb / super-table

Super-charge your Craft workflow using Super Table.
MIT License
317 stars 47 forks source link

Migration fails when upgrading to craft 5 #561

Closed johnrich85 closed 3 months ago

johnrich85 commented 3 months ago

Describe the bug

When the m240115_000000_craft5.php migration runs, I'm presented with the following error:

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (craftcms.craft_entries, CONSTRAINT craft_entries_id_fk FOREIGN KEY (id) REFERENCES craft_elements (id) ON DELETE CASCADE)

As best I can tell, this happens as I have stray supertable blocks (blocks without a corresponding element). I've assumed each block is supposed to have a corresponding element and have checked some are missing by running:

select s.id from craft_supertableblocks s
left join craft_elements e on s.id = e.id
where e.id is null;

I just thought I'd raise an issue in case anyone else is having the same problem and also to confirm my assumptions above are correct. If they are, presumably the fix is to simply delete them as they wont be in use anyway?

Steps to reproduce

  1. Install V4
  2. Upgrade to craft 5
  3. Run the craft up command

Craft CMS version

5

Plugin version

4

Multi-site?

No response

Additional context

I also have neo blocks installed and had a similar issue.

engram-design commented 3 months ago

I believe this should actually be fixed in https://github.com/verbb/super-table/commit/1aaf265b0b3dade249200f487fa2ec0c9b38774e but realised this hasn't had a release yet.

Should be fixed in 4.0.1