comeara/pillar — pull request #19 by sadowskik (2014-12-16 13:55:36+00:00)
Title: Introduce execution stages for up and down queries

Some of the queries cannot be executed via cassandra driver in a single go. GRANT query is one of the examples. In order to effectively setup some grants the one need to run separate query, for each GRANT:

```java
session.execute("GRANT MODIFY ...");
session.execute("GRANT MODIFY ...");
session.execute("GRANT MODIFY ...");
```
This pull request introduces the notion of stages. Each migration section (up or down) can be segregated with the `--stage` keyword. Queries defined within each stage are executed in a single go (single `session.execute(...)` invocation). Example:

```
-- description: created schema
-- authoredAt: 1370023265
-- up:

-- stage: 1
CREATE TABLE events (
batch_id text,
occurred_at uuid,
event_type text,
payload blob,
PRIMARY KEY (batch_id, occurred_at, event_type)
)

--stage: 2
GRANT MODIFY ON events TO test_user

--stage: 3
GRANT SELECT ON events TO test_user
```

This migration will be applied by running `session.execute()` three times:

1. `session.execute("CREATE TABLE events (...")`
2. `session.execute("GRANT MODIFY ON...")`
3. `session.execute("GRANT MODIFY ON...")`