Created
May 11, 2016 22:53
-
-
Save ethanbustad/317b32bd52c24a4810808486691897ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. | |
* | |
* This library is free software; you can redistribute it and/or modify it under | |
* the terms of the GNU Lesser General Public License as published by the Free | |
* Software Foundation; either version 2.1 of the License, or (at your option) | |
* any later version. | |
* | |
* This library is distributed in the hope that it will be useful, but WITHOUT | |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
* details. | |
*/ | |
package com.liferay.testray.hook.upgrade.v0_0_0; | |
import com.liferay.compat.portal.kernel.upgrade.UpgradeProcess; | |
/** | |
* @author Ethan | |
*/ | |
public class UpgradeThing extends UpgradeProcess { | |
@Override | |
protected void doUpgrade() throws Exception { | |
if (!hasTable("Thing")) { | |
return; | |
} | |
// this is too many lines -- use sb | |
runSQL( | |
"update Thing set blah = " + | |
"replace(data_, 'comments', 'errors') where " + | |
"buildNamespace = 'Testray' and buildNumber = 13 " + | |
"and some other query"); | |
// this is fine | |
runSQL( | |
"update ServiceComponent set data_ = " + | |
"replace(data_, 'defects', 'issues') where " + | |
"buildNamespace = 'Testray' and buildNumber = 13"); | |
// this is fine | |
runSQL( | |
"update ServiceComponent set data_ = " + | |
"replace(data_, " + variable + ", 'issues') where " + | |
"buildNamespace = 'Testray' and buildNumber = 13"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment