Skip to content

Commit

Permalink
Merge pull request #256 from technologiestiftung/staging
Browse files Browse the repository at this point in the history
Staging to main
  • Loading branch information
ff6347 authored May 13, 2024
2 parents ae50124 + 2435f58 commit 4b7ec85
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @ff6347
* @ff6347 @Jaszkowic
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 supabase/migrations/20240506083439_id_trigger_on_trees_pk.sql
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();


0 comments on commit 4b7ec85

Please sign in to comment.