-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[persistence] add namespace to persistence tables (#1475)
* [persistence] add namespace to tables except task_entity * [persistence] add namespace to task_entity table * add indexes and uniqueness constraints
- Loading branch information
1 parent
b87705f
commit 53e45ef
Showing
9 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 5 additions & 21 deletions
26
thirdeye-persistence/src/main/resources/db/migration/mysql/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,15 @@ | ||
|
||
## [V1_293_0__remove_name_unique_constraints_datasource.sql](V1_293_0__remove_name_unique_constraints_datasource.sql) | ||
Datasource: | ||
TODO CYRIL authz best would be to have a constraint on (name, namespace) but namespace is not added to the index tables yet | ||
for the moment we just remove the name unique constraints | ||
indexes should be revisited once the namespace migration is done | ||
Datasource: DONE | ||
|
||
## [V1_293_1__remove_name_unique_constraints_dataset.sql](V1_293_1__remove_name_unique_constraints_dataset.sql) | ||
Dataset: | ||
TODO CYRIL authz best would be to have a constraint on (name, namespace) but namespace is not added to the index tables yet | ||
for the moment we just remove the name unique constraints | ||
indexes should be revisited once the namespace migration is done | ||
Dataset: DONE | ||
|
||
## [V1_293_2__remove_name_dataset_unique_constraints_metrics.sql](V1_293_2__remove_name_dataset_unique_constraints_metrics.sql) | ||
Metrics: | ||
TODO CYRIL authz best would be to have a constraint on (name, dataset, namespace) but namespace is not added to the index tables yet | ||
for the moment we just remove the name unique constraints | ||
indexes should be revisited once the namespace migration is done | ||
Metrics: DONE | ||
|
||
## [V1_293_4__remove_name_unique_constraints_alert.sql](V1_293_4__remove_name_unique_constraints_alert.sql) | ||
Alert | ||
TODO CYRIL authz best would be to have a constraint on (name, namespace) but namespace is not added to the index tables yet | ||
for the moment we just remove the name unique constraints | ||
indexes should be revisited once the namespace migration is done | ||
Alert: DONE | ||
|
||
## [V1_293_5__remove_name_unique_constraints_subscription_group.sql](V1_293_5__remove_name_unique_constraints_subscription_group.sql) | ||
Subscription Group | ||
TODO CYRIL authz best would be to have a constraint on (name, namespace) but namespace is not added to the index tables yet | ||
for the moment we just remove the name unique constraints | ||
indexes should be revisited once the namespace migration is done | ||
|
||
Subscription Group: DONE |
55 changes: 55 additions & 0 deletions
55
thirdeye-persistence/src/main/resources/db/migration/mysql/V1_302_0__add_namespace.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2023 StarTree Inc | ||
* | ||
* Licensed under the StarTree Community License (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.startree.ai/legal/startree-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the | ||
* License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, | ||
* either express or implied. | ||
* See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
ALTER TABLE alert_template_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON alert_template_index (namespace); | ||
ALTER TABLE alert_template_index ADD UNIQUE unique_name_namespace (`name`, namespace); | ||
|
||
ALTER TABLE anomaly_feedback_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON anomaly_feedback_index (namespace); | ||
|
||
ALTER TABLE data_source_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON data_source_index (namespace); | ||
ALTER TABLE data_source_index ADD UNIQUE unique_name_namespace (`name`, namespace); | ||
|
||
ALTER TABLE dataset_config_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON dataset_config_index (namespace); | ||
ALTER TABLE dataset_config_index ADD UNIQUE unique_name_namespace (dataset, namespace); | ||
|
||
ALTER TABLE detection_alert_config_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON detection_alert_config_index (namespace); | ||
ALTER TABLE detection_alert_config_index ADD UNIQUE unique_name_namespace (`name`, namespace); | ||
|
||
ALTER TABLE detection_config_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON detection_config_index (namespace); | ||
ALTER TABLE detection_config_index ADD UNIQUE unique_name_namespace (`name`, namespace); | ||
|
||
ALTER TABLE enumeration_item_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON enumeration_item_index (namespace); | ||
|
||
ALTER TABLE event_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON event_index (namespace); | ||
|
||
ALTER TABLE merged_anomaly_result_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON merged_anomaly_result_index (namespace); | ||
|
||
ALTER TABLE metric_config_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON metric_config_index (namespace); | ||
ALTER TABLE metric_config_index ADD UNIQUE unique_name_dataset_namespace (`name`, dataset, namespace); | ||
|
||
ALTER TABLE rca_investigation_index ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON rca_investigation_index (namespace); | ||
|
||
ALTER TABLE task_entity ADD COLUMN namespace varchar(255) DEFAULT NULL; | ||
CREATE INDEX namespace_idx ON task_entity (namespace); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters