Skip to content

Instantly share code, notes, and snippets.

@philip-doctor
Last active August 29, 2015 14:26
Show Gist options
  • Save philip-doctor/2b7c87f551a35a5c7c79 to your computer and use it in GitHub Desktop.
Save philip-doctor/2b7c87f551a35a5c7c79 to your computer and use it in GitHub Desktop.
Schema migration work around
-- depending on how far through the migration you progressed, parts of this may fail
-- this assumes you're using the default name of "OpsCenter" for the opscenter keyspace, otherwise
-- you'll have to rename the "OpsCenter" part.
-- in between each step wait a few minutes, you need to wait for the migrations to propagate around the cluster
-- 5 mins should be more than enough
-- If you don't wait, CQLSH can report success but in reality, it may fail
ALTER TABLE "OpsCenter"."events" ADD message text;
ALTER TABLE "OpsCenter"."events" ADD column_family text;
ALTER TABLE "OpsCenter"."events" ADD target_node text;
ALTER TABLE "OpsCenter"."events" ADD event_source text;
ALTER TABLE "OpsCenter"."events" ADD "keyspace" text;
ALTER TABLE "OpsCenter"."events" ADD api_source_ip text;
ALTER TABLE "OpsCenter"."events" ADD user text;
ALTER TABLE "OpsCenter"."events" ADD source_node text;
ALTER TABLE "OpsCenter"."events" with comment = '{"info": "OpsCenter management data.", "version": [5, 2, 0]}';
ALTER TABLE "OpsCenter"."rollups60" RENAME column1 to timestamp;
ALTER TABLE "OpsCenter"."rollups60" with comment = '{"info": "OpsCenter management data.", "version": [5, 2, 0]}';
ALTER TABLE "OpsCenter"."rollups300" RENAME column1 to timestamp;
ALTER TABLE "OpsCenter"."rollups300" with comment = '{"info": "OpsCenter management data.", "version": [5, 2, 0]}';
ALTER TABLE "OpsCenter"."rollups7200" RENAME column1 to timestamp;
ALTER TABLE "OpsCenter"."rollups7200" with comment = '{"info": "OpsCenter management data.", "version": [5, 2, 0]}';
ALTER TABLE "OpsCenter"."rollups86400" RENAME column1 to timestamp;
ALTER TABLE "OpsCenter"."rollups86400" with comment = '{"info": "OpsCenter management data.", "version": [5, 2, 0]}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment