17 lines
707 B
MySQL
17 lines
707 B
MySQL
|
-- Deploy camper:media_type to pg
|
||
|
-- requires: schema_camper
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
-- regular expression combining https://www.rfc-editor.org/rfc/rfc2045#section-5.1 and https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1
|
||
|
-- should be case insensitive, but in this application we only use lower case.
|
||
|
create domain media_type as text
|
||
|
check (value ~ '(application|audio|font|example|image|message|model|multipart|text|video|x-(?:[0-9A-Za-z!#$%&''*+.^_`|~-]+))/([0-9A-Za-z!#$%&''*+.^_`|~-]+)((?:[ \t]*;[ \t]*[0-9A-Za-z!#$%&''*+.^_`|~-]+=(?:[0-9A-Za-z!#$%&''*+.^_`|~-]+|"(?:[^"\\]|\.)*"))*)')
|
||
|
;
|
||
|
|
||
|
comment on domain media_type is 'Also known as MIME type. Always lower case.';
|
||
|
|
||
|
commit;
|