From 996202a6bd656e4dbb8590c320efc9653fdfb6c8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 24 Aug 2021 17:56:29 +0200 Subject: [PATCH 1/2] if the old migration table is present selecting `fileName` will result in an SQL error --- backend/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 981731c67..6e51ed2f4 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -22,9 +22,10 @@ const DB_VERSION = '0001-init_db' async function main() { // check for correct database version const con = await connection() - const [rows] = await con.query(`SELECT fileName FROM migrations ORDER BY version DESC LIMIT 1;`) + const [rows] = await con.query(`SELECT * FROM migrations ORDER BY version DESC LIMIT 1;`) if ( (rows).length === 0 || + !(rows)[0].fileName || (rows)[0].fileName.indexOf(DB_VERSION) === -1 ) { throw new Error(`Wrong database version - the backend requires '${DB_VERSION}'`) From ed742095c27ea7923bd5c57b2d4ad6d2a57b5040 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 24 Aug 2021 18:01:22 +0200 Subject: [PATCH 2/2] when building in development environment the docker container contains the built files, but files are read from local harddrive where the build folder is not present. We mount a drive for the build folder in development mode. This happens since we always use the built variant of the database project since the table contains the filename - which then varies between js & ts --- docker-compose.override.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 078ac60c3..5eb808b99 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -58,6 +58,7 @@ services: # This makes sure the docker container has its own node modules. # Therefore it is possible to have a different node version on the host machine - database_node_modules:/app/node_modules + - database_build:/app/build # bind the local folder to the docker to allow live reload - ./database:/app @@ -149,4 +150,5 @@ volumes: frontend_node_modules: backend_node_modules: database_node_modules: + database_build: login_build_ubuntu_3.1: \ No newline at end of file