This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Script Types
Herdy Handoko edited this page Apr 3, 2017
·
1 revision
Two main migrations script types are supported: CQL and Java classes. One or a combination of both can be used, with the limitation that no version numbers conflict exists, e.g. having a CQL script and Java class that resolves to both version 2
will throw an exception.
Example:
CREATE TABLE test1 (
space text,
key text,
value text,
PRIMARY KEY (space, key)
) with CLUSTERING ORDER BY (key ASC);
INSERT INTO test1 (space, key, value) VALUES ('foo', 'blah', 'meh');
UPDATE test1 SET value = 'profit!' WHERE space = 'foo' AND key = 'blah';
Example:
public class V3_0__Third implements JavaMigration {
@Override
public void migrate(Session session) throws Exception {
Insert insert = QueryBuilder.insertInto("test1");
insert.value("space", "web");
insert.value("key", "google");
insert.value("value", "google.com");
session.execute(insert);
}
}