@@ -151,6 +151,83 @@ WHERE ue.name = 'mcpapplicationbot'
151151 AND re .name = ' ApplicationBotImpersonationRole'
152152ON CONFLICT DO NOTHING;
153153
154+ -- Migrate profiler sampling config: move flat profileSample/profileSampleType/samplingMethodType
155+ -- into the new profileSampleConfig structure. Default to STATIC since DYNAMIC is new.
156+
157+ -- Profiler configs are stored in entity_extension table, not in entity json columns.
158+ -- Extension keys: table.tableProfilerConfig, database.databaseProfilerConfig, databaseSchema.databaseSchemaProfilerConfig
159+ -- The json column in entity_extension contains the config object directly (flat root-level fields).
160+
161+ -- entity_extension: build profileSampleConfig from existing flat fields (skip if already migrated)
162+ UPDATE entity_extension
163+ SET json = jsonb_set(
164+ json::jsonb,
165+ ' {profileSampleConfig}' ,
166+ jsonb_build_object(
167+ ' sampleConfigType' , ' STATIC' ,
168+ ' config' , jsonb_build_object(
169+ ' profileSample' , json::jsonb # > '{profileSample}',
170+ ' profileSampleType' , COALESCE(
171+ json::jsonb # > '{profileSampleType}',
172+ ' "PERCENTAGE"' ::jsonb
173+ ),
174+ ' samplingMethodType' , json::jsonb # > '{samplingMethodType}'
175+ )
176+ )
177+ )::json
178+ WHERE extension IN (
179+ ' table.tableProfilerConfig' ,
180+ ' database.databaseProfilerConfig' ,
181+ ' databaseSchema.databaseSchemaProfilerConfig'
182+ )
183+ AND json::jsonb # >> '{profileSample}' IS NOT NULL
184+ AND json::jsonb # > '{profileSampleConfig}' IS NULL;
185+
186+ -- entity_extension: remove old flat fields
187+ UPDATE entity_extension
188+ SET json = (json::jsonb # - '{profileSample}'
189+ # - '{profileSampleType}'
190+ # - '{samplingMethodType}')::json
191+ WHERE extension IN (
192+ ' table.tableProfilerConfig' ,
193+ ' database.databaseProfilerConfig' ,
194+ ' databaseSchema.databaseSchemaProfilerConfig'
195+ )
196+ AND (json::jsonb # >> '{profileSample}' IS NOT NULL
197+ OR json::jsonb # >> '{profileSampleType}' IS NOT NULL
198+ OR json::jsonb # >> '{samplingMethodType}' IS NOT NULL);
199+
200+ -- ingestion_pipeline_entity (profiler pipelines): build profileSampleConfig (skip if already migrated)
201+ UPDATE ingestion_pipeline_entity
202+ SET json = jsonb_set(
203+ json::jsonb,
204+ ' {sourceConfig,config,profileSampleConfig}' ,
205+ jsonb_build_object(
206+ ' sampleConfigType' , ' STATIC' ,
207+ ' config' , jsonb_build_object(
208+ ' profileSample' , json::jsonb # > '{sourceConfig,config,profileSample}',
209+ ' profileSampleType' , COALESCE(
210+ json::jsonb # > '{sourceConfig,config,profileSampleType}',
211+ ' "PERCENTAGE"' ::jsonb
212+ ),
213+ ' samplingMethodType' , json::jsonb # > '{sourceConfig,config,samplingMethodType}'
214+ )
215+ )
216+ )::json
217+ WHERE json # >> '{pipelineType}' = 'profiler'
218+ AND json::jsonb # >> '{sourceConfig,config,profileSample}' IS NOT NULL
219+ AND json::jsonb # > '{sourceConfig,config,profileSampleConfig}' IS NULL;
220+
221+ -- ingestion_pipeline_entity (profiler pipelines): remove old flat fields
222+ UPDATE ingestion_pipeline_entity
223+ SET json = (json::jsonb # - '{sourceConfig,config,profileSample}'
224+ # - '{sourceConfig,config,profileSampleType}'
225+ # - '{sourceConfig,config,samplingMethodType}')::json
226+ WHERE json # >> '{pipelineType}' = 'profiler'
227+ AND (json::jsonb # >> '{sourceConfig,config,profileSample}' IS NOT NULL
228+ OR json::jsonb # >> '{sourceConfig,config,profileSampleType}' IS NOT NULL
229+ OR json::jsonb # >> '{sourceConfig,config,samplingMethodType}' IS NOT NULL);
230+
154231-- RDF distributed indexing state tables
155232CREATE TABLE IF NOT EXISTS rdf_index_job (
156233 id VARCHAR (36 ) NOT NULL ,
0 commit comments