Browse Source

[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-release
Kerwin 2 years ago committed by GitHub
parent
commit
98a8abee40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/mysql/dolphinscheduler_ddl.sql
  2. 11
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.3_schema/postgresql/dolphinscheduler_ddl.sql

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

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

Loading…
Cancel
Save