feat: sane date format
This commit is contained in:
parent
c12975926d
commit
4c710dcd20
4 changed files with 17 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
insert into contacts(id, birthday, manually_freshened_at) values
|
||||
(0, '--0415', '2000-01-01T12:00:00');
|
||||
(0, '04-15', '2000-01-01T12:00:00');
|
||||
insert into names(contact_id, sort, name) values
|
||||
(0, 0, 'Alex Aaronson'),
|
||||
(0, 1, 'Alexi'),
|
||||
|
|
@ -16,7 +16,7 @@ insert into groups(contact_id, name, slug) values
|
|||
(1, 'ABC', 'abc');
|
||||
|
||||
insert into contacts(id, birthday) values
|
||||
(2, '19951018');
|
||||
(2, '1995-10-18');
|
||||
insert into names(contact_id, sort, name) values
|
||||
(2, 0, 'Charlie Certaindate');
|
||||
insert into groups(contact_id, name, slug) values
|
||||
|
|
|
|||
7
migrations/each_user/0014_birthday-format.sql
Normal file
7
migrations/each_user/0014_birthday-format.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
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]';
|
||||
Loading…
Add table
Add a link
Reference in a new issue