build a volume column if it's missing
This commit is contained in:
parent
b17c37788e
commit
4f9667b553
@ -40,6 +40,21 @@ BEGIN
|
||||
EXECUTE format('%s',f.pop);
|
||||
EXECUTE format('%s',f.fk);
|
||||
END LOOP;
|
||||
-------add a units column if one doesn't exist--------------------------------
|
||||
IF (SELECT COUNT(*) FROM fc.target_meta WHERE appcol = 'units') = 0 THEN
|
||||
SELECT 'ALTER TABLE '||_target_table||' ADD COLUMN app_units numeric DEFAULT 0' INTO _sql;
|
||||
EXECUTE format('%s',_sql);
|
||||
--insert the newly created row meta into target_meta
|
||||
INSERT INTO
|
||||
fc.target_meta
|
||||
SELECT
|
||||
table_schema, table_name, column_name, ordinal_position, null::text, null::text, null::text, data_type, 'units', null::text
|
||||
FROM
|
||||
information_schema.columns
|
||||
WHERE
|
||||
format('%I',table_schema)||'.'||format('%I',table_name) = _target_table
|
||||
AND column_name = 'app_units';
|
||||
END IF;
|
||||
-------add a version column if one doesn't exist--------------------------------
|
||||
IF (SELECT COUNT(*) FROM fc.target_meta WHERE appcol = 'version') = 0 THEN
|
||||
SELECT 'ALTER TABLE '||_target_table||' ADD COLUMN app_version text' INTO _sql;
|
||||
|
Loading…
Reference in New Issue
Block a user