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) +);