Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute several statements in a query (with semi-colon) #1063

Closed
YannickB opened this issue Feb 16, 2018 · 2 comments
Closed

Execute several statements in a query (with semi-colon) #1063

YannickB opened this issue Feb 16, 2018 · 2 comments

Comments

@YannickB
Copy link

Hello,

I'd like to use https://github.com/mattes/migrate for managing migrations in my project. It works well, but I can't define several statements in one migration file without an error.

After some investigations, it seems the problems is because gocql is itself not able to execute several statements in one query. Here is the line where gocql is executed and my error https://github.com/mattes/migrate/blob/master/database/cassandra/cassandra.go#L141.

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]...))

I reproduce the error if I try some random statement in gocql with a semicolon. Is there any reason to have such limitation ? Cqlsh allow to chain statement without any problem so it does not seems to be a Cassandra limitation. This is quite troublesome in my use case because this will force me to have dozens of migration files in my project. What do you think ?

Thank you for your insight and for the awesome work !

@Zariel
Copy link
Member

Zariel commented Feb 16, 2018 via email

@YannickB
Copy link
Author

Hello @Zariel

Thanks for the explanation. In this case I shall close this issue and link it to the one on the migrate project mattes/migrate#338. Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants