sql

All things SQL and JDBC...
2020-04-04T18:07:54.142900Z

hey friends! is there a standard migration tool to use? i have come across ragtime and migratus. is one preferred to the other?

2020-04-04T18:20:05.143800Z

i like that maigratus has a lein plugin

2020-04-04T18:20:08.144100Z

so i think i will go with that for now

seancorfield 2020-04-04T18:20:30.144800Z

@tjb use the one that uses timestamp for migration name, not the increasing number

seancorfield 2020-04-04T18:20:53.145500Z

(On my phone -- can't remember which that is)

2020-04-04T18:20:55.145600Z

:thinking_face:

2020-04-04T18:21:18.146Z

let me triple check but i think migratus is the one

2020-04-04T18:21:37.146400Z

> You can include both SQL and code-based migrations in the same migrations directory, in which case they will be run intermixed in the order defined by their timestamps

2020-04-04T18:21:41.146600Z

yup thats the one!

2020-04-04T18:24:34.147Z

is there a terminal command to get a 14 digit timestamp?

2020-04-04T18:28:11.147200Z

gots it!

2020-04-04T18:28:19.147400Z

date --utc +%Y%m%d%H%M%S

seancorfield 2020-04-04T19:36:19.148Z

Doesn't migratus have a command/tool to generate new migration files with the appropriate name, including the timestamp?

dpsutton 2020-04-04T19:40:32.148600Z

Yeah there’s a function to make them. I’ve never made one by hand

2020-04-04T19:44:20.148800Z

😮!

2020-04-04T19:44:31.149200Z

i didnt know that! man do i suck at reading docs

2020-04-04T19:44:31.149300Z

haha

2020-04-04T22:34:11.149900Z

with jdbc.next is it not possible to use the % in queries like

2020-04-04T22:34:12.150200Z

(sql/query db ["SELECT * FROM item WHERE name LIKE %?%" query])

2020-04-04T22:51:13.150500Z

got it 😛

2020-04-04T22:51:15.150800Z

(sql/query db ["SELECT * 
                 FROM item 
                 WHERE LOWER(name) LIKE '%' || ? ||'%' 
                 OR 
                 LOWER(description) LIKE '%' || ? ||'%'" 
                 query query] {:builder-fn result-set/as-unqualified-maps})

orestis 2020-04-05T12:02:59.152100Z

Not sure which other engines support it, Postgres also has ILIKE https://stackoverflow.com/questions/20336665/lower-like-vs-ilike