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/.docker/docker-compose.yml b/.docker/docker-compose.yml index 1a63292b080f182821935cb5b20b7500bfcf8f63..8c6555eb457a992f69625c55bfced34d9b1c51fd 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.6' services: sqldb: - image: mariadb:10.5 + image: mariadb:11.4 volumes: - type: volume source: "caosdb-sqldata" 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..561f671767b8d49ad33653f6f6a9ea82142628ca 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,28 +59,35 @@ unittests-mariadb: tags: [ docker ] stage: test services: - - mariadb:10.4 - + - mariadb:10.11 script: - make pipeline-test SQL_HOST=mariadb -# Run the unit tests with MySQL 5 -unittests-mysql-5: +# Run the dump update tests +test-dump-update: tags: [ docker ] stage: test - # Should not stop the pipeline from continuing. - allow_failure: true - services: - - name: mysql:5.7.36 - command: ["--default-authentication-plugin=mysql_native_password"] - script: - # remove some lines from autotap because the checks of column default - # values don't work with 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 - - make pipeline-test SQL_HOST=mysql + - make test-dump-update + +# # Run the unit tests with MySQL 5 +# unittests-mysql-5: +# tags: [ docker ] +# stage: test +# # Should not stop the pipeline from continuing. +# allow_failure: true +# services: +# - name: mysql:5.7.36 +# command: ["--default-authentication-plugin=mysql_native_password"] +# +# script: +# # remove some lines from autotap because the checks of column default +# # values don't work with 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 7d27a320296ed0c308a20a3b12fefda78f6d0e42..e102be5b7c21d102783e38b20f64a7473baa3c87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,19 +5,46 @@ 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). -## [Unreleased] ## +## [Unreleased] -### Added ### +### Added -### Changed ### +- New version requirement: MariaDB 11.2 or later. -### Deprecated ### +### Changed -### Removed ### +### Deprecated -### Fixed ### +### Removed + +- MySQL support. See the deprecation in the 7.0.0 release. + +### 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. +- [linkahead-server#264](https://gitlab.com/linkahead/linkahead-server/-/issues/264) + Queries ignore accents and umlauts: Changed to more appropriate + collation and character sets. This requires MariaDB 11.2 or later, + see above. + +### Security + +## [8.0.0] - 2024-10-24 ## + +### Added ### + +- Script to update outdated database dumps. + +### Changed ### -### Security ### +- `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) @@ -169,29 +196,29 @@ This is a major update. Switching from integer ids for internal and external use * `get_version_history` returns two additional columns, `child_username` and `child_realm`. * Added a `versioned` flag to the following procedures: - * `applyBackReference` - * `applyIDFilter` - * `applyPOV` - * `applyRefPOV` - * `makeStmt` - * `calcComplementUnion` - * `calcDifference` - * `calcIntersection` - * `finishSubProperty` - * `getChildren` - * `initEmptyTargetSet` - * `initDisjunctionFilter` - * `initEntity` - * `initQuery` - * `createTmpTable` + * `applyBackReference` + * `applyIDFilter` + * `applyPOV` + * `applyRefPOV` + * `makeStmt` + * `calcComplementUnion` + * `calcDifference` + * `calcIntersection` + * `finishSubProperty` + * `getChildren` + * `initEmptyTargetSet` + * `initDisjunctionFilter` + * `initEntity` + * `initQuery` + * `createTmpTable` * Added a `direct` column to `archive_isa` table ### Removed ### * unused procedures: - * `initNegationFilter` - * `initConjunctionFilter` - * `finishNegationFilter` + * `initNegationFilter` + * `initConjunctionFilter` + * `finishNegationFilter` ### Fixed ### @@ -228,20 +255,20 @@ This is a major update. Switching from integer ids for internal and external use with a lot of additions to the API. E.g. * New `entity_version`. * All `*_data` tables have a new twin, the `archive_*_data` table, where all - old versions of entities are stored. The `*_data` tables only contain the - data of the latest version. + old versions of entities are stored. The `*_data` tables only contain the + data of the latest version. * Additional `archive_isa` for the history entities' parents. * Additional `_iversion` column for the `reference_data` table for storing - references to particular versions of an entity. + references to particular versions of an entity. * New `setFileProperties` and `retrieveQueryTemplateDef` procedures which reduce server code and let the - backend decide which tables to use. Also, this is necessary for the - versioning, because these procedures behave differently depending on the - ENTITY_VERSIONING feature being enabled or disabled. + backend decide which tables to use. Also, this is necessary for the + versioning, because these procedures behave differently depending on the + ENTITY_VERSIONING feature being enabled or disabled. * Several functions and procedures for the interaction with the - `entity_version` table and the `transactions` table. E.g. - `insert_single_child_version`, `delete_all_entity_versions`, - `get_iversion`, `get_primary_parent_version`, `get_version_timestamp`, - `get_head_version`, `get_head_relative`, `get_version_history`. + `entity_version` table and the `transactions` table. E.g. + `insert_single_child_version`, `delete_all_entity_versions`, + `get_iversion`, `get_primary_parent_version`, `get_version_timestamp`, + `get_head_version`, `get_head_relative`, `get_version_history`. The versions are tracked internally by the `_iversion` field which is an integer and which should not be used outside of the backend. * New makefile targets for testing with MariaDB instance from Docker image: call 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..9bd45f71d56435c68eb953158d0af6d7a8ec8bca 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 run --name caosdb-mysqlserver-test -p "3306:3306" \ - -e MYSQL_ROOT_PASSWORD="pass-for-test" -d mariadb + @docker kill linkahead-mysqlserver-test || true + @docker container rm -v linkahead-mysqlserver-test || true + @docker run --name linkahead-mysqlserver-test -p "3306:3306" \ + -e MYSQL_ROOT_PASSWORD="pass-for-test" -d mariadb:11.4 @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 kill linkahead-mysqlserver-test + docker container rm -v linkahead-mysqlserver-test # Compile the standalone documentation .PHONY: doc diff --git a/README.md b/README.md index 7094464dae407a9eff280f2312a7b582f5f29a2b..6b3d3a7c412dfbdb6977b4cb8e7e70266fa2bf37 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Welcome -This is the **LinkAhead MySQL Backend** repository and a part of the +This is the **LinkAhead MariaDB Backend** repository and a part of the LinkAhead project. ## Setup @@ -43,7 +43,7 @@ Conduct](https://gitlab.com/linkahead/linkahead/-/blob/main/CODE_OF_CONDUCT.md). * Copyright (C) 2018 Research Group Biomedical Physics, Max Planck Institute for Dynamics and Self-Organization Göttingen. -* Copyright (C) 2020-2021 Indiscale GmbH <info@indiscale.com> +* Copyright (C) 2020-2025 Indiscale GmbH <info@indiscale.com> All files in this repository are licensed under a [GNU Affero General Public License](LICENCE.md) (version 3 or later). diff --git a/README_SETUP.md b/README_SETUP.md index 8362a163b7e665a27ef93c0ca8306b29d35aa632..80340225c252904e0cd753b2fea88f739b343e6c 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -1,8 +1,8 @@ -# Setup of the CaosDB SQL back end +# Setup of the LinkAhead MariaDB backend ## Dependencies -* `MariaDB Client 10.1` or later, `MySQL Client >=5.5, <=5.7.36`. +* `MariaDB Client 11.2` or later. * make ## Create the configuration @@ -11,7 +11,7 @@ parameter that you want to change, add a corresponding line in your `.config` file. You probably want to change the passwords. As the passwords are stored unencrypted in the `.config` file, make sure nobody else can read it. - * If there is no `mysql-config-editor` (`MySQL 5.5`. and `MariaDB`) then the + * If there is no `mysql-config-editor` program, then the `MYSQL_USER_PASSWORD` must be provided, that is the password of the `MYSQL_USER`. * If you are using MariaDB and the `root` database user uses pam @@ -99,20 +99,34 @@ After the first start, you need to install the database: `make install`. Then, you can connect to it with `mariadb --protocol=TCP -u caosdb -prandom1234 caosdb`. +### Developing tests ### + +To use the mytap framework: + +```console +$ cd libs; unzip mytap-1.0.zip; cd mytap-1.0 +# Use the necessary mariadb options for connecting to the server in the following commands +$ mariadb ... < mytap.sql # Set up the "tap" database and functions. +$ mariadb ... < scripts/autotap.sql # Insert the "autotap" function. +# Create autotap file (for comparison with current state) +$ mariadb ... --raw -B --skip-column-names -e "call tap.autotap('_caosdb_schema_unit_tests')" > test_autotap.current.sql +# Run the autotap tests (may fail unfortunately with current MariaDB): +$ mariadb ... < test_autotap.current.sql +``` ### Troubleshooting -#### MySQL has failing tests +#### Failure to restore a database dump created with an older MariaDB version #### -Our test suite is developed with MariaDB. That is why some tests, those which -check constraints based on auto-generated names, fail because MySQL generates -other names. +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. -Also some test fail with the message "Expected: NULL / Was: NULL" which is -obviously what was expected. +#### MySQL has failing tests -Please look carefully through the tests. If something more serious than that -comes up, please report a bug. +*Note: Since we switched from MySQL to MariaDB, the two DBMS projects have diverged quite far. As a +result, we no longer support MySQL. ## Documentation # diff --git a/RELEASE_GUIDELINES.md b/RELEASE_GUIDELINES.md index 3497909d850c646a220c36188b3760df5d659f3b..41c47136c1ab7160578950a384ce9c6ab2182b5b 100644 --- a/RELEASE_GUIDELINES.md +++ b/RELEASE_GUIDELINES.md @@ -1,4 +1,4 @@ -# Release Guidelines for the CaosDB MySQL Backend +# Release Guidelines for the LinkAhead MariaDB backend This document specifies release guidelines in addition to the general release guidelines of the CaosDB Project @@ -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/Maintenance.rst b/doc/Maintenance.rst index 39b2ad35996cd14acad3178f4eada24b1e2c1d21..b8bedee1146009a90a281398fe62d49e1da0351b 100644 --- a/doc/Maintenance.rst +++ b/doc/Maintenance.rst @@ -1,22 +1,19 @@ - Maintenance =========== - Creating a Backup ----------------- - You can use the Python script ``utils/backup.py`` to create a backup (SQL dump) of the SQL-Backend:: ./utils/backup.py -d folder/where/the/backup/is/created -You can do this while CaosDB is online. +You can do this while LinkAhead is online. Restoring a Backup ------------------ -CaosDB should be offline for restoring. +LinkAhead should be offline for restoring. You can use the Bash script ``utils/make_db`` to restore a backup (SQL dump) of the SQL-Backend:: diff --git a/doc/conf.py b/doc/conf.py index 5fdc05d730471fc610d2b3c5971ced9cfc14f192..b679a2b78588b390e4955556151b015a008e492e 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.1' # The full version, including alpha/beta/rc tags -release = '7.0.2' +release = '8.0.1-SNAPSHOT' # -- 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..8b9e4843c349a9281526953d6e0c40712a2b1c1a --- /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=' +/^[[: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 -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..acdeeeceb341c396c91b764e60bd8b30a7bcd19d --- /dev/null +++ b/dump_updates/test/test_all.py @@ -0,0 +1,85 @@ +#!/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 + +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 +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." + 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.") 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/patch20170316-2.0.27/patch.sh b/patches/patch20170316-2.0.27/patch.sh index ecb892e15bd62b673b3447ee7e0d12380b13118b..7a2d0a60f8228628f4c696d4d7a2819d0150bcc8 100755 --- a/patches/patch20170316-2.0.27/patch.sh +++ b/patches/patch20170316-2.0.27/patch.sh @@ -35,7 +35,12 @@ fi check_version $OLD_VERSION -mysql_execute 'DELETE FROM `entities` WHERE id=6; ALTER TABLE `entities` MODIFY COLUMN `role` ENUM("RECORDTYPE","RECORD","FILE","DOMAIN","PROPERTY","DATATYPE","ROLE","QUERYTEMPLATE") NOT NULL; INSERT INTO entities (id, name, description, role, acl) VALUES (8,"QUERYTEMPLATE","The QueryTemplate role.","ROLE",0); UPDATE `entities` SET role="ROLE" WHERE id<100 and name=role; CREATE TABLE `query_template_def` (id INT UNSIGNED PRIMARY KEY, definition MEDIUMTEXT NOT NULL, CONSTRAINT `query_template_def_ibfk_1` FOREIGN KEY (`id`) REFERENCES `entities` (`id`));' +mysql_execute ' +DELETE FROM `entities` WHERE id=6; +ALTER TABLE `entities` MODIFY COLUMN `role` ENUM("RECORDTYPE","RECORD","FILE","DOMAIN","PROPERTY","DATATYPE","ROLE","QUERYTEMPLATE") NOT NULL; +INSERT INTO entities (id, name, description, role, acl) VALUES (8,"QUERYTEMPLATE","The QueryTemplate role.","ROLE",0); +UPDATE `entities` SET role="ROLE" WHERE id<100 and name=role; +CREATE TABLE `query_template_def` (id INT UNSIGNED PRIMARY KEY, definition MEDIUMTEXT NOT NULL, CONSTRAINT `query_template_def_ibfk_1` FOREIGN KEY (`id`) REFERENCES `entities` (`id`));' update_version $NEW_VERSION 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/patches/patch20250130-8.1.0/patch.sh b/patches/patch20250130-8.1.0/patch.sh new file mode 100755 index 0000000000000000000000000000000000000000..5a092150f217c44d100a15735523ef74ea613a8b --- /dev/null +++ b/patches/patch20250130-8.1.0/patch.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# +# This file is a part of the Linkahead Project. +# +# Copyright (C) 2025 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2025 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/>. +# + +# Update mysql schema to version v8.1.0 +# +# Set the collation so that accents on characters become relevant. + +OLD_VERSION="v8.0.0" +NEW_VERSION="v8.1.0" + +if [ -z "$UTILSPATH" ]; then + UTILSPATH="../utils" +fi + +. $UTILSPATH/patch_header.sh $* + +check_version $OLD_VERSION + +# Update charsets and collations. + +# Change database default. +mysql_execute "ALTER DATABASE \`$DATABASE_NAME\` COLLATE = 'uca1400_as_ci';" + +# Some columns should be changed manually to prevent text length changes. +mysql_execute "ALTER TABLE desc_overrides MODIFY description TEXT CHARACTER SET utf8mb4;" +mysql_execute "ALTER TABLE entities MODIFY description TEXT CHARACTER SET utf8mb4;" +mysql_execute "ALTER TABLE permissions MODIFY permissions MEDIUMTEXT CHARACTER SET utf8mb4 NOT NULL;" +mysql_execute "ALTER TABLE query_template_def MODIFY definition MEDIUMTEXT CHARACTER SET utf8mb4 NOT NULL;" +mysql_execute "ALTER TABLE roles MODIFY description MEDIUMTEXT CHARACTER SET utf8mb4;" +mysql_execute "ALTER TABLE text_data MODIFY value TEXT CHARACTER SET utf8mb4 NOT NULL;" + +# Remove some constraints first. +mysql_execute 'ALTER TABLE user_info DROP FOREIGN KEY `subjects_ibfk_2`;' + +# Get all tables, drop first line, take first column +tables=$(mysql_execute "SHOW TABLE status where Collation='utf8mb3_unicode_ci';" -B | tail +2 | awk '{print $1}') +for table in $tables; do + mysql_execute "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE uca1400_as_ci;" +done + +# Add constraints again. +mysql_execute 'ALTER TABLE user_info MODIFY COLUMN `entity` VARCHAR(255) COLLATE utf8mb4_bin DEFAULT NULL;' +mysql_execute 'ALTER TABLE user_info ADD CONSTRAINT `subjects_ibfk_2` FOREIGN KEY (`entity`) REFERENCES `entity_ids` (`id`);' + +# Set custom collations for columns +mysql_execute "ALTER TABLE transaction_log MODIFY entity_id VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;" + + +### Finished ### + +update_version $NEW_VERSION + +success + + +##### Useful commands ##### + +# cd git/caosdb-mysqlbackend/ +# UTILSPATH=utils +# . utils/patch_header.sh + + +# show table status where Collation='utf8mb3_unicode_ci'; + +# name_data +# text_data + +# show table status like 'name_data'; +# select * from name_data where value like 'Yield%'; +# update name_data SET value='Yield-stréss' where entity_id=354; +# update name_data SET value='Yield-strés😋s' where entity_id=354; +# select * from name_data where value='Yield-stress'; + +# # Unicode 14.0.0 +# ALTER TABLE name_data CONVERT TO CHARACTER SET utf8mb4 COLLATE uca1400_as_ci; + +# FULL_COLLATION_NAME: utf8mb4_uca1400_as_ci; +# COLLATION_NAME: uca1400_as_ci; + +# mariadb -h sqldb -u caosdb -prandom1234 --default-character-set=utf8mb4 caosdb + 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..6d62a0ced953fddc7afe1ccc06d45ef339e8f47e 100644 --- a/tests/test_autotap.sql +++ b/tests/test_autotap.sql @@ -38,7 +38,11 @@ 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',''); +-- ******* +-- Collation testing of tables fails for uca1400 collations, see upstream issue: +-- https://github.com/hepabolu/mytap/issues/58 +-- ******* +-- SELECT tap.table_collation_is('_caosdb_schema_unit_tests','archive_isa','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','archive_isa','InnoDB',''); -- COLUMNS @@ -116,7 +120,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','collection_type','InnoDB',''); -- COLUMNS @@ -155,8 +159,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','collection_type','collection','utf8mb4_uca1400_as_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','collection_type','`domain_id`,`entity_id`,`property_id`',''); @@ -208,7 +212,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','data_type','InnoDB',''); -- COLUMNS @@ -300,7 +304,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','date_data','InnoDB',''); -- COLUMNS @@ -348,8 +352,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','date_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN date_data.pidx @@ -398,7 +402,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','datetime_data','InnoDB',''); -- COLUMNS @@ -437,8 +441,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','datetime_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN datetime_data.pidx @@ -505,7 +509,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','desc_overrides','InnoDB',''); -- COLUMNS @@ -544,8 +548,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','desc_overrides','description','utf8mb4_uca1400_as_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','desc_overrides','`desc_ov_dom_ent_idx`',''); @@ -590,7 +594,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','double_data','InnoDB',''); -- COLUMNS @@ -638,8 +642,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','double_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN double_data.pidx @@ -697,7 +701,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','entities','InnoDB',''); -- COLUMNS @@ -718,8 +722,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','description','utf8mb4_uca1400_as_ci',''); -- COLUMN entities.role @@ -727,8 +731,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entities','role','utf8mb4_uca1400_as_ci',''); -- COLUMN entities.acl @@ -760,7 +764,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','entity_acl','InnoDB',''); -- COLUMNS @@ -807,7 +811,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','enum_data','InnoDB',''); -- COLUMNS @@ -855,8 +859,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','enum_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN enum_data.pidx @@ -905,7 +909,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','files','InnoDB',''); -- COLUMNS @@ -926,8 +930,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','files','path','utf8mb4_uca1400_as_ci',''); -- COLUMN files.size @@ -977,7 +981,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','integer_data','InnoDB',''); -- COLUMNS @@ -1025,8 +1029,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','integer_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN integer_data.pidx @@ -1084,7 +1088,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','isa_cache','InnoDB',''); -- COLUMNS @@ -1114,8 +1118,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','isa_cache','rpath','utf8mb4_uca1400_as_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','isa_cache','`PRIMARY`,`isa_cache_child_entity`,`isa_cache_parent_entity`',''); @@ -1145,7 +1149,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','name_data','InnoDB',''); -- COLUMNS @@ -1184,8 +1188,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','value','utf8mb4_uca1400_as_ci',''); -- COLUMN name_data.status @@ -1193,8 +1197,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN name_data.pidx @@ -1266,7 +1270,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','name_overrides','InnoDB',''); -- COLUMNS @@ -1305,8 +1309,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','name_overrides','name','utf8mb4_uca1400_as_ci',''); -- INDEXES SELECT tap.indexes_are('_caosdb_schema_unit_tests','name_overrides','`name_ov_dom_ent_idx`',''); @@ -1351,7 +1355,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','null_data','InnoDB',''); -- COLUMNS @@ -1390,8 +1394,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','null_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN null_data.pidx @@ -1440,7 +1444,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','passwd','InnoDB',''); -- COLUMNS @@ -1470,8 +1474,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','passwd','alg','utf8mb4_uca1400_as_ci',''); -- COLUMN passwd.it @@ -1505,7 +1509,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','permissions','InnoDB',''); -- COLUMNS @@ -1526,8 +1530,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','permissions','permissions','utf8mb4_uca1400_as_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','permissions','`PRIMARY`,`perm_name_roles`',''); @@ -1550,7 +1554,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','query_template_def','InnoDB',''); -- COLUMNS @@ -1571,8 +1575,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','query_template_def','definition','utf8mb4_uca1400_as_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','query_template_def','`PRIMARY`,`query_template_def_ibfk_1`',''); @@ -1595,7 +1599,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','reference_data','InnoDB',''); -- COLUMNS @@ -1643,8 +1647,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','reference_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN reference_data.pidx @@ -1722,7 +1726,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','roles','InnoDB',''); -- COLUMNS @@ -1743,8 +1747,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','roles','description','utf8mb4_uca1400_as_ci',''); -- CONSTRAINTS SELECT tap.constraints_are('_caosdb_schema_unit_tests','roles','`PRIMARY`',''); @@ -1760,7 +1764,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','stats','InnoDB',''); -- COLUMNS @@ -1772,8 +1776,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','stats','name','utf8mb4_uca1400_as_ci',''); -- COLUMN stats.value @@ -1798,7 +1802,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','text_data','InnoDB',''); -- COLUMNS @@ -1837,8 +1841,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','value','utf8mb4_uca1400_as_ci',''); -- COLUMN text_data.status @@ -1846,8 +1850,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','text_data','status','utf8mb4_uca1400_as_ci',''); -- COLUMN text_data.pidx @@ -1896,7 +1900,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','transaction_log','InnoDB',''); -- COLUMNS @@ -1908,8 +1912,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','transaction_log','transaction','utf8mb4_uca1400_as_ci',''); -- COLUMN transaction_log.entity_id @@ -1970,7 +1974,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','units_lin_con','InnoDB',''); -- COLUMNS @@ -2044,7 +2048,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','user_info','InnoDB',''); -- COLUMNS @@ -2083,8 +2087,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','utf8mb4',''); +SELECT tap.col_collation_is('_caosdb_schema_unit_tests','user_info','status','utf8mb4_uca1400_as_ci',''); -- COLUMN user_info.entity @@ -2125,7 +2129,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','utf8mb4_uca1400_as_ci',''); SELECT tap.table_engine_is('_caosdb_schema_unit_tests','user_roles','InnoDB',''); -- COLUMNS @@ -2179,7 +2183,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','utf8mb4_uca1400_as_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..ff4b189bffeabf467e0725de9a4b62fe72cd6bf3 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 @@ -34,7 +34,7 @@ function mysql_execute { #TODO is it meaningful that here always the database user is used??? set -e - $MYSQL_CMD $(get_db_args) -e "$1" + $MYSQL_CMD $(get_db_args) -e "$@" ret=${PIPESTATUS[0]} if [ "$ret" -ne 0 ]; then failure "MYSQL ERROR" @@ -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/patch_header.sh b/utils/patch_header.sh index 33fbff879b3166596e153685105873adeae8405b..c7d25ae3f21ccbba30658182572177847d5610a7 100644 --- a/utils/patch_header.sh +++ b/utils/patch_header.sh @@ -1,12 +1,10 @@ -# -# ** 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) 2019, 2020 Daniel Hornung <d.hornung@indiscale.com> +# Copyright (C) 2019, 2020, 2025 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, 2025 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 @@ -21,12 +19,20 @@ # 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 -# ############################################################################### # header for patch scripts # ############################################################################### +# +# This file defines the following functions (see below for more detailed descriptions): +# +# - check_version_or_exit: Check if the stored version is as expected. +# - update_version: Set the stored version. +# - dump_table: Store table content into a file. +# - redo_table: Apply the table content stored by dump_table. +# +# This file also sets the `errexit` option (`set -e`). +# set -e @@ -63,7 +69,7 @@ configuration make file. Notable examples are: - DATABASE_USER_PW EOF - ) + ) function _print_help() { echo -e "$USAGE" @@ -115,21 +121,51 @@ done if [ -n "$PATCH" ]; then echo -ne "applying patch $PATCH to $DATABASE_NAME ... " fi -# @param $1: db version string, e.g. v2.0.0 -# @return: 0 on success, 1 on failure -function check_version { + +# usage: check_version_or_exit version +# +# Check if the version string is as expected. Otherwise, `exit 0`. +# +# Arguments +# --------- +# +# version: str +# The expected database version string, e.g. 'v2.0.0' +# +# Returns +# ------- +# +# 0 on success +function check_version_or_exit { local version=$($MYSQL_CMD $(get_db_args) -B -e "Select CaosDBVersion();") - if [[ "$(echo $version | sed 's/^CaosDBVersion()\s//')" = "$1" ]]; then + local version="$(echo $version | sed 's/^CaosDBVersion()\s//')" + if [[ "$version" = "$1" ]]; then return 0 fi uptodate } -# @param $1: new version string +# Deprecated name, call "check_version_or_exit" directly instead. +function check_version { + check_version_or_exit "$1" +} + +# usage: update_version version +# +# Set the version string. +# +# Arguments +# --------- +# +# version: str +# The new database version string, e.g. 'v2.0.0' function update_version { mysql_execute "DROP FUNCTION IF EXISTS CaosDBVersion; CREATE FUNCTION CaosDBVersion() RETURNS VARCHAR(255) DETERMINISTIC RETURN '$1';" } +# usage: dump_table table +# +# Dump the table given in the argument into file "caosdb.<table>.<OLD_VERSION>.dump.sql" function dump_table { if [[ -z $MYSQLDUMP_CMD ]]; then echo "Cannot find mysqldump program!" >&2 @@ -139,6 +175,9 @@ function dump_table { > ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql } +# usage: redo_table table +# +# Apply the dump from `dump_table` to the database. Takes the same argument. function redo_table { $MYSQL_CMD $(get_db_args) < ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql } diff --git a/utils/sanity_check.sql b/utils/sanity_check.sql index c29e7c8a82f238f5836e519159fa48d63933a609..5e3d580cc386feb44b5e97269ac384c050d6cf84 100644 --- a/utils/sanity_check.sql +++ b/utils/sanity_check.sql @@ -55,9 +55,29 @@ sanityCheckBody: BEGIN ("user_roles") ; -SELECT COUNT(WRONG) INTO @count_wrong FROM ( SELECT l.table_name AS MATCHED, r.table_name AS WRONG FROM expected_tables AS l RIGHT OUTER JOIN information_schema.tables AS r ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) WHERE r.table_schema = database()) AS temp WHERE temp.MATCHED IS NULL; +SELECT COUNT(WRONG) INTO @count_wrong FROM ( + SELECT l.table_name AS MATCHED, + r.table_name AS WRONG + FROM + expected_tables AS l + RIGHT OUTER JOIN + information_schema.tables AS r + ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) + WHERE r.table_schema = database() AND r.table_type != 'TEMPORARY' + ) + AS temp WHERE temp.MATCHED IS NULL; -SELECT COUNT(MISSING) INTO @count_missing FROM ( SELECT l.table_name AS MISSING, r.table_name AS MATCHED FROM expected_tables AS l LEFT OUTER JOIN information_schema.tables AS r ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) WHERE r.table_schema = database() OR r.table_schema IS NULL) AS temp WHERE temp.MATCHED IS NULL; +SELECT COUNT(MISSING) INTO @count_missing FROM ( + SELECT l.table_name AS MISSING, + r.table_name AS MATCHED + FROM + expected_tables AS l + LEFT OUTER JOIN + information_schema.tables AS r + ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) + WHERE r.table_schema = database() OR r.table_schema IS NULL + ) + AS temp WHERE temp.MATCHED IS NULL; IF @count_missing = 0 AND @count_wrong = 0 THEN LEAVE sanityCheckBody; @@ -66,12 +86,28 @@ END IF; SELECT "--------------"; SELECT @count_missing AS "Number of missing tables"; -SELECT MISSING AS "Missing tables" FROM ( SELECT l.table_name AS MISSING, r.table_name AS MATCHED FROM expected_tables AS l LEFT OUTER JOIN information_schema.tables AS r ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) WHERE r.table_schema = database() OR r.table_schema IS NULL) AS temp WHERE temp.MATCHED IS NULL; +SELECT MISSING AS "Missing tables" FROM ( + SELECT l.table_name AS MISSING, r.table_name AS MATCHED FROM + expected_tables AS l + LEFT OUTER JOIN + information_schema.tables AS r + ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) + WHERE r.table_schema = database() OR r.table_schema IS NULL + ) + AS temp WHERE temp.MATCHED IS NULL; SELECT "--------------"; SELECT @count_wrong AS "Number of tables which should not exist"; -SELECT WRONG AS "Tables which should not exist" FROM ( SELECT l.table_name AS MATCHED, r.table_name AS WRONG FROM expected_tables AS l RIGHT OUTER JOIN information_schema.tables AS r ON (r.table_name COLLATE utf8_unicode_ci = l.table_name) WHERE r.table_schema = database()) AS temp WHERE temp.MATCHED IS NULL; +SELECT WRONG AS "Tables which should not exist" FROM ( + SELECT expec.table_name AS MATCHED, info.table_name AS WRONG FROM + expected_tables AS expec + RIGHT OUTER JOIN + information_schema.tables AS info + ON (info.table_name COLLATE utf8_unicode_ci = expec.table_name) + WHERE info.table_schema = database() and info.table_type != 'TEMPORARY' + ) + AS temp WHERE temp.MATCHED IS NULL; SELECT "--------------"; SELECT "ERROR" from sanity_check_failed; 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"