如何在liquibase中声明变量和mysql更新 [英] How to declare a variable and mysql update in liquibase

查看:317
本文介绍了如何在liquibase中声明变量和mysql更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在liquibase中编写以下sql代码

set @ value1 ="string1"; 设置@ value2 ="string2";

更新用户设置类别= REPLACE(类别,@ value1,@ value2);

如何在Liquibase中以xml或sql文件形式编写此代码?

解决方案

@value语法是MySQL SQL编辑器工具的一部分,数据库本身并未真正理解它,因此liquibase无法利用它们. >

Liquibase确实使用语法$ {value} changelog参数支持类似的功能

I want to write the following sql code in liquibase

set @value1 = "string1"; set @value2 = "string2";

update users set category = REPLACE(category, @value1, @value2);

How to write this in liquibase either in xml or in sql file?

解决方案

The @value syntax is part of the MySQL SQL editor tools and not actually understood by the database itself so liquibase is not able to take advantage of them.

Liquibase does support similar functionality with changelog paramaters using the syntax ${value}

这篇关于如何在liquibase中声明变量和mysql更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆