This is an automated email from the ASF dual-hosted git repository.

zqr10159 pushed a commit to branch 2.0.0
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/2.0.0 by this push:
     new 802ab06db4 fix(startup): keep entity foundation migration in V200
802ab06db4 is described below

commit 802ab06db4f5d23a4205ce23311fb22280a52093
Author: Logic <[email protected]>
AuthorDate: Wed Jun 3 18:45:16 2026 +0800

    fix(startup): keep entity foundation migration in V200
---
 .../V213__backfill_entity_governance_workspace.sql | 32 ----------
 .../V213__backfill_entity_governance_workspace.sql | 73 ----------------------
 .../V213__backfill_entity_governance_workspace.sql | 32 ----------
 .../ReleaseReadinessRuntimeAssemblyTest.java       |  4 +-
 4 files changed, 2 insertions(+), 139 deletions(-)

diff --git 
a/hertzbeat-startup/src/main/resources/db/migration/h2/V213__backfill_entity_governance_workspace.sql
 
b/hertzbeat-startup/src/main/resources/db/migration/h2/V213__backfill_entity_governance_workspace.sql
deleted file mode 100644
index 620f23391b..0000000000
--- 
a/hertzbeat-startup/src/main/resources/db/migration/h2/V213__backfill_entity_governance_workspace.sql
+++ /dev/null
@@ -1,32 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements.  See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership.  The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License.  You may obtain a copy of the License at
---
---   http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing,
--- software distributed under the License is distributed on an
--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
--- KIND, either express or implied.  See the License for the
--- specific language governing permissions and limitations
--- under the License.
-
-ALTER TABLE hzb_entity_governance_state
-    ADD COLUMN IF NOT EXISTS workspace_id VARCHAR(64) DEFAULT 'default';
-
-UPDATE hzb_entity_governance_state
-SET workspace_id = 'default'
-WHERE workspace_id IS NULL OR workspace_id = '';
-
-ALTER TABLE hzb_entity_governance_state
-    ALTER COLUMN workspace_id SET DEFAULT 'default';
-
-CREATE UNIQUE INDEX IF NOT EXISTS 
uk_hzb_entity_governance_state_scope_kind_workspace_key
-    ON hzb_entity_governance_state(state_scope, state_kind, workspace_id, 
state_key);
-
-CREATE INDEX IF NOT EXISTS idx_hzb_entity_governance_state_scope_kind_workspace
-    ON hzb_entity_governance_state(state_scope, state_kind, workspace_id);
diff --git 
a/hertzbeat-startup/src/main/resources/db/migration/mysql/V213__backfill_entity_governance_workspace.sql
 
b/hertzbeat-startup/src/main/resources/db/migration/mysql/V213__backfill_entity_governance_workspace.sql
deleted file mode 100644
index 48d46d9469..0000000000
--- 
a/hertzbeat-startup/src/main/resources/db/migration/mysql/V213__backfill_entity_governance_workspace.sql
+++ /dev/null
@@ -1,73 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements.  See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership.  The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License.  You may obtain a copy of the License at
---
---   http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing,
--- software distributed under the License is distributed on an
--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
--- KIND, either express or implied.  See the License for the
--- specific language governing permissions and limitations
--- under the License.
-
-DELIMITER //
-CREATE PROCEDURE BackfillEntityGovernanceWorkspace()
-BEGIN
-    DECLARE table_exists INT DEFAULT 0;
-    DECLARE workspace_column_exists INT DEFAULT 0;
-    DECLARE workspace_index_exists INT DEFAULT 0;
-    DECLARE workspace_unique_exists INT DEFAULT 0;
-
-    SELECT COUNT(*) INTO table_exists
-    FROM INFORMATION_SCHEMA.TABLES
-    WHERE TABLE_SCHEMA = DATABASE()
-      AND TABLE_NAME = 'hzb_entity_governance_state';
-
-    IF table_exists = 1 THEN
-        SELECT COUNT(*) INTO workspace_column_exists
-        FROM INFORMATION_SCHEMA.COLUMNS
-        WHERE TABLE_SCHEMA = DATABASE()
-          AND TABLE_NAME = 'hzb_entity_governance_state'
-          AND COLUMN_NAME = 'workspace_id';
-
-        IF workspace_column_exists = 0 THEN
-            ALTER TABLE hzb_entity_governance_state
-                ADD COLUMN workspace_id VARCHAR(64) DEFAULT 'default';
-        END IF;
-
-        UPDATE hzb_entity_governance_state
-        SET workspace_id = 'default'
-        WHERE workspace_id IS NULL OR workspace_id = '';
-
-        SELECT COUNT(*) INTO workspace_unique_exists
-        FROM INFORMATION_SCHEMA.STATISTICS
-        WHERE TABLE_SCHEMA = DATABASE()
-          AND TABLE_NAME = 'hzb_entity_governance_state'
-          AND INDEX_NAME = 
'uk_hzb_entity_governance_state_scope_kind_workspace_key';
-
-        IF workspace_unique_exists = 0 THEN
-            CREATE UNIQUE INDEX 
uk_hzb_entity_governance_state_scope_kind_workspace_key
-                ON hzb_entity_governance_state(state_scope, state_kind, 
workspace_id, state_key);
-        END IF;
-
-        SELECT COUNT(*) INTO workspace_index_exists
-        FROM INFORMATION_SCHEMA.STATISTICS
-        WHERE TABLE_SCHEMA = DATABASE()
-          AND TABLE_NAME = 'hzb_entity_governance_state'
-          AND INDEX_NAME = 
'idx_hzb_entity_governance_state_scope_kind_workspace';
-
-        IF workspace_index_exists = 0 THEN
-            CREATE INDEX idx_hzb_entity_governance_state_scope_kind_workspace
-                ON hzb_entity_governance_state(state_scope, state_kind, 
workspace_id);
-        END IF;
-    END IF;
-END //
-DELIMITER ;
-
-CALL BackfillEntityGovernanceWorkspace();
-DROP PROCEDURE IF EXISTS BackfillEntityGovernanceWorkspace;
diff --git 
a/hertzbeat-startup/src/main/resources/db/migration/postgresql/V213__backfill_entity_governance_workspace.sql
 
b/hertzbeat-startup/src/main/resources/db/migration/postgresql/V213__backfill_entity_governance_workspace.sql
deleted file mode 100644
index 620f23391b..0000000000
--- 
a/hertzbeat-startup/src/main/resources/db/migration/postgresql/V213__backfill_entity_governance_workspace.sql
+++ /dev/null
@@ -1,32 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements.  See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership.  The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License.  You may obtain a copy of the License at
---
---   http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing,
--- software distributed under the License is distributed on an
--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
--- KIND, either express or implied.  See the License for the
--- specific language governing permissions and limitations
--- under the License.
-
-ALTER TABLE hzb_entity_governance_state
-    ADD COLUMN IF NOT EXISTS workspace_id VARCHAR(64) DEFAULT 'default';
-
-UPDATE hzb_entity_governance_state
-SET workspace_id = 'default'
-WHERE workspace_id IS NULL OR workspace_id = '';
-
-ALTER TABLE hzb_entity_governance_state
-    ALTER COLUMN workspace_id SET DEFAULT 'default';
-
-CREATE UNIQUE INDEX IF NOT EXISTS 
uk_hzb_entity_governance_state_scope_kind_workspace_key
-    ON hzb_entity_governance_state(state_scope, state_kind, workspace_id, 
state_key);
-
-CREATE INDEX IF NOT EXISTS idx_hzb_entity_governance_state_scope_kind_workspace
-    ON hzb_entity_governance_state(state_scope, state_kind, workspace_id);
diff --git 
a/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/ReleaseReadinessRuntimeAssemblyTest.java
 
b/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/ReleaseReadinessRuntimeAssemblyTest.java
index 23d2dcb482..327945fd5e 100644
--- 
a/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/ReleaseReadinessRuntimeAssemblyTest.java
+++ 
b/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/ReleaseReadinessRuntimeAssemblyTest.java
@@ -78,12 +78,12 @@ class ReleaseReadinessRuntimeAssemblyTest {
     }
 
     @Test
-    void entityGovernanceStateWorkspaceBackfillIsExplicitForLegacyDatabases() 
throws IOException {
+    void entityGovernanceStateWorkspaceBoundaryLivesInV200Baseline() throws 
IOException {
         for (String database : List.of("mysql", "postgresql", "h2")) {
             String migration = readRepoFile(
                     "hertzbeat-startup/src/main/resources/db/migration/"
                             + database
-                            + "/V213__backfill_entity_governance_workspace.sql"
+                            + "/V200__create_entity_foundation.sql"
             ).toLowerCase();
 
             assertThat(migration)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to