-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from technologiestiftung/staging
Staging to main
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 +1 @@ | ||
* @ff6347 | ||
* @ff6347 @Jaszkowic |
4 changes: 4 additions & 0 deletions
4
supabase/migrations/20240502114721_unique_constraint_gml_id.sql
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE UNIQUE INDEX gml_id_unique ON public.trees USING btree (gml_id); | ||
|
||
alter table "public"."trees" add constraint "gml_id_unique" UNIQUE using index "gml_id_unique"; | ||
|
18 changes: 18 additions & 0 deletions
18
supabase/migrations/20240506083439_id_trigger_on_trees_pk.sql
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
set check_function_bodies = off; | ||
|
||
CREATE OR REPLACE FUNCTION public.uuid_insert_trigger() | ||
RETURNS trigger | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
BEGIN | ||
IF NEW.id IS NULL THEN | ||
NEW.id = uuid_generate_v4()::text; | ||
END IF; | ||
RETURN NEW; | ||
END; | ||
$function$ | ||
; | ||
|
||
CREATE TRIGGER insert_uuid BEFORE INSERT ON public.trees FOR EACH ROW EXECUTE FUNCTION uuid_insert_trigger(); | ||
|
||
|