diff --git a/60a672d_to_f9fa376.sql b/60a672d_to_f9fa376.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/60a672d_to_f9fa376.sql @@ -0,0 +1 @@ + diff --git a/6700413_to_68cd9c5.sql b/6700413_to_68cd9c5.sql new file mode 100644 index 0000000..0b12a4f --- /dev/null +++ b/6700413_to_68cd9c5.sql @@ -0,0 +1,50 @@ +set check_function_bodies = off; + +CREATE OR REPLACE FUNCTION public.create_newtype_text(qualified_name text) + RETURNS void + LANGUAGE plpgsql +AS $function$ +begin + execute concat('create type ', qualified_name, ' as (str text);'); + execute concat( 'create function ' + , qualified_name || '_to_string(val ' || qualified_name || ')' + , E' returns text language sql as \'select (val.str);\';' + ); + execute concat( 'create function ' + , qualified_name || '_of_string(val text)' + , ' returns ' || qualified_name || E' language sql as \'select row(val);\';' + ); + execute concat( 'create cast ' + , ' (' || qualified_name || ' as text)' + , ' with function ' || qualified_name || E'_to_string(' || qualified_name || ')' + , ' as assignment;' + ); + execute concat( 'create cast ' + , ' (text as ' || qualified_name || ')' + , ' with function ' || qualified_name || E'_of_string(text)' + , ' as assignment;' + ); +end; +$function$ +; + +create cast (public.usr_tag as text) with function public.usr_tag_to_string(public.usr_tag) as assignment; +create cast (text as public.usr_tag) with function public.usr_tag_of_string(text) as assignment; + +create cast (public.usr_session_key as text) with function public.usr_session_key_to_string(public.usr_session_key) as assignment; +create cast (text as public.usr_session_key) with function public.usr_session_key_of_string(text) as assignment; + +create cast (public.grp_tag as text) with function public.grp_tag_to_string(public.grp_tag) as assignment; +create cast (text as public.grp_tag) with function public.grp_tag_of_string(text) as assignment; + +create cast (public.community_tag as text) with function public.community_tag_to_string(public.community_tag) as assignment; +create cast (text as public.community_tag) with function public.community_tag_of_string(text) as assignment; + +create cast (public.email as text) with function public.email_to_string(public.email) as assignment; +create cast (text as public.email) with function public.email_of_string(text) as assignment; + +create cast (public.hashed_text as text) with function public.hashed_text_to_string(public.hashed_text) as assignment; +create cast (text as public.hashed_text) with function public.hashed_text_of_string(text) as assignment; + +create cast (human_uuid.huid as text) with function human_uuid.huid_to_string(human_uuid.huid) as assignment; +create cast (text as human_uuid.huid) with function human_uuid.huid_of_string(text) as assignment; diff --git a/a30fe1d_to_6700413.sql b/a30fe1d_to_6700413.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/a30fe1d_to_6700413.sql @@ -0,0 +1 @@ + diff --git a/ensure_seeded.sql b/ensure_seeded.sql index 2934a84..df92767 100644 --- a/ensure_seeded.sql +++ b/ensure_seeded.sql @@ -35,6 +35,7 @@ begin ('/communities/', root, admins, 'w', 'w', 'r') , ('/users/', root, admins, 'w', 'w', 'w') , ('/groups/', root, admins, 'w', 'w', 'w') + on conflict do nothing ; end; $$; diff --git a/f9fa376_to_a30fe1d.sql b/f9fa376_to_a30fe1d.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/f9fa376_to_a30fe1d.sql @@ -0,0 +1 @@ +