mascarpone/migrations/each_user/0014_birthday-format.sql

7 lines
324 B
SQL

update contacts
set birthday = substr(birthday, 3, 2) || '-' || substr(birthday, 5, 2)
where birthday GLOB '--[01][0-9][0-3][0-9]';
update contacts
set birthday = substr(birthday, 1, 4) || '-' || substr(birthday, 5, 2) || '-' || substr(birthday, 7, 2)
where birthday GLOB '[0-9][0-9][0-9][0-9][01][0-9][0-3][0-9]';