Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Edit partition migration to only drop identity if it exists. (#79415)

technomancyaa6589120409
diff --git a/resources/migrations/064/20260723_query_execution_partitioned.yaml b/resources/migrations/064/20260723_query_execution_partitioned.yaml
index 20decb6dca2..1165ffb43da 100644
--- a/resources/migrations/064/20260723_query_execution_partitioned.yaml
+++ b/resources/migrations/064/20260723_query_execution_partitioned.yaml
@@ -24,6 +24,9 @@ databaseChangeLog:
id: v64.2026-07-23T11:39:56
author: technomancy
comment: Create partitioned query_execution table and attach old one
+ # had to edit this after the fact due to issues with stats schema diverging
+ # from the schema in dev/test
+ validCheckSum: ANY
dbms: postgresql
changes:
- sql:
@@ -34,7 +37,7 @@ databaseChangeLog:
PARTITION BY RANGE (started_at);
SELECT setval(pg_get_serial_sequence('query_execution', 'id'),
nextval(pg_get_serial_sequence('query_execution_old', 'id')));
- ALTER TABLE query_execution_old ALTER COLUMN id DROP IDENTITY;
+ ALTER TABLE query_execution_old ALTER COLUMN id DROP IDENTITY IF EXISTS;
ALTER TABLE query_execution ATTACH PARTITION query_execution_old
FOR VALUES FROM ('1970-01-01')
TO (date_trunc('month', current_timestamp + '2 months'::interval));