cli
cli copied to clipboard
CREATE DOMAIN not added to migration
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
As Media Type Handlers documents, a CREATE DOMAIN command is needed to return custom media types. However, supabase db diff does not add these commands to the generated migration, so pushing the migration to other systems will fail.
To Reproduce
Create a custom domain and a function returning it, for example:
create domain "text/plain" as text;
CREATE OR REPLACE FUNCTION echo_service(input text)
RETURNS "text/plain"
LANGUAGE plpgsql
AS $function$declare
begin
-- Echo input back as plain text
perform set_config('response.headers', '[{"Content-Type": "text/plain"}]', true);
return input;
end;$function$
;
Create a migration calling supabase db diff --local.
Expected behavior
Both the create domain and the CREATE OR REPLACE FUNCTION commands are added to the migration.
Actual behavior
Only the CREATE OR REPLACE FUNCTION command is added to the migration.
As a result, ERROR: 42704: type "text/plain" does not exist will be thrown if trying to apply the migration elsewhere.
System information
All/latest.