[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
This commit is contained in:
parent
0691d6a887
commit
98a8abee40
|
|
@ -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)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue