Skip to content
Snippets Groups Projects
Commit 14649e1d authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-fix-dump-upgrade' into 'dev'

Dump fix script can be applied twice

See merge request !32
parents ba3d8e95 f3d56b51
Branches
Tags
1 merge request!32Dump fix script can be applied twice
Pipeline #60660 passed
......@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [SQL dump migration can now be applied twice](https://gitlab.indiscale.com/caosdb/src/caosdb-mysqlbackend/-/issues/60): Fixed an error in the regex.
### Security
## [8.0.0] - 2024-10-24 ##
......
......@@ -35,10 +35,10 @@ set -euo pipefail
IFS=$'\n\t'
script='
s/Offset INT UNSIGNED) RETURNS varbinary(255)/HeadOffset INT UNSIGNED) RETURNS varbinary(255)/
/^[[:blank:]]+Offset INT UNSIGNED/s/Offset INT UNSIGNED\) RETURNS varbinary\(255\)/HeadOffset INT UNSIGNED\) RETURNS varbinary(255)/
s/LIMIT 1 OFFSET Offset/LIMIT 1 OFFSET HeadOffset/
'
sed -e "$script"
sed -E -e "$script"
unset script
......@@ -19,6 +19,11 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""Testing the dump update scripts
As a general rule, dump updaters should be idempotent, so tests should run the update again after
the first checks are successlful.
TODO: Reduce the boilerplate for the tests.
"""
import filecmp
......@@ -68,3 +73,13 @@ def test_2024_10_02(tmpdir):
check=True
)
assert filecmp.cmp(output.name, expectedfile), "Output does not match expected output."
with (NamedTemporaryFile(dir=tmpdir, suffix=".sql", delete=True) as output2,
open(output.name, mode="rb") as infile_stream
):
run([script_fullname],
stdin=infile_stream,
stdout=output2,
check=True
)
assert filecmp.cmp(output2.name, expectedfile), (
"Run 2: Output does not match expected output.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment