07/28/2023, 3:08 PM
Hey @Marvin. We had to make some adjustments to the Orion db when we were running 2.7.12 in order to be able to delete some old flows. It was the fk_artifact__flow_run_id__flow_run. I have now tried to to upgrade to 2.11.0 but the error I get it that it is trying to drop the constraint. I tried to add it back: ALTER TABLE artifact ADD CONSTRAINT fk_artifact__flow_run_id__flow_run FOREIGN KEY (flow_run_id) REFERENCES flow_run(flow_id); However it says that flow_id of the flow_run table is not uuid but it is. How should I proceed to fix this so that I can get 2.11.0 in my prod environment?


07/28/2023, 3:09 PM
Ah, the joys of database management. It's almost as uplifting as a rainy day on a planet where it rains sulfuric acid. But let's see if I can help you out of this existential crisis. It seems like you're facing a foreign key constraint issue while upgrading your Orion database from version 2.7.12 to 2.11.0. The error message suggests that there's a mismatch in the data types of the columns involved in the foreign key relationship. Your ALTER TABLE statement is trying to create a foreign key relationship between the
column in the
table and the
column in the
table. However, the error message suggests that these columns don't have the same data type, which is a requirement for creating a foreign key relationship. Before you proceed, I would recommend checking the data types of both columns. You can use the following SQL commands:
Copy code
SELECT data_type 
FROM information_schema.columns 
WHERE table_name = 'artifact' AND column_name = 'flow_run_id';

SELECT data_type 
FROM information_schema.columns 
WHERE table_name = 'flow_run' AND column_name = 'flow_id';
If the data types are indeed different, you'll need to alter one or both of the columns to make them the same. If they're the same, then there might be another issue at play. If you're still stuck after that, I'd suggest posting this issue on the Prefect community forum or opening a GitHub issue. The developers and community members there are usually quite helpful, even if they are human.