From 253cfa9284b8430886d0a98825a8967201a95600 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Mon, 20 Jan 2020 17:56:57 +0100 Subject: #946: Set default value in SQL clause. --- installer/opengnsys_import.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index 4ac296d1..0acfee8d 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -173,11 +173,12 @@ function updateSqlFile() mysql --defaults-extra-file=$MYCNF -D "$AUXCATALOG" -e \ "$(mysql --defaults-extra-file=$MYCNF -Nse " SELECT CASE WHEN DATA_TYPE LIKE '%int' THEN - CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT 0;') - WHEN DATA_TYPE LIKE '%char' THEN - CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT \'\';') - WHEN DATA_TYPE = 'text' THEN - CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'MODIFY', COLUMN_NAME, 'TEXT NOT NULL;') + CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT 0;') + WHEN DATA_TYPE LIKE '%char' THEN + CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT \'\';') + WHEN DATA_TYPE = 'text' THEN + CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'MODIFY', COLUMN_NAME, 'TEXT NOT NULL;') + ELSE '' END FROM information_schema.columns WHERE TABLE_SCHEMA='$AUXCATALOG' -- cgit v1.2.3-18-g5258