diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2020-01-20 17:56:57 +0100 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2020-01-20 17:56:57 +0100 |
commit | 253cfa9284b8430886d0a98825a8967201a95600 (patch) | |
tree | b331b80b390ffcf9fba9ca8ab3e9ea136cd175d6 | |
parent | b6d3c1d05f59910d67c65fcaa114c1c38c716af7 (diff) |
#946: Set default value in SQL clause.
-rwxr-xr-x | installer/opengnsys_import.sh | 11 |
1 files 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' |