pelican-dev / panel

https://pelican.dev
GNU Affero General Public License v3.0
715 stars 78 forks source link

upgrade from beta 2 to 4 fails, Duplicate entry uuid in eggs #348

Closed Tealk closed 2 months ago

Tealk commented 2 months ago

Current Behavior

The update fails due to an ambiguous uuid

php artisan migrate --seed --force

   INFO  Running migrations.  

  2024_06_02_205622_update_stock_egg_uuid ........................................................................... 0.80ms FAIL

In Connection.php line 808:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9e6b409e-4028-4947-aea8-50a2c404c271' for key 'service_  
  options_uuid_unique' (Connection: mysql, SQL: update `eggs` set `uuid` = 9e6b409e-4028-4947-aea8-50a2c404c271 where `name` = B  
  ungeecord)                                                                                                                      

In Connection.php line 596:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9e6b409e-4028-4947-aea8-50a2c404c271' for key 'service_  
  options_uuid_unique'                         
+--------------------------------------+----------------------------------+
| uuid                                 | name                             |
+--------------------------------------+----------------------------------+
| ad1117a7-198c-44e9-a770-0ba0f236a108 | Bungeecord                       |
| fb2e9b2a-ba9d-4316-a318-dc3b9e0fcbf0 | Forge Minecraft                  |
| 014803d9-ab21-4dc3-b8f3-5f85007d6d78 | Paper                            |
| 12555639-2dff-4e5e-bc74-2b62f76ac490 | Sponge (SpongeVanilla)           |
| c1b89dce-1858-458f-b656-6009d7d3ffd3 | Vanilla Minecraft                |
| 949b3aef-cd33-49f5-bf66-30346c233ec0 | Ark: Survival Evolved            |
| bcdafc07-31ac-44cf-adc7-083b4906ee37 | Counter-Strike: Global Offensive |
| e0a54474-97af-46f4-b483-b16bb83bb80d | Custom Source Engine Game        |
| 5274c76f-b55c-4b20-b781-d0a1d47452c6 | Garrys Mod                       |
| bc16bf86-d1d1-4e32-8e1c-5abbcb7ec2c5 | Insurgency                       |
| dcbbde1f-2f38-4d4a-bbfe-f34a0659afcf | Team Fortress 2                  |
| db89ceb9-c6ec-4953-936d-e22d2df4f535 | Mumble Server                    |
| 34d91ef5-a247-4194-ab77-23c8f7ac1728 | Teamspeak3 Server                |
| a431791a-8be4-4c42-bcfd-4598c3a8b47d | Rust                             |
| ee96f453-6482-4204-98fa-f42312e4e7e1 | 7 Days To Die                    |
| df9d70c5-af3a-43de-b0fb-f92c3278a026 | Waterfall                        |
| 62dcc555-ade2-4d45-8bd4-9ad96f730b1b | Minetest                         |
| d260c4bf-a5e3-455b-8ab4-24820a96985d | Rising World                     |
| c9c7e395-8ae0-48ea-b5b1-a797e01b7be7 | Minetest_old                     |
| d425aef4-6a5b-470e-b89b-f5fd66a2a9a6 | LanguageTool                     |
| ca507907-66de-4b6c-b173-bc986521c450 | Foundry VTT                      |
| 6cfd3f08-e680-48a1-a473-aba4bbb1468f | JTS3ServerMod                    |
| 501b3064-9f89-4589-a918-2941b8d83dc6 | LanguageTool                     |
| aab07abb-04ee-4fa8-92d5-2ffdfa2ff80f | Draupnir                         |
| e4bccbe9-3117-4dd0-964c-de086530426d | node.js generic                  |
| c8f77f97-4aff-45a6-8b5b-be00738b6c0e | node.js generic                  |
| d13042f6-8fc8-446c-baa4-8e2dc8f86862 | Valheim                          |
| ea4469be-fe9f-4d6c-af94-fc2463ce6626 | Palworld                         |
| ddfa9cce-b218-4055-9757-73ade2e80907 | Enshrouded                       |
| 9dc324dd-95a1-4ab2-9fa1-d2806c578efb | Paper                            |
| c3724cdb-a8aa-43f9-a511-caa91198a258 | Bungeecord                       |
| ce3337e7-810e-4fcb-9432-77554df7da2b | Vanilla Minecraft                |
| a1171e13-7307-4d45-8858-8b2e39940a5b | Forge Minecraft                  |
| edb1cb21-0a1d-4fee-88bb-12a8c8c14abb | Sponge (SpongeVanilla)           |
| 3a89dada-254d-47d1-8813-1ad5effa428f | Counter-Strike: Global Offensive |
| 5bf9dc7f-839b-4639-bef6-387b8c329a3e | Garrys Mod                       |
| e8482a22-43f2-4aff-8f2d-581e6d3223c7 | Custom Source Engine Game        |
| 15a95744-16f8-4c23-88e3-7eded0bbf10d | Insurgency                       |
| 5003a5d9-64b2-47e4-9874-9d089397525f | Team Fortress 2                  |
| a4563ae5-ff8e-4b19-8cce-45b756b59988 | Mumble Server                    |
| 85171d34-e5f2-49e6-96a1-397e384034fc | Teamspeak3 Server                |
| fdbfa003-be64-4a20-8378-88311350a35f | Rust                             |
+--------------------------------------+----------------------------------+

Expected Behavior

update runs through without errors

Steps to Reproduce

I have followed the following https://pelican.dev/docs/panel/update/

Panel Version

v1.0.0-beta2

Wings Version

v1.0.0-beta2

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

notAreYouScared commented 2 months ago

So the issue is that the migrations update the UUID's of the eggs to support updating based on uuid You have two copies of the stock eggs with the same names.

Delete one of the copies of the eggs. and try the migration again.

Tealk commented 2 months ago

the question is where the duplications come from. Perhaps from the upgrade from pterodactyl to pelican?

notAreYouScared commented 2 months ago

They most likely came from upgrading from beta 1 to beta 2. If you're not using any of them at the moment, you could just empty the table, and the seeder should replace them.

Tealk commented 2 months ago

I have just deleted all duplicates that were newer.

DELETE FROM eggs
WHERE id IN (
    SELECT id FROM (
        SELECT 
            id, 
            ROW_NUMBER() OVER (PARTITION BY name ORDER BY created_at) AS rn
        FROM 
            eggs
    ) AS RankedEggs
    WHERE rn > 1
);
notAreYouScared commented 2 months ago

Were you able to get the migrations to run?

Tealk commented 2 months ago

Yes, the migration was then successfully completed.