diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 5c49eb7e9c88346b8423a611dc14aca2e85cf346..f9a4145fdf1a70e7be1ede3649261757a12d2c65 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster +FROM debian:bookworm RUN apt-get update \ && \ apt-get install -y \ @@ -11,4 +11,8 @@ RUN apt-get update \ python3-sqlparse \ python3-sphinx \ doxygen -RUN pip3 install breathe sphinx-rtd-theme recommonmark +RUN pip3 install --break-system-packages \ + breathe \ + sphinx-rtd-theme \ + pytest \ + recommonmark diff --git a/.gitignore b/.gitignore index 26060c8b9c3986ed5a0803bcf1e1e2a88acee1a3..6f952db9ec3600b624a0151d97db6d299cbd53ca 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ libs/* # Generated files _doxygen/ _generated/ -/build/ \ No newline at end of file +/build/ +*~ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3878ddb5d95b9319fc6c44481efe9a63d284da41..310aad61e9ec2a7f69d9fafbf816e91ce81c02da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,11 @@ # -# This file is a part of the CaosDB Project. +# This file is a part of the LinkAhead Project. # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen +# Copyright (C) 2024 Indiscale GmbH <info@indiscale.com> # Copyright (C) 2019 Henrik tom Wörden +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -57,11 +59,17 @@ unittests-mariadb: tags: [ docker ] stage: test services: - - mariadb:10.4 - + - mariadb:10.11 script: - make pipeline-test SQL_HOST=mariadb +# Run the dump update tests +test-dump-update: + tags: [ docker ] + stage: test + script: + - make test-dump-update + # Run the unit tests with MySQL 5 unittests-mysql-5: tags: [ docker ] @@ -78,6 +86,7 @@ unittests-mysql-5: - sed -i "/col_default_is.*NULL/d" tests/test_autotap.sql - sed -i "/col_default_is.*INACTIVE/d" tests/test_autotap.sql - sed -i "/col_default_is.*SHA/d" tests/test_autotap.sql + - sed -i "s/utf8mb3/utf8/" tests/test_autotap.sql - make pipeline-test SQL_HOST=mysql ######## Deploy ######## diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e60d21354ab01b1c47ac9fcdff90af44686c30e..9b8478fd5e4a9f5b991c4e9a01a3ec2bf5abadc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [8.0.0] - 2024-10-24 ## + +### Added ### + +- Script to update outdated database dumps. + +### Changed ### + +- `OFFSET` is a reserved keyword in MariaDB 10.6, so the former + `OFFSET` parameter name in the `get_head_relative` function was + changed to HeadOffset. See + [`update_dumps/README.md`](update_dumps/README.md) for information + on how to update old SQL dumps to be compatible with this renaming + and MariaDB >= 10.6. + ## [7.0.2] - 2023-12-12 ## (Timm Fitschen) diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000000000000000000000000000000000000..3d997f969ded2b5b3b8f9975835e51be7e86b30a --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,28 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: + - family-names: Fitschen + given-names: Timm + orcid: https://orcid.org/0000-0002-4022-432X + - family-names: Schlemmer + given-names: Alexander + orcid: https://orcid.org/0000-0003-4124-9649 + - family-names: Hornung + given-names: Daniel + orcid: https://orcid.org/0000-0002-7846-6375 + - family-names: tom Wörden + given-names: Henrik + orcid: https://orcid.org/0000-0002-5549-578X + - family-names: Spreckelsen + given-names: Florian + orcid: https://orcid.org/0000-0002-6856-2910 + - family-names: Parlitz + given-names: Ulrich + orcid: https://orcid.org/0000-0003-3058-1435 + - family-names: Luther + given-names: Stefan + orcid: https://orcid.org/0000-0001-7214-8125 +title: "LinkAhead - MariaDB Backend" +version: 8.0.0 +doi: 10.3390/data4020083 +date-released: 2024-10-10 diff --git a/Makefile b/Makefile index 7c1ec3effb5cea166649aedcba188d6974d2cb6f..0204e012088c322ade92e529ebabe1b27fe3a469 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ +# This file is a part of the Linkahead Project. # -# ** header v3.0 -# This file is a part of the CaosDB Project. -# +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> +# Copyright (C) 2024 IndiScale GmbH <info@indiscale.com> # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen # @@ -18,8 +18,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # -# ** end header -# + SHELL=/bin/bash INSTALL_SQL_FILE=db_5_0.sql @@ -56,23 +55,26 @@ drop-%: test: ./utils/make_db test --fresh -# Run tests with a database which is started in a Docker container +.PHONY: test-dump-update +test-dump-update: + pytest dump_updates + +# Run tests with a database which is started in a MariaDB Docker container .PHONY: test-docker test-docker: @docker kill caosdb-mysqlserver-test || true - @docker container rm caosdb-mysqlserver-test || true + @docker container rm -v caosdb-mysqlserver-test || true @docker run --name caosdb-mysqlserver-test -p "3306:3306" \ - -e MYSQL_ROOT_PASSWORD="pass-for-test" -d mariadb + -e MYSQL_ROOT_PASSWORD="pass-for-test" -d mariadb:10.11 @sleep 10 MAINPATH=$(realpath tests/docker_env) utils/make_db test --fresh - @docker kill caosdb-mysqlserver-test - @docker container rm caosdb-mysqlserver-test + make test-docker-stop # if automatic stopping failed .PHONY: test-docker-stop test-docker-stop: docker kill caosdb-mysqlserver-test - docker container rm caosdb-mysqlserver-test + docker container rm -v caosdb-mysqlserver-test # Compile the standalone documentation .PHONY: doc diff --git a/README_SETUP.md b/README_SETUP.md index 581cc31411a6b6e510f10414c21ce6304697cb85..4e599ac3f3d019908143038e9415bef9fbcab1c5 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -114,6 +114,13 @@ obviously what was expected. Please look carefully through the tests. If something more serious than that comes up, please report a bug. +#### Failure to restore a database dump created with an older MariaDB version #### + +Have a look into the `dump_updates/README.md`. In cases of version +incompatibilities, the necessary steps to migrate the dump are +probably described there and scripts for the migrations are provided +in the same directory. + ## Documentation # Build documentation in `build/` with `make doc`. diff --git a/RELEASE_GUIDELINES.md b/RELEASE_GUIDELINES.md index 3497909d850c646a220c36188b3760df5d659f3b..c1d73359114379b74baf19e2bdf35e74be11077f 100644 --- a/RELEASE_GUIDELINES.md +++ b/RELEASE_GUIDELINES.md @@ -6,7 +6,8 @@ guidelines of the CaosDB Project ## General Prerequisites -* All tests are passing. +* All tests are passing. (Note that pipelines may fail if the major + version increased. Rely on manual tests in that case.) * (FEATURES.md is up-to-date and a public API is being declared in that document.) * CHANGELOG.md is up-to-date. * (DEPENDENCIES.md is up-to-date.) @@ -22,7 +23,7 @@ guidelines of the CaosDB Project 3. Assure that the latest patch actually updates the CaosDBVersion() procedure and that the version matches the version you are about to release. -4. Update version in `doc/conf.py`. +4. Update version in `doc/conf.py` and in `CITATION.cff`. 5. Merge the release branch into the main branch. @@ -36,3 +37,6 @@ guidelines of the CaosDB Project section to the CHANGELOG. 10. Create a release at the [gitlab repo](https://gitlab.com/linkahead/linkahead-mariadbbackend/-/releases) + +11. If necessary, i.e., if the patch or major versions were increased + with the release, do a LinkAhead server release. diff --git a/config.defaults b/config.defaults index 1860377976c3bf0d9f389570dc0e981f47aa1609..d44a9f43fbedb1e7f3274825fb4cde99183cfff6 100644 --- a/config.defaults +++ b/config.defaults @@ -1,7 +1,7 @@ +# This file is a part of the LinkAhead Project. # -# ** header v2.0 -# This file is a part of the CaosDB Project. -# +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> +# Copyright (C) 2024 IndiScale GmbH <info@indiscale.com> # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen # @@ -15,11 +15,9 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # -# ** end header -# # # Commands # The MySQL client program. diff --git a/doc/conf.py b/doc/conf.py index 5fdc05d730471fc610d2b3c5971ced9cfc14f192..d7968a2638e7131c9eba66fa69931e345f05b70e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -22,13 +22,13 @@ import sphinx_rtd_theme # -- Project information ----------------------------------------------------- project = 'caosdb-mysqlbackend' -copyright = '2021, IndiScale GmbH' +copyright = '2021 - 2024, IndiScale GmbH' author = 'Daniel Hornung' # The short X.Y version -version = '7.0.2' +version = '8.0.0' # The full version, including alpha/beta/rc tags -release = '7.0.2' +release = '8.0.0' # -- General configuration --------------------------------------------------- diff --git a/doc/index.rst b/doc/index.rst index 3924201bb5ab51ac7e1517f4eb1de95968dcb7b8..eac53ba65a937e1d57664af6a22780b262e35492 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -10,7 +10,9 @@ Welcome to documentation of CaosDB's MySQL Backend! Getting started <README_SETUP> Concepts <concepts> Maintenance - API documentation<functions> + API documentation <functions> + Related Projects <related_projects/index> + Back to Overview <https://docs.indiscale.com/> This documentation helps you to :doc:`get started<README_SETUP>`, explains the most important :doc:`concepts<concepts>` . diff --git a/doc/related_projects/index.rst b/doc/related_projects/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..78abfd939a097245042a8487eee8ae0d6b4d9e44 --- /dev/null +++ b/doc/related_projects/index.rst @@ -0,0 +1,25 @@ +Related Projects +++++++++++++++++ + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + :hidden: + +.. container:: projects + + For in-depth documentation for users, administrators and developers, you may want to visit the subproject-specific documentation pages for: + + :`Server <https://docs.indiscale.com/caosdb-server>`_: The Java part of the LinkAhead server. + + :`WebUI <https://docs.indiscale.com/caosdb-webui>`_: The default web frontend for the LinkAhead server. + + :`PyLinkAhead <https://docs.indiscale.com/caosdb-pylib>`_: The LinkAhead Python library. + + :`Advanced user tools <https://docs.indiscale.com/caosdb-advanced-user-tools>`_: The advanced Python tools for LinkAhead. + + :`LinkAhead Crawler <https://docs.indiscale.com/caosdb-crawler/>`_: The crawler is the main tool for automatic data integration in LinkAhead. + + :`LinkAhead <https://docs.indiscale.com/caosdb-deploy>`_: Your all inclusive LinkAhead software package. + + :`Back to Overview <https://docs.indiscale.com/>`_: LinkAhead Documentation. diff --git a/dump_updates/2024-10-02.dump_fix_mariadb_10_6.sh b/dump_updates/2024-10-02.dump_fix_mariadb_10_6.sh new file mode 100755 index 0000000000000000000000000000000000000000..4450b831f47d1ba8787b87708b6b8e2ec3be6e8d --- /dev/null +++ b/dump_updates/2024-10-02.dump_fix_mariadb_10_6.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# This file is a part of the LinkAhead Project. +# +# Copyright (C) 2024 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# About this script +# ================= +# +# Fix the use of "offset" as a procedure parameter name. "OFFSET" became a reserved keyword in +# MariaDB 10.6. +# +# This script takes an SQL dump from stdin and prints the fixed SQL to stdout. +# +# Usage +# ----- +# +# 2024-10-02.dump_fix_mariadb_10_6.sh < yourdump.sql > yourdump.fixed.sql + +set -euo pipefail +IFS=$'\n\t' + +script=' +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" + +unset script diff --git a/dump_updates/README.md b/dump_updates/README.md new file mode 100644 index 0000000000000000000000000000000000000000..704ea80321a9a873185d0c6959e2000ad26fa10d --- /dev/null +++ b/dump_updates/README.md @@ -0,0 +1,21 @@ +# SQL dump updates # + +## Dump ## + +This directory contains scripts to update database dumps to newer versions of the MariaDB server. + +## Background ## + +In some cases, restoring the database content from existing SQL dumps may not be possible in a +straightforward manner. For those cases, this directory contains scripts to help with known issues. + +Examples for problems include: + +- New reserved keywords in MariaDB, that were previously used as identifiers in code. + +# Known issues and their fix # + +- SQL syntax error near `Offset INT UNSIGNED`: If a dump was made before MariaDB 10.6 (LinkAhead < + 0.15) and with the SQL backend before 7.0.3, there was a pramater named `Offset`. With MariaDB + 10.6 however, `OFFSET` became a reserved keyword. This can be fixed by running + `2024-10-02.dump_fix_mariadb_10_6.sh < yourdump.sql > yourdump.fixed.sql` diff --git a/dump_updates/test/test_all.py b/dump_updates/test/test_all.py new file mode 100644 index 0000000000000000000000000000000000000000..8e97d2a1cea461dc0f5613a5ea94eeac663d5b3c --- /dev/null +++ b/dump_updates/test/test_all.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + +# This file is a part of the LinkAhead Project. +# +# Copyright (C) 2024 IndiScale GmbH <www.indiscale.com> +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +"""Testing the dump update scripts +""" + +import filecmp +from pathlib import Path +from subprocess import run +from tempfile import NamedTemporaryFile + + +def get_basedir() -> str: + """Return the assumped base dir for the dump updates. + """ + path = Path(__file__).parents[1] + return str(path) + + +def get_test_data(basename: str) -> list[tuple[str, str]]: + """Return a list of [input, expectedoutput] tuples. + + The output may be an empty string if no corresponding file can be found. + """ + basedir = get_basedir() + datadir = Path(basedir) / "test" / "test_data" + results = [] + for input_path in datadir.glob(f"{basename}.example*[0-9].sql"): + expected_path = datadir / f"{input_path.name[:-4]}.expected.sql" + if expected_path.exists(): + expected = str(expected_path) + else: + expected = "" + results.append((str(input_path), expected)) + return results + + +def test_2024_10_02(tmpdir): + """``Offset`` became a reserved keyword in MariaDB 10.6. + """ + script = "2024-10-02.dump_fix_mariadb_10_6.sh" + script_fullname = str(Path(get_basedir()) / script) + test_data = get_test_data(script[:-3]) + for infile, expectedfile in test_data: + with (NamedTemporaryFile(dir=tmpdir, suffix=".sql", delete=True) as output, + open(infile, mode="rb") as infile_stream + ): + run([script_fullname], + stdin=infile_stream, + stdout=output, + check=True + ) + assert filecmp.cmp(output.name, expectedfile), "Output does not match expected output." diff --git a/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.expected.sql b/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.expected.sql new file mode 100644 index 0000000000000000000000000000000000000000..1a58223ba65827231ce658f1a655a68706bf8088 --- /dev/null +++ b/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.expected.sql @@ -0,0 +1,36 @@ +/* Just a short snippt with the problem */ + + +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `get_head_relative`(EntityID VARCHAR(255), + HeadOffset INT UNSIGNED) RETURNS varbinary(255) + READS SQL DATA +BEGIN + DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; + + SELECT internal_id INTO InternalEntityID FROM entity_ids WHERE id = EntityID; + + + + + + RETURN ( + SELECT e.version + FROM entity_version AS e + WHERE e.entity_id = InternalEntityID + ORDER BY e._iversion DESC + LIMIT 1 OFFSET HeadOffset + ); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 D */ diff --git a/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.sql b/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.sql new file mode 100644 index 0000000000000000000000000000000000000000..a5476af3268360476f2c1ef741cb25007e29ce5d --- /dev/null +++ b/dump_updates/test/test_data/2024-10-02.dump_fix_mariadb_10_6.example1.sql @@ -0,0 +1,36 @@ +/* Just a short snippt with the problem */ + + +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `get_head_relative`(EntityID VARCHAR(255), + Offset INT UNSIGNED) RETURNS varbinary(255) + READS SQL DATA +BEGIN + DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; + + SELECT internal_id INTO InternalEntityID FROM entity_ids WHERE id = EntityID; + + + + + + RETURN ( + SELECT e.version + FROM entity_version AS e + WHERE e.entity_id = InternalEntityID + ORDER BY e._iversion DESC + LIMIT 1 OFFSET Offset + ); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 D */ diff --git a/patches/applyPatches.sh b/patches/applyPatches.sh index 735dd3ea48a43d033b46dad1c7eb1700bda5c9b1..85bdad86d2fa80d0e304c2a1105ce6ded05257a4 100755 --- a/patches/applyPatches.sh +++ b/patches/applyPatches.sh @@ -47,4 +47,5 @@ do done cd ../ + $UTILSPATH/update_sql_procedures.sh diff --git a/patches/patch20241024-8.0.0/patch.sh b/patches/patch20241024-8.0.0/patch.sh new file mode 100755 index 0000000000000000000000000000000000000000..2573c95864518363088af121a705d87f786b07ca --- /dev/null +++ b/patches/patch20241024-8.0.0/patch.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# This file is a part of the LinkAhead Project. +# +# Copyright (C) 2024 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2024 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2024 Florian Spreckelsen <f.spreckelsen@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +# Update mysql schema to version v8.0.0 +# +# The patch is empty because the change has to be applied manually +# from ../../dump_updates/2024-10-02.dump_fix_mariadb_10_6.sh if necessary. + +NEW_VERSION="v8.0.0" +OLD_VERSION="v7.0.2" + +if [ -z "$UTILSPATH" ]; then + UTILSPATH="../utils" +fi + +. $UTILSPATH/patch_header.sh $* + +check_version $OLD_VERSION + +update_version $NEW_VERSION + +success diff --git a/procedures/entityVersioning.sql b/procedures/entityVersioning.sql index b474d0121130a1695d69616e1de4cc54468b5e64..a71c0c729f9fae5e710b8cfd8e37618e7615ff20 100644 --- a/procedures/entityVersioning.sql +++ b/procedures/entityVersioning.sql @@ -1,9 +1,9 @@ /* - * This file is a part of the CaosDB Project. + * This file is a part of the LinkAhead Project. * - * Copyright (C) 2020,2023 IndiScale GmbH <info@indiscale.com> + * Copyright (C) 2020-2024 IndiScale GmbH <info@indiscale.com> * Copyright (C) 2020,2023 Timm Fitschen <t.fitschen@indiscale.com> - * + * Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the @@ -283,7 +283,7 @@ DROP FUNCTION IF EXISTS db_5_0.get_head_relative // * ---------- * EntityID : VARCHAR(255) * The entity id. - * Offset : INT UNSIGNED + * HeadOffset : INT UNSIGNED * Distance in the sequence of primary parents of the entity. E.g. `0` is the * HEAD itself. `1` is the primary parent of the HEAD. `2` is the primary * parent of the primary parent of the HEAD, and so on. @@ -294,7 +294,7 @@ DROP FUNCTION IF EXISTS db_5_0.get_head_relative // */ CREATE FUNCTION db_5_0.get_head_relative( EntityID VARCHAR(255), - Offset INT UNSIGNED) + HeadOffset INT UNSIGNED) RETURNS VARBINARY(255) READS SQL DATA BEGIN @@ -311,7 +311,7 @@ BEGIN FROM entity_version AS e WHERE e.entity_id = InternalEntityID ORDER BY e._iversion DESC - LIMIT 1 OFFSET Offset + LIMIT 1 OFFSET HeadOffset ); END; // diff --git a/procedures/query/initEntity.sql b/procedures/query/initEntity.sql index d63c7773867cb9e5c29bdc4f95cbe866c3b426c4..5d1f978baabae19691bb84eb172bb06898ed61b9 100644 --- a/procedures/query/initEntity.sql +++ b/procedures/query/initEntity.sql @@ -80,9 +80,10 @@ initEntityLabel: BEGIN IF(versioned, '` (id, _iversion) SELECT eids.internal_id, _get_head_iversion(eids.internal_id) ', '` (id) SELECT eids.internal_id '), - 'FROM entity_ids AS eids WHERE eids.id=',eid,';'); + 'FROM entity_ids AS eids WHERE eids.id=?;'); + SET @query_param = eid; PREPARE initEntityStmt FROM @initEntityStmtStr; - EXECUTE initEntityStmt; + EXECUTE initEntityStmt USING @query_param; DEALLOCATE PREPARE initEntityStmt; END IF; diff --git a/tests/test_autotap.sql b/tests/test_autotap.sql index 6109dbe7d39dd62f21232e823fc639d71c5c8a6f..168758c1482d21345e025f3d3ca2e33a9e0c607c 100644 --- a/tests/test_autotap.sql +++ b/tests/test_autotap.sql @@ -38,7 +38,7 @@ SELECT tap.has_schema('_caosdb_schema_unit_tests',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','archive_isa',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','archive_isa','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','archive_isa','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','archive_isa','InnoDB',''); -- COLUMNS @@ -116,7 +116,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','archive_isa','archive_isa_i -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','collection_type',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','collection_type','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','collection_type','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','collection_type','InnoDB',''); -- COLUMNS @@ -155,8 +155,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','collection_type','collection' SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','collection_type','collection','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','collection_type','collection','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','collection_type','collection',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','collection_type','collection','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','collection_type','collection','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','collection_type','collection','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','collection_type','collection','utf8mb3_unicode_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','collection_type','`domain_id`,`entity_id`,`property_id`',''); @@ -208,7 +208,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','collection_type','collectio -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','data_type',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','data_type','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','data_type','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','data_type','InnoDB',''); -- COLUMNS @@ -300,7 +300,7 @@ SELECT tap.constraint_type_is('_caosdb_schema_unit_tests','data_type','datatype_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','date_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','date_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','date_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','date_data','InnoDB',''); -- COLUMNS @@ -348,8 +348,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','date_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','date_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','date_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','date_data','status','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','date_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','date_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','date_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','date_data','status','utf8mb3_unicode_ci',''); -- COLUMN date_data.pidx @@ -398,7 +398,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','date_data','date_ov_forkey_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','datetime_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','datetime_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','datetime_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','datetime_data','InnoDB',''); -- COLUMNS @@ -437,8 +437,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','datetime_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','datetime_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','datetime_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','datetime_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','datetime_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','datetime_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','datetime_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','datetime_data','status','utf8mb3_unicode_ci',''); -- COLUMN datetime_data.pidx @@ -505,7 +505,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','datetime_data','dat_propert -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','desc_overrides',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','desc_overrides','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','desc_overrides','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','desc_overrides','InnoDB',''); -- COLUMNS @@ -544,8 +544,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','desc_overrides','description' SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','desc_overrides','description','text',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','desc_overrides','description','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','desc_overrides','description','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','desc_overrides','description','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','desc_overrides','description','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','desc_overrides','description','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','desc_overrides','description','utf8mb3_unicode_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','desc_overrides','`desc_ov_dom_ent_idx`',''); @@ -590,7 +590,7 @@ SELECT tap.constraint_type_is('_caosdb_schema_unit_tests','desc_overrides','desc -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','double_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','double_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','double_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','double_data','InnoDB',''); -- COLUMNS @@ -638,8 +638,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','double_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','double_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','double_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','double_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','double_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','double_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','double_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','double_data','status','utf8mb3_unicode_ci',''); -- COLUMN double_data.pidx @@ -697,7 +697,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','double_data','dou_property_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','entities',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entities','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entities','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','entities','InnoDB',''); -- COLUMNS @@ -718,8 +718,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','entities','description',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','entities','description','text',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','entities','description','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','entities','description','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','entities','description','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','description','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','entities','description','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','description','utf8mb3_unicode_ci',''); -- COLUMN entities.role @@ -727,8 +727,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','entities','role',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','entities','role','enum(\'RECORDTYPE\',\'RECORD\',\'FILE\',\'_REPLACEMENT\',\'PROPERTY\',\'DATATYPE\',\'ROLE\',\'QUERYTEMPLATE\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','entities','role','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','entities','role',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','entities','role','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','role','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','entities','role','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','role','utf8mb3_unicode_ci',''); -- COLUMN entities.acl @@ -760,7 +760,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','entities','`id`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','entity_acl',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entity_acl','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entity_acl','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','entity_acl','InnoDB',''); -- COLUMNS @@ -807,7 +807,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','entity_acl','`id`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','enum_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','enum_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','enum_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','enum_data','InnoDB',''); -- COLUMNS @@ -855,8 +855,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','enum_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','enum_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','enum_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','enum_data','status','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','enum_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','enum_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','enum_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','enum_data','status','utf8mb3_unicode_ci',''); -- COLUMN enum_data.pidx @@ -905,7 +905,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','enum_data','enum_ov_forkey_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','files',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','files','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','files','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','files','InnoDB',''); -- COLUMNS @@ -926,8 +926,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','files','path',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','files','path','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','files','path','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','files','path',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','files','path','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','files','path','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','files','path','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','files','path','utf8mb3_unicode_ci',''); -- COLUMN files.size @@ -977,7 +977,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','files','`file_id`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','integer_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','integer_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','integer_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','integer_data','InnoDB',''); -- COLUMNS @@ -1025,8 +1025,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','integer_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','integer_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','integer_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','integer_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','integer_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','integer_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','integer_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','integer_data','status','utf8mb3_unicode_ci',''); -- COLUMN integer_data.pidx @@ -1084,7 +1084,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','integer_data','int_property -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','isa_cache',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','isa_cache','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','isa_cache','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','isa_cache','InnoDB',''); -- COLUMNS @@ -1114,8 +1114,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','isa_cache','rpath',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','isa_cache','rpath','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','isa_cache','rpath','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','isa_cache','rpath',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','isa_cache','rpath','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','isa_cache','rpath','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','isa_cache','rpath','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','isa_cache','rpath','utf8mb3_unicode_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','isa_cache','`PRIMARY`,`isa_cache_child_entity`,`isa_cache_parent_entity`',''); @@ -1145,7 +1145,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','isa_cache','`child`,`parent`,` -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','name_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','name_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','name_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','name_data','InnoDB',''); -- COLUMNS @@ -1184,8 +1184,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','name_data','value',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','name_data','value','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','name_data','value','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','name_data','value',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_data','value','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','value','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_data','value','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','value','utf8mb3_unicode_ci',''); -- COLUMN name_data.status @@ -1193,8 +1193,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','name_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','name_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','name_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','name_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','status','utf8mb3_unicode_ci',''); -- COLUMN name_data.pidx @@ -1266,7 +1266,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','name_data','name_data_prope -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','name_overrides',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','name_overrides','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','name_overrides','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','name_overrides','InnoDB',''); -- COLUMNS @@ -1305,8 +1305,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','name_overrides','name',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','name_overrides','name','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','name_overrides','name','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','name_overrides','name','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_overrides','name','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_overrides','name','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','name_overrides','name','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_overrides','name','utf8mb3_unicode_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','name_overrides','`name_ov_dom_ent_idx`',''); @@ -1351,7 +1351,7 @@ SELECT tap.constraint_type_is('_caosdb_schema_unit_tests','name_overrides','name -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','null_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','null_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','null_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','null_data','InnoDB',''); -- COLUMNS @@ -1390,8 +1390,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','null_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','null_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','null_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','null_data','status','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','null_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','null_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','null_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','null_data','status','utf8mb3_unicode_ci',''); -- COLUMN null_data.pidx @@ -1440,7 +1440,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','null_data','null_forkey_pro -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','passwd',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','passwd','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','passwd','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','passwd','InnoDB',''); -- COLUMNS @@ -1470,8 +1470,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','passwd','alg',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','passwd','alg','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','passwd','alg','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','passwd','alg','\'SHA-512\'',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','passwd','alg','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','passwd','alg','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','passwd','alg','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','passwd','alg','utf8mb3_unicode_ci',''); -- COLUMN passwd.it @@ -1505,7 +1505,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','passwd','`principal`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','permissions',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','permissions','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','permissions','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','permissions','InnoDB',''); -- COLUMNS @@ -1526,8 +1526,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','permissions','permissions','' SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','permissions','permissions','mediumtext',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','permissions','permissions','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','permissions','permissions',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','permissions','permissions','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','permissions','permissions','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','permissions','permissions','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','permissions','permissions','utf8mb3_unicode_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','permissions','`PRIMARY`,`perm_name_roles`',''); @@ -1550,7 +1550,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','permissions','`role`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','query_template_def',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','query_template_def','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','query_template_def','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','query_template_def','InnoDB',''); -- COLUMNS @@ -1571,8 +1571,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','query_template_def','definiti SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','query_template_def','definition','mediumtext',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','query_template_def','definition','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','query_template_def','definition',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','query_template_def','definition','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','query_template_def','definition','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','query_template_def','definition','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','query_template_def','definition','utf8mb3_unicode_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','query_template_def','`PRIMARY`,`query_template_def_ibfk_1`',''); @@ -1595,7 +1595,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','query_template_def','query_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','reference_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','reference_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','reference_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','reference_data','InnoDB',''); -- COLUMNS @@ -1643,8 +1643,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','reference_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','reference_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','reference_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','reference_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','reference_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','reference_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','reference_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','reference_data','status','utf8mb3_unicode_ci',''); -- COLUMN reference_data.pidx @@ -1722,7 +1722,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','reference_data','reference_ -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','roles',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','roles','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','roles','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','roles','InnoDB',''); -- COLUMNS @@ -1743,8 +1743,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','roles','description',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','roles','description','mediumtext',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','roles','description','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','roles','description','NULL',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','roles','description','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','roles','description','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','roles','description','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','roles','description','utf8mb3_unicode_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','roles','`PRIMARY`',''); @@ -1760,7 +1760,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','roles','`name`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','stats',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','stats','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','stats','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','stats','InnoDB',''); -- COLUMNS @@ -1772,8 +1772,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','stats','name',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','stats','name','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','stats','name','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','stats','name',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','stats','name','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','stats','name','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','stats','name','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','stats','name','utf8mb3_unicode_ci',''); -- COLUMN stats.value @@ -1798,7 +1798,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','stats','`name`',''); -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','text_data',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','text_data','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','text_data','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','text_data','InnoDB',''); -- COLUMNS @@ -1837,8 +1837,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','text_data','value',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','text_data','value','text',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','text_data','value','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','text_data','value',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','text_data','value','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','value','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','text_data','value','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','value','utf8mb3_unicode_ci',''); -- COLUMN text_data.status @@ -1846,8 +1846,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','text_data','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','text_data','status','enum(\'OBLIGATORY\',\'RECOMMENDED\',\'SUGGESTED\',\'FIX\',\'REPLACEMENT\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','text_data','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','text_data','status',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','text_data','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','text_data','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','status','utf8mb3_unicode_ci',''); -- COLUMN text_data.pidx @@ -1896,7 +1896,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','text_data','str_property_id -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','transaction_log',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','transaction_log','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','transaction_log','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','transaction_log','InnoDB',''); -- COLUMNS @@ -1908,8 +1908,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','transaction_log','transaction SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','transaction_log','transaction','varchar(255)',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','transaction_log','transaction','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','transaction_log','transaction',NULL,''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','transaction_log','transaction','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','transaction_log','transaction','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','transaction_log','transaction','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','transaction_log','transaction','utf8mb3_unicode_ci',''); -- COLUMN transaction_log.entity_id @@ -1970,7 +1970,7 @@ SELECT tap.is_indexed('_caosdb_schema_unit_tests','transaction_log','`entity_id` -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','units_lin_con',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','units_lin_con','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','units_lin_con','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','units_lin_con','InnoDB',''); -- COLUMNS @@ -2044,7 +2044,7 @@ SELECT tap.col_is_pk('_caosdb_schema_unit_tests','units_lin_con','`signature_fro -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','user_info',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','user_info','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','user_info','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','user_info','InnoDB',''); -- COLUMNS @@ -2083,8 +2083,8 @@ SELECT tap.has_column('_caosdb_schema_unit_tests','user_info','status',''); SELECT tap.col_column_type_is('_caosdb_schema_unit_tests','user_info','status','enum(\'ACTIVE\',\'INACTIVE\')',''); SELECT tap.col_extra_is('_caosdb_schema_unit_tests','user_info','status','',''); SELECT tap.col_default_is('_caosdb_schema_unit_tests','user_info','status','\'INACTIVE\'',''); -SELECT tap.col_charset_is('_caosdb_schema_unit_tests','user_info','status','utf8',''); -SELECT tap.col_collation_is('_caosdb_schema_unit_tests','user_info','status','utf8_unicode_ci',''); +SELECT tap.col_charset_is('_caosdb_schema_unit_tests','user_info','status','utf8mb3',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','user_info','status','utf8mb3_unicode_ci',''); -- COLUMN user_info.entity @@ -2125,7 +2125,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','user_info','subjects_ibfk_2 -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','user_roles',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','user_roles','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','user_roles','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','user_roles','InnoDB',''); -- COLUMNS @@ -2179,7 +2179,7 @@ SELECT tap.fk_on_update('_caosdb_schema_unit_tests','user_roles','user_roles_ibf -- *************************************************************** SELECT tap.has_table('_caosdb_schema_unit_tests','entity_version',''); -SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entity_version','utf8_unicode_ci',''); +SELECT tap.table_collation_is('_caosdb_schema_unit_tests','entity_version','utf8mb3_unicode_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','entity_version','InnoDB',''); -- COLUMNS diff --git a/utils/helpers.sh b/utils/helpers.sh index 86f7d5981c7497fe478bccb3f391932585934545..f335dfa179e26e0237149572168884b554ee5f91 100644 --- a/utils/helpers.sh +++ b/utils/helpers.sh @@ -1,10 +1,10 @@ -# This file is a part of the CaosDB Project. +# This file is a part of the LinkAhead Project. # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen -# Copyright (C) 2019, 2020 Daniel Hornung (d.hornung@indiscale.com) +# Copyright (C) 2019, 2020, 2024 Daniel Hornung (d.hornung@indiscale.com) # Copyright (C) 2020 Henrik tom Wörden -# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2020, 2024 IndiScale GmbH <info@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -52,10 +52,16 @@ function mysql_execute_file { fi } +# Return the arguments from `get_db_args_nodb` and additionally the database name as +# `--database=mydatabasename`. function get_db_args { echo "$(get_db_args_nodb) --database=$DATABASE_NAME" } +# Return arguments for user, password, host, port and additional options in MYSQL_OPTS. +# +# For example, the output may be: +# --user=myuser --password=mypassword --host=example.com --port=1234 --other --option function get_db_args_nodb { if [ -n "$MYSQL_USER" ]; then mysql_con_arguments="--user=$MYSQL_USER" diff --git a/utils/load_settings.sh b/utils/load_settings.sh index d25dce5b1bf3b7a16ee62c67143ad0cd4e080cf1..398fb9e59df9efc56b84ddd03ed6782eb180a6d7 100644 --- a/utils/load_settings.sh +++ b/utils/load_settings.sh @@ -1,10 +1,10 @@ -# This file is a part of the CaosDB Project. +# This file is a part of the Linkahead Project. # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen -# Copyright (C) 2019, 2020 Daniel Hornung (d.hornung@indiscale.com) +# Copyright (C) 2019, 2020, 2024 Daniel Hornung <d.hornung@indiscale.com> # Copyright (C) 2020 Henrik tom Wörden -# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2020, 2024 IndiScale GmbH <info@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -62,10 +62,12 @@ export MYSQL_CMD export MYSQLDUMP_CMD export MYSQLADMIN_CMD export MYSQL_CONFIG_EDITOR_CMD + export MYSQL_HOST export MYSQL_PORT export MYSQL_USER export MYSQL_OPTS + export DATABASE_NAME export DATABASE_USER export DATABASE_USER_PW diff --git a/utils/make_db b/utils/make_db index 35ed2d933ab3479f88556e08052b977bd2b0507c..c7f94fd2d57944758cb48f0aedb2ac2672ec16d3 100755 --- a/utils/make_db +++ b/utils/make_db @@ -1,10 +1,9 @@ #!/bin/bash -# ** header v3.0 -# This file is a part of the CaosDB Project. +# This file is a part of the LinkAhead Project. # -# Copyright (C) 2021 Indiscale GmbH <info@indiscale.com> -# Copyright (C) 2019, 2020, 2021 Daniel Hornung <d.hornung@indiscale.com> +# Copyright (C) 2021, 2024 Indiscale GmbH <info@indiscale.com> +# Copyright (C) 2019, 2020, 2021, 2024 Daniel Hornung <d.hornung@indiscale.com> # Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale.com> # Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com> # Copyright (C) 2020 IndiScale <info@indiscale.com> @@ -22,7 +21,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # -# ** end header # Although some sanity checks are performed, this script still allows lots of SQL injection # possibilities. diff --git a/utils/update_sql_procedures.sh b/utils/update_sql_procedures.sh index b9a9e7fe21d1f47b4d7d235ce1a7ac040a060cf3..2fe1febfc7d5bbe45a8bc68c630e13d1cef6707f 100755 --- a/utils/update_sql_procedures.sh +++ b/utils/update_sql_procedures.sh @@ -1,13 +1,12 @@ #!/bin/bash # -# ** header v3.0 -# This file is a part of the CaosDB Project. +# This file is a part of the LinkAhead Project. # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen -# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com> +# Copyright (C) 2020, 2024 Daniel Hornung <d.hornung@indiscale.com> # Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com> -# Copyright (C) 2020 IndiScale <info@indiscale.com> +# Copyright (C) 2020, 2024 IndiScale <info@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,8 +21,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # -# ** end header -# # Updates all SQL procedures @@ -37,7 +34,7 @@ fi source $UTILSPATH/load_settings.sh source $UTILSPATH/helpers.sh -echo -n "updating procedures ... " +echo "Updating procedures ... " temp_proc_sql=$(mktemp --suffix=.sql) sed -e "s/db_5_0/$DATABASE_NAME/g" procedures/*.sql procedures/query/*.sql \ > "$temp_proc_sql"