The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
# Finally, we want the query_execution_old table to be named after the same
# pattern as the new partitions will have in order to make the logic for
# detaching them simpler: query_execution_2026-08 for example if the migration
# was run in July 2026 (extra month to allow time for jobs to run).
#
# But we don't know when the migration will be run, so that has to be
# calculated dynamically, which requires use of 'EXECUTE'. Because of the
# complication of dynamic calculation, we delay the rename of the table to the
# end so only one query needs to be dynamic.
databaseChangeLog:
- changeSet:
id: v64.2026-07-25T00:39:56
author: technomancy
comment: Rename old query_execution partition to match naming scheme
dbms: postgresql
changes:
- sql:
sql: >-
DO $$
BEGIN
EXECUTE format('ALTER TABLE query_execution_old RENAME TO query_execution_%s;',
TO_CHAR(current_timestamp + '1 month'::interval, 'YYYY_MM'));
END
$$ language plpgsql;
rollback:
- sql:
sql: >-
DO $$
BEGIN
EXECUTE format('ALTER TABLE %s RENAME TO query_execution_old;',
(SELECT table_name FROM information_schema.tables
WHERE table_name LIKE 'query_execution_%'
ORDER BY table_name ASC LIMIT 1));
END
$$ language plpgsql;