-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSC-218: Syntax corrections to run migration scripts on postgresql DB. (
#13)
- Loading branch information
Showing
1 changed file
with
13 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
DROP FUNCTION IF EXISTS replicaIdentity; | ||
DROP FUNCTION IF EXISTS replicaIdentity(text[]); | ||
|
||
GO | ||
|
||
CREATE FUNCTION replicaIdentity(tables text []) RETURNS void AS $$ | ||
DECLARE m text; | ||
BEGIN | ||
FOREACH m IN ARRAY tables | ||
LOOP | ||
EXECUTE format($fmt$ | ||
ALTER TABLE %I REPLICA IDENTITY FULL; | ||
$fmt$, m); | ||
END LOOP; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
GO | ||
CREATE OR REPLACE FUNCTION replicaIdentity(tables text[]) RETURNS void AS $$ | ||
DECLARE | ||
m text; | ||
BEGIN | ||
FOREACH m IN ARRAY tables | ||
LOOP | ||
EXECUTE format($fmt$ | ||
ALTER TABLE %I REPLICA IDENTITY FULL; | ||
$fmt$, m); | ||
END LOOP; | ||
END; | ||
$$ LANGUAGE plpgsql; |