Fork me on GitHub
#clojure-uk
<
2017-08-15
>
thomas07:08:03

morning 😼 mogge

maleghast08:08:30

Morning everyone

maleghast08:08:45

Hope you are all spiffingly wonderful today 🙂

thomas09:08:20

well.. fighting with an SQL database... not much fun.... trying to delete an entry... but keep running into constraints that mean you can't just do a delete...

mccraigmccraig09:08:40

no cascading delete available @thomas ?

thomas09:08:03

h,mmmm let me find out...

thomas09:08:39

(I didn't setup that DB...)

thomas09:08:00

cascading delete isn't used anywhere 😞

mccraigmccraig09:08:20

what flavour of db is it ?

thomas09:08:48

looks like you need to enable it when creating the tables...

mccraigmccraig09:08:22

you can probably do an alter-table to add the cascade to the constraints...

thomas09:08:36

let me try that....

glenjamin09:08:58

how much do you care about keeping consistency? You can just turn off constraints in MySQL 😄

thomas09:08:18

(it is test data only anyway at the moment... so recreating wouldn't be a problem anyway) not sure if they want it in production though.

thomas09:08:14

I don't care about consistency what so ever! 😈

thomas09:08:20

@glenjamin actually I am quite tempted to do that... 😉

thomas09:08:39

at least my tests would be simpler to write in that case.

maleghast12:08:50

Doooo Eeeeeet!

thomas12:08:55

I mean.... what is the worst that can happen?

mccraigmccraig12:08:08

why not just fix the schema, then you will have no problems now or in the future ?

thomas12:08:07

The customer might not like us changing the DB schema, it is an existing schema already in prod at the moment.

thomas12:08:27

( we write the tests after we have done all the code of course 😱 )

mccraigmccraig13:08:51

presumably there will be migrations on the schema ? i just counted 139 migrations on my db schema over the last 2 years!

chrisjd13:08:58

@mccraigmccraig Out of interest, what are you using for migrations? ragtime?

chrisjd13:08:13

Something you’ve stuck with for that long must be a good choice. 🙂

mccraigmccraig13:08:21

@chrisjd i'm using https://github.com/macourtney/drift - if i was starting again i would probably try ragtime or joplin, but i was familiar with drift from an earlier project and had already patched it to my needs (those being cassandra and elasticsearch)

chrisjd13:08:37

Interesting, thanks.

mccraigmccraig13:08:44

drift doesn't do an awful lot - it creates template migration namespaces with up/down fns and calls them in order - you give it a couple of fns which it uses to determine current migration state and to set up for running migrations, so it's easy to adapt to any old datastore

mccraigmccraig13:08:48

in my migration namespaces i just call my regular db connectors... all very straightforward

mccraigmccraig13:08:55

joplin and ragtime look like they have approaches to dealing with conflicts though, which is probably the major pain point

glenjamin13:08:43

i’ve used simple migration tools for years without really seeing many/any issues

glenjamin13:08:10

if you get conflicts at the schema level you’re probably not talking/integrating enough?

mccraigmccraig13:08:04

@glenjamin the conflicts i'm thinking of come from merging branches resulting in interleaving of migrations from each branch

mccraigmccraig13:08:30

but maybe those are not the conflicts that joplin/ragtime are talking about... dunno

glenjamin13:08:36

i assumed the same

glenjamin13:08:48

but either you have disparate teams editing the same schema, which is bad

glenjamin13:08:56

or you have a single team which isn’t talking enough, which is bad

mccraigmccraig13:08:34

there's a third option 🙂

glenjamin13:08:03

oh, i see - ragtime’s definition of conflict is more broad than i expected

glenjamin13:08:24

generally I’d expect interleaved migrations is only an issue if you both touch the same part of the schema, and if there’s a chance that this could happen you should probably get the migrations merged into the mainline quickly and released even while development is still ongoing

mccraigmccraig13:08:00

yeah, i generally end up doing a rebase, but manually

mccraigmccraig13:08:11

and i don't have the option of adding stuff to the mainline at arbitrary times - my clients are mostly apps and apple's review process imposes fairly rigid release constraints

glenjamin13:08:50

I was thinking more about the mainline development branch

glenjamin13:08:00

ie. make everyone else on the team aware ASAP

glenjamin13:08:45

My assumption has always been that ragtime’s apply-new is how migration runners work (ever since i used the one in rails)

mccraigmccraig13:08:12

ah, i see, yeah that could work - rebasing works too though

actionshrimp14:08:42

good afternoon 🙂