Skip to content

Commit 4a073fa

Browse files
committed
Move schema changes to 1.11.9
1 parent 1415ff3 commit 4a073fa

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

bootstrap/sql/migrations/native/1.11.8/mysql/schemaChanges.sql

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,4 @@ WHERE
2323
-- Upgrade appliedAt to microsecond precision to match PostgreSQL behavior.
2424
-- Without this, MySQL returns second-precision timestamps which cause spurious
2525
-- diffs in JSON patch operations, leading to deserialization failures.
26-
ALTER TABLE tag_usage MODIFY appliedAt TIMESTAMP(6) NULL DEFAULT CURRENT_TIMESTAMP(6);
27-
28-
-- Change entity_extension_time_series.timestamp from VIRTUAL to STORED for performance.
29-
-- STORED columns are materialized on disk, making unique constraint checks and range
30-
-- queries on timestamp significantly faster (especially for bulk pipeline status upserts).
31-
-- MySQL does not allow ALTER from VIRTUAL to STORED directly, so we drop and re-add.
32-
ALTER TABLE entity_extension_time_series
33-
DROP INDEX entity_extension_time_series_constraint,
34-
DROP COLUMN `timestamp`,
35-
ADD COLUMN `timestamp` bigint unsigned GENERATED ALWAYS AS (json_unquote(json_extract(`json`, _utf8mb4'$.timestamp'))) STORED NOT NULL,
36-
ADD UNIQUE KEY `entity_extension_time_series_constraint` (`entityFQNHash`, `extension`, `timestamp`);
26+
ALTER TABLE tag_usage MODIFY appliedAt TIMESTAMP(6) NULL DEFAULT CURRENT_TIMESTAMP(6);

bootstrap/sql/migrations/native/1.11.8/postgres/schemaChanges.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ WHERE serviceType = 'Salesforce'
1111
AND json->'connection'->'config'->>'sobjectName' IS NOT NULL;
1212

1313
-- No changes needed for PostgreSQL - TIMESTAMP already has microsecond precision.
14-
15-
-- No changes needed for entity_extension_time_series.timestamp on PostgreSQL.
16-
-- PostgreSQL already uses STORED for the generated timestamp column (since table creation).
17-
-- MySQL migration changes it from VIRTUAL to STORED for consistency and performance.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Change entity_extension_time_series.timestamp from VIRTUAL to STORED for performance.
2+
-- STORED columns are materialized on disk, making unique constraint checks and range
3+
-- queries on timestamp significantly faster (especially for bulk pipeline status upserts).
4+
-- MySQL does not allow ALTER from VIRTUAL to STORED directly, so we drop and re-add.
5+
-- NOTE: This will lock the table for a full rebuild. On large deployments with millions
6+
-- of rows in entity_extension_time_series, plan for downtime accordingly.
7+
ALTER TABLE entity_extension_time_series
8+
DROP INDEX entity_extension_time_series_constraint,
9+
DROP COLUMN `timestamp`,
10+
ADD COLUMN `timestamp` bigint unsigned GENERATED ALWAYS AS (json_unquote(json_extract(`json`, _utf8mb4'$.timestamp'))) STORED NOT NULL,
11+
ADD UNIQUE KEY `entity_extension_time_series_constraint` (`entityFQNHash`, `extension`, `timestamp`);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- No changes needed for entity_extension_time_series.timestamp on PostgreSQL.
2+
-- PostgreSQL already uses STORED for the generated timestamp column (since table creation).
3+
-- MySQL migration changes it from VIRTUAL to STORED for consistency and performance.

0 commit comments

Comments
 (0)