Support migrations with multiple statements (batch)See original GitHub issue
It would be great if a single migration file could contain multiple statements.
I tried to create 2 tables in a migration file, but this seems not to be supported. The migration failed with this error:
com.datastax.driver.core.exceptions.SyntaxError: line 9:0 missing EOF at 'CREATE' at com.datastax.driver.core.exceptions.SyntaxError.copy(SyntaxError.java:35) ~[cassandra-driver-core-2.0.1.jar:na] at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:256) ~[cassandra-driver-core-2.0.1.jar:na] at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:172) ~[cassandra-driver-core-2.0.1.jar:na] at com.datastax.driver.core.SessionManager.execute(SessionManager.java:91) ~[cassandra-driver-core-2.0.1.jar:na] at com.datastax.driver.core.SessionManager.execute(SessionManager.java:83) ~[cassandra-driver-core-2.0.1.jar:na] at com.streamsend.pillar.Migration$class.executeUpStatement(Migration.scala:38) ~[pillar_2.10-1.0.3.jar:1.0.3]
Looking at the
Migration classes it seems obvious that it’s just not supported.
To support this (without really parsing cql) perhaps a pragmatic/simple solution would be to use some statement separator, like e.g. a line only containing
-- with an empty line above/below or s.th. like this.
What do you think?
- Created 10 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Still missing this. Unfortunately github doesn’t allow to reopen issues for non project owners 😕
The original design goal was to promote simple migrations, encouraging developers to write migrations that do one thing. I think that’s still feasible. So I’ll close this issue.
I’m not completely opposed to the idea of introducing a more sophisticated parser. However, like @pvenable, I don’t have a need for it.