migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Chain commands in cassandra migration file

Open YannickB opened this issue 7 years ago • 1 comments

Hello,

Is it possible to chain several commands when executing a migration file for cassandra ? I have an error if I try to add something after a semi-colon.

migration failed in line 0: CREATE TABLE IF NOT EXISTS requirement ( id text, parent_id text, sequence int, computation text, weight int, state text, can_have_children boolean, PRIMARY KEY(id) ); CREATE INDEX IF NOT EXISTS requirement_parent_id ON requirement(parent_id); (details: line 11:0 mismatched input 'CREATE' expecting EOF (...PRIMARY KEY(id));[CREATE]...))

Of course I can still create one file per command but this is really not convenient. I wonder if this is a limitation of gocql, what do you think ?

Thanks!

YannickB avatar Feb 16 '18 18:02 YannickB

I asked the question on the gocql project (link above). It seems this is a cassandra limitation, the only way seems to find a way to split the statement and execute them separately. Maybe a strings.Split(file, ";") will do the trick ?

YannickB avatar Feb 16 '18 20:02 YannickB