sql 2020-04-04

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

i like that maigratus has a lein plugin

so i think i will go with that for now

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

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

let me triple check but i think migratus is the one

> 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

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

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

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

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

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

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

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

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

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