This is an automated email from the ASF dual-hosted git repository. shenlin pushed a commit to branch runtimer in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
commit d03c361d6c3ee26a1303bcc4bfb70262b72001c6 Author: wangkai <[email protected]> AuthorDate: Mon Jun 5 20:03:15 2023 +0800 1.merge h2-migration and migration --- .../resources/db/h2-migration/V1__baseline.sql | 165 ------------- .../resources/db/h2-migration/V2__baseline.sql | 49 ---- .../V3__change_target_transform_type.sql | 19 -- .../h2-migration/V4__register_source_acs_mns.sql | 18 -- .../V5__register_target_acs_dingtalk.sql | 20 -- .../V6__register_target_acs_eventbridge.sql | 20 -- ...V7__update_event_connection_table_structure.sql | 19 -- .../db/h2-migration/V8__update_unique_key.sql | 22 -- .../main/resources/db/migration/V1__baseline.sql | 256 ++++++++++----------- .../main/resources/db/migration/V2__baseline.sql | 44 ++-- .../migration/V3__change_target_transform_type.sql | 32 +-- .../db/migration/V4__register_source_acs_mns.sql | 32 +-- .../migration/V5__register_target_acs_dingtalk.sql | 30 +-- .../V6__register_target_acs_eventbridge.sql | 32 +-- ...V7__update_event_connection_table_structure.sql | 35 +-- .../db/migration/V8__update_unique_key.sql | 40 ++-- docs/cn/RocketMQEventBridgeDatabaseUsage.md | 12 +- start/src/main/resources/application.properties | 1 - 18 files changed, 262 insertions(+), 584 deletions(-) diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql deleted file mode 100644 index 3909293..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql +++ /dev/null @@ -1,165 +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. - */ - -CREATE TABLE IF NOT EXISTS `event_bus` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'bus account id', - `name` varchar(255) NOT NULL COMMENT 'bus name', - `description` varchar(256) DEFAULT NULL COMMENT 'bus description', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `event_topic` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL COMMENT 'topic name', - `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl', - `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic', - `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_topicdd` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `event_source` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type', - `class_name` varchar(255) COMMENT 'event source class name', - `config` text COMMENT 'event source runner config', - `description` varchar(1024) DEFAULT NULL COMMENT 'event source description', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - -CREATE TABLE IF NOT EXISTS `event_type` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'bus account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - -CREATE TABLE IF NOT EXISTS `event_rule` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'bus account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL COMMENT 'rule name', - `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern', - `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - UNIQUE KEY `id` (`id`), - UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - -CREATE TABLE IF NOT EXISTS `event_source_runner` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', - `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options', - `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - -CREATE TABLE IF NOT EXISTS `event_target` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', - `class_name` varchar(255) NOT NULL COMMENT 'event target class name', - `config` text NOT NULL COMMENT 'event target runner config', - `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - - - -CREATE TABLE IF NOT EXISTS `event_target_runner` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', - `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', - `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - - -CREATE TABLE IF NOT EXISTS `event_source_class` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name', - `api_params` text NOT NULL COMMENT 'event source api params', - `required_params` text NOT NULL COMMENT 'event source required params', - `transform` text NOT NULL COMMENT 'transform the event source data', - `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_source_class` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - - -CREATE TABLE IF NOT EXISTS `event_target_class` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name', - `api_params` text NOT NULL COMMENT 'event target api params', - `target_transform` text NOT NULL COMMENT 'event target required data', - `required_params` text NOT NULL COMMENT 'event target required params', - `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_target_class` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql deleted file mode 100644 index c70912c..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql +++ /dev/null @@ -1,49 +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. - */ - -CREATE TABLE IF NOT EXISTS `event_connection` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'event_connection account id', - `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称', - `authorization_type` varchar(128) DEFAULT NULL COMMENT '授权类型', - `auth_parameters` text DEFAULT NULL COMMENT '', - `network_type` varchar(128) NOT NULL DEFAULT '' COMMENT '网络类型', - `network_parameters` text DEFAULT NULL COMMENT '网络配置', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_connection', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_connection` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; - - -CREATE TABLE IF NOT EXISTS `event_api_destination` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'event_api_destination account id', - `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称', - `protocol` varchar(128) NOT NULL DEFAULT '' COMMENT '类型', - `api_params` text NOT NULL COMMENT 'API 参数', - `connection_name` varchar(128) DEFAULT NULL COMMENT '连接信息', - `invocation_rate_limit_per_second` int(11) COMMENT '每秒推送速率', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_api_destination', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key_event_api_destination` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql deleted file mode 100644 index b2a18c2..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql +++ /dev/null @@ -1,19 +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 `event_target_class` -CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ; diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql deleted file mode 100644 index 1ad499a..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql +++ /dev/null @@ -1,18 +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. - */ - -INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...] diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql deleted file mode 100644 index 1d8a643..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql +++ /dev/null @@ -1,20 +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. - */ - -INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) -VALUES -('acs.dingtalk','{\n \"WebHook\":{\n \"type\":\"String\",\n \"desc\":\"the endpoint of webhook.\",\n \"required\":true\n },\n \"SecretKey\":{\n \"type\":\"String\",\n \"desc\":\"the secret key.\",\n \"required\":true\n },\n \"Body\":{\n \"type\":\"boolean\",\n \"desc\":\"the content of request\"\n }\n}','{ \"data\":\"${Body}\" }','{\n \"webHook\":\"${WebHook}\",\n \"secretKey\":\"${SecretKey}\",\n \"cl [...] \ No newline at end of file diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql deleted file mode 100644 index b7587a0..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql +++ /dev/null @@ -1,20 +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. - */ - -INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) -VALUES -('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...] diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql deleted file mode 100644 index e98bbf0..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql +++ /dev/null @@ -1,19 +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 `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`; ---ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`; \ No newline at end of file diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql deleted file mode 100644 index 2e9098e..0000000 --- a/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql +++ /dev/null @@ -1,22 +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 `event_connection` DROP INDEX `name_uniq_key_event_connection`; -ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE; - -ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`; -ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE; \ No newline at end of file diff --git a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql index e301d56..3909293 100644 --- a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql +++ b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql @@ -1,17 +1,19 @@ -# 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. +/* + * 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. + */ CREATE TABLE IF NOT EXISTS `event_bus` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, @@ -21,145 +23,143 @@ CREATE TABLE IF NOT EXISTS `event_bus` ( `gmt_create` datetime DEFAULT NULL COMMENT 'create time', `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event bus meta' -; + UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `event_topic` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL COMMENT 'topic name', - `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl', - `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic', - `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -; +CREATE TABLE IF NOT EXISTS `event_topic` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `name` varchar(255) NOT NULL COMMENT 'topic name', + `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl', + `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic', + `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_topicdd` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `event_source` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type', - `class_name` varchar(255) COMMENT 'event source class name', - `config` text COMMENT 'event source runner config', - `description` varchar(1024) DEFAULT NULL COMMENT 'event source description', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source meta' + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable', + `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type', + `class_name` varchar(255) COMMENT 'event source class name', + `config` text COMMENT 'event source runner config', + `description` varchar(1024) DEFAULT NULL COMMENT 'event source description', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_type` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'bus account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`source`,`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event type meta' + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) NOT NULL COMMENT 'bus account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name', + `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name', + `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_rule` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) NOT NULL COMMENT 'bus account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `name` varchar(255) NOT NULL COMMENT 'rule name', - `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern', - `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - UNIQUE KEY `id` (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`name`,`bus`) - ) ENGINE=InnoDB AUTO_INCREMENT=51815 DEFAULT CHARSET=utf8 COMMENT='event rule meta' + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) NOT NULL COMMENT 'bus account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `name` varchar(255) NOT NULL COMMENT 'rule name', + `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern', + `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable', + `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + UNIQUE KEY `id` (`id`), + UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_source_runner` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', - `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options', - `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`source`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source runner meta' + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name', + `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options', + `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_target` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', - `class_name` varchar(255) NOT NULL COMMENT 'event target class name', - `config` text NOT NULL COMMENT 'event target runner config', - `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target meta' + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', + `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', + `class_name` varchar(255) NOT NULL COMMENT 'event target class name', + `config` text NOT NULL COMMENT 'event target runner config', + `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_target_runner` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', - `bus` varchar(255) NOT NULL COMMENT 'bus name', - `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', - `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', - `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`target`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target runner meta' + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id', + `bus` varchar(255) NOT NULL COMMENT 'bus name', + `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name', + `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name', + `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_source_class` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name', - `api_params` text NOT NULL COMMENT 'event source api params', - `required_params` text NOT NULL COMMENT 'event source required params', - `transform` text NOT NULL COMMENT 'transform the event source data', - `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source class meta' + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name', + `api_params` text NOT NULL COMMENT 'event source api params', + `required_params` text NOT NULL COMMENT 'event source required params', + `transform` text NOT NULL COMMENT 'transform the event source data', + `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config', + `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_source_class` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `event_target_class` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name', - `api_params` text NOT NULL COMMENT 'event target api params', - `target_transform` text NOT NULL COMMENT 'event target required data', - `required_params` text NOT NULL COMMENT 'event target required params', - `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config', - `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class', - `gmt_create` datetime DEFAULT NULL COMMENT 'create time', - `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', - PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target class meta' -; \ No newline at end of file + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name', + `api_params` text NOT NULL COMMENT 'event target api params', + `target_transform` text NOT NULL COMMENT 'event target required data', + `required_params` text NOT NULL COMMENT 'event target required params', + `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config', + `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class', + `gmt_create` datetime DEFAULT NULL COMMENT 'create time', + `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', + PRIMARY KEY (`id`), + UNIQUE KEY `name_uniq_key_event_target_class` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +; diff --git a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql index a8a8c62..d17561a 100644 --- a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql +++ b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql @@ -1,32 +1,34 @@ -# 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. +/* + * 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. + */ CREATE TABLE IF NOT EXISTS `event_connection` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `account_id` varchar(255) NOT NULL COMMENT 'event_connection account id', `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称', - `authorization_type` varchar(128) DEFAULT NULL COMMENT '授权类型', - `auth_parameters` text DEFAULT NULL COMMENT '', + `authorization_type` varchar(128) NULL DEFAULT '' COMMENT '授权类型', + `auth_parameters` text NULL DEFAULT NULL COMMENT '', `network_type` varchar(128) NOT NULL DEFAULT '' COMMENT '网络类型', `network_parameters` text DEFAULT NULL COMMENT '网络配置', `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_connection', `gmt_create` datetime DEFAULT NULL COMMENT 'create time', `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event connection meta' + UNIQUE KEY `name_uniq_key_event_connection` (`name`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; @@ -42,6 +44,6 @@ CREATE TABLE IF NOT EXISTS `event_api_destination` ( `gmt_create` datetime DEFAULT NULL COMMENT 'create time', `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time', PRIMARY KEY (`id`), - UNIQUE KEY `name_uniq_key` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event api destination meta' -; \ No newline at end of file + UNIQUE KEY `name_uniq_key_event_api_destination` (`name`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 +; diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql index 6c872c9..b2a18c2 100644 --- a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql +++ b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql @@ -1,17 +1,19 @@ -# 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. +/* + * 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 `event_target_class` -CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ; \ No newline at end of file +CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ; diff --git a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql index 7bc4cfc..1ad499a 100644 --- a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql +++ b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql @@ -1,16 +1,18 @@ -# 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. +/* + * 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. + */ -INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...] \ No newline at end of file +INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...] diff --git a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql index 31291a1..1d8a643 100644 --- a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql +++ b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql @@ -1,17 +1,19 @@ -# 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. +/* + * 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. + */ INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES diff --git a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql index 9a38fe6..b7587a0 100644 --- a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql +++ b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql @@ -1,18 +1,20 @@ -# 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. +/* + * 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. + */ INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES -('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...] \ No newline at end of file +('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...] diff --git a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql index 82be349..e98bbf0 100644 --- a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql +++ b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql @@ -1,18 +1,19 @@ -# 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. +/* + * 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 `event_connection` -MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`, -MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`; \ No newline at end of file +--ALTER TABLE `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`; +--ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`; \ No newline at end of file diff --git a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql index f25bfb0..2e9098e 100644 --- a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql +++ b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql @@ -1,22 +1,22 @@ -# 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. +/* + * 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 `event_connection` -DROP INDEX `name_uniq_key`, -ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE; +ALTER TABLE `event_connection` DROP INDEX `name_uniq_key_event_connection`; +ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE; -ALTER TABLE `event_api_destination` -DROP INDEX `name_uniq_key`, -ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE; \ No newline at end of file +ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`; +ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE; \ No newline at end of file diff --git a/docs/cn/RocketMQEventBridgeDatabaseUsage.md b/docs/cn/RocketMQEventBridgeDatabaseUsage.md index 99e7bf8..d5b159f 100644 --- a/docs/cn/RocketMQEventBridgeDatabaseUsage.md +++ b/docs/cn/RocketMQEventBridgeDatabaseUsage.md @@ -7,16 +7,18 @@ RocketMQ EventBridge 使用数据库存储运行过程中定义的规则 * 内置数据库h2,主要方便进行本地测试和快速开始 * mysql数据库,实际生产部署时可以使用 -### 内置数据库 +### 内置数据库H2 +#### H2介绍 +H2是一个使用Java实现的内存数据库,支持标准的SQL语法,支持大部分的MySQL语法和函数 + ```properties # 是否开启本地页面访问 spring.profiles.active=local -# h2 sql migration所在目录 -spring.flyway.locations=classpath:db/h2-migration ``` -本地运行后,访问h2数据库。访问url: localhost:8083: +本地运行后,访问h2数据库。访问url: localhost:8083,用户名/密码: sa/sa:  + ### mysql数据库 ```properties ## database @@ -24,6 +26,4 @@ spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/eventBridge?useUni spring.datasource.hikari.driver-class-name=com.mysql.jdbc.Driver spring.datasource.hikari.username=xxxxx spring.datasource.hikari.password=xxxxx -# 注释h2使用的sql migration -#spring.flyway.locations=classpath:db/h2-migration ``` \ No newline at end of file diff --git a/start/src/main/resources/application.properties b/start/src/main/resources/application.properties index 62daed6..3736814 100644 --- a/start/src/main/resources/application.properties +++ b/start/src/main/resources/application.properties @@ -25,7 +25,6 @@ spring.profiles.active=local mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl ## flyway spring.flyway.placeholderReplacement=false -spring.flyway.locations=classpath:db/h2-migration ## rocketmq rocketmq.namesrvAddr=localhost:9876 rocketmq.connect.endpoint=http://127.0.0.1:8082
