Fork me on GitHub
#sql
<
2020-04-04
>
tjb18:04:54

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

tjb18:04:05

i like that maigratus has a lein plugin

tjb18:04:08

so i think i will go with that for now

seancorfield18:04:30

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

seancorfield18:04:53

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

tjb18:04:55

:thinking_face:

tjb18:04:18

let me triple check but i think migratus is the one

tjb18:04:37

> 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

tjb18:04:41

yup thats the one!

tjb18:04:34

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

tjb18:04:11

gots it!

tjb18:04:19

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

seancorfield19:04:19

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

dpsutton19:04:32

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

tjb19:04:31

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

tjb22:04:11

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

tjb22:04:12

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

tjb22:04:13

got it 😛

tjb22:04:15

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

orestis12:04:59

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