X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=sql%2Fbase%2F00-infrastructure.sql;fp=sql%2Fbase%2F00-infrastructure.sql;h=e55fc365a534f89ab7b8c9da3eabe193151c1abd;hp=240a5080800b4668129aa384b82c722904f15af1;hb=74354a0ce8d6851fb384b087fc03db01a3d1a611;hpb=c1e8deba30264664ee6e779444939e58d8cf217a diff --git a/sql/base/00-infrastructure.sql b/sql/base/00-infrastructure.sql index 240a508..e55fc36 100644 --- a/sql/base/00-infrastructure.sql +++ b/sql/base/00-infrastructure.sql @@ -115,7 +115,7 @@ CREATE OR REPLACE FUNCTION migration_tools.create_linked_legacy_table_from (TEXT BEGIN create_sql := 'CREATE TABLE ' || migration_schema || '.' || parent_table || '_legacy ( '; FOR columns IN - SELECT table_schema, table_name, column_name, data_type + SELECT table_schema, table_name, column_name, data_type, numeric_precision, numeric_scale FROM information_schema.columns WHERE table_schema = migration_schema AND table_name = source_table LOOP @@ -127,6 +127,8 @@ CREATE OR REPLACE FUNCTION migration_tools.create_linked_legacy_table_from (TEXT create_sql := create_sql || columns.column_name || ' '; if columns.data_type = 'ARRAY' then create_sql := create_sql || 'TEXT[]'; + elsif columns.data_type = 'numeric' then + create_sql := create_sql || 'NUMERIC('||columns.numeric_precision||','||columns.numeric_scale||')'; else create_sql := create_sql || columns.data_type; end if;