diff --git a/demos/linearlite/db/migrations-client/01-create_tables.sql b/demos/linearlite/db/migrations-client/01-create_tables.sql index d1f9e70e..3d8d08e0 100644 --- a/demos/linearlite/db/migrations-client/01-create_tables.sql +++ b/demos/linearlite/db/migrations-client/01-create_tables.sql @@ -138,6 +138,7 @@ BEGIN FOR col_name IN SELECT column_name FROM information_schema.columns WHERE table_name = TG_TABLE_NAME AND + table_schema = TG_TABLE_SCHEMA AND column_name NOT IN ('id', 'synced', 'modified_columns', 'backup', 'deleted', 'new', 'sent_to_server', 'search_vector') LOOP EXECUTE format('SELECT $1.%I', col_name) USING NEW INTO new_value; EXECUTE format('SELECT %I FROM %I WHERE id = $1', col_name, TG_TABLE_NAME) USING NEW.id INTO old_value; @@ -223,6 +224,7 @@ BEGIN FOR column_name IN SELECT columns.column_name FROM information_schema.columns WHERE columns.table_name = TG_TABLE_NAME + AND columns.table_schema = TG_TABLE_SCHEMA AND columns.column_name NOT IN ('id', 'synced', 'modified_columns', 'backup', 'deleted', 'new', 'sent_to_server', 'search_vector') LOOP IF column_name != ANY(OLD.modified_columns) THEN EXECUTE format('SELECT ($1).%I', column_name) USING NEW INTO new_value; @@ -240,6 +242,7 @@ BEGIN FOR column_name IN SELECT columns.column_name FROM information_schema.columns WHERE columns.table_name = TG_TABLE_NAME + AND columns.table_schema = TG_TABLE_SCHEMA AND columns.column_name NOT IN ('id', 'synced', 'modified_columns', 'backup', 'deleted', 'new', 'sent_to_server', 'search_vector') LOOP EXECUTE format('SELECT ($1).%I', column_name) USING NEW INTO new_value; EXECUTE format('SELECT ($1).%I', column_name) USING OLD INTO old_value;