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

kerwin pushed a commit to branch 3.1.3-release
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/3.1.3-release by this push:
     new 98a8abee40 [3.1.3-release][SQL] Fix t_ds_fav table does not exist when 
rolling upgrade (#13337)
98a8abee40 is described below

commit 98a8abee4025e54af033831733dc2bfda0ea68f7
Author: Kerwin <[email protected]>
AuthorDate: Wed Jan 4 23:08:38 2023 +0800

    [3.1.3-release][SQL] Fix t_ds_fav table does not exist when rolling upgrade 
(#13337)
    
    * Fix t_ds_fav table does not exist when rolling upgrade
---
 .../3.1.3_schema/mysql/dolphinscheduler_ddl.sql    | 25 ++++++++++++++++++++++
 .../postgresql/dolphinscheduler_ddl.sql            | 11 +++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git 
a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/mysql/dolphinscheduler_ddl.sql
 
b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/mysql/dolphinscheduler_ddl.sql
index 4a14f326b9..7a00c76384 100644
--- 
a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/mysql/dolphinscheduler_ddl.sql
+++ 
b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/mysql/dolphinscheduler_ddl.sql
@@ -14,3 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 */
+
+DROP PROCEDURE IF EXISTS ut_dolphin_T_t_ds_fav;
+delimiter d//
+CREATE PROCEDURE ut_dolphin_T_t_ds_fav()
+BEGIN
+               IF EXISTS (SELECT 1 FROM information_schema.TABLES
+                       WHERE TABLE_NAME='t_ds_fav'
+                       AND TABLE_SCHEMA=(SELECT DATABASE()))
+               THEN
+ALTER TABLE t_ds_fav RENAME t_ds_fav_task;
+END IF;
+END;
+d//
+
+delimiter ;
+CALL ut_dolphin_T_t_ds_fav;
+DROP PROCEDURE ut_dolphin_T_t_ds_fav;
+
+CREATE TABLE IF NOT EXISTS t_ds_fav_task
+(
+    id        serial      NOT NULL,
+    task_name varchar(64) NOT NULL,
+    user_id   int         NOT NULL,
+    PRIMARY KEY (id)
+);
diff --git 
a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/postgresql/dolphinscheduler_ddl.sql
 
b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/postgresql/dolphinscheduler_ddl.sql
index 854454ae05..2bf7a120e6 100644
--- 
a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/postgresql/dolphinscheduler_ddl.sql
+++ 
b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/postgresql/dolphinscheduler_ddl.sql
@@ -14,4 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 */
-ALTER TABLE t_ds_fav RENAME TO t_ds_fav_task;
\ No newline at end of file
+
+ALTER TABLE IF EXISTS t_ds_fav RENAME TO t_ds_fav_task;
+
+CREATE TABLE IF NOT EXISTS t_ds_fav_task
+(
+    id        serial      NOT NULL,
+    task_name varchar(64) NOT NULL,
+    user_id   int         NOT NULL,
+    PRIMARY KEY (id)
+);

Reply via email to