feat: default automatic C* schema migration to false in request

Change-Id: I62cb2103f3a3721bd3baf38f97ca25fa4d897904
This commit is contained in:
tonytan4ever 2015-10-09 15:11:39 -04:00
parent 0d361d1980
commit 8e67aa8879
4 changed files with 12 additions and 4 deletions

View File

@ -75,6 +75,7 @@ installed and running in a Docker Container.
cluster = <docker ip>
keyspace = poppy
migrations_path = /home/poppy/poppy/storage/cassandra/migrations
automatic_schema_migration = True #True is recommended for local dev machine
5. For logging, find the ``[DEFAULT]`` section in

View File

@ -88,6 +88,7 @@ keyspace = poppy
replication_strategy = class:SimpleStrategy, replication_factor:1
# Path to directory containing CQL migration scripts
migrations_path = <poppy_code_path>/poppy/storage/cassandra/migrations
automatic_schema_migration = False
[drivers:distributed_task:taskflow]
jobboard_backend_type = zookeeper

View File

@ -73,6 +73,8 @@ CASSANDRA_OPTIONS = [
),
cfg.BoolOpt('archive_on_delete', default=True,
help='Archive services on delete?'),
cfg.BoolOpt('automatic_schema_migration', default=False,
help='Automatically migrate schema in request ?')
]
CASSANDRA_GROUP = 'drivers:storage:cassandra'
@ -121,10 +123,12 @@ def _connection(conf, datacenter, keyspace=None):
except cassandra.InvalidRequest:
_create_keyspace(session, keyspace, conf.replication_strategy)
migration_session = copy.copy(session)
migration_session.default_consistency_level = \
getattr(cassandra.ConsistencyLevel, conf.migrations_consistency_level)
_run_migrations(conf.migrations_path, migration_session)
if conf.automatic_schema_migration:
migration_session = copy.copy(session)
migration_session.default_consistency_level = \
getattr(cassandra.ConsistencyLevel,
conf.migrations_consistency_level)
_run_migrations(conf.migrations_path, migration_session)
session.row_factory = query.dict_factory

View File

@ -63,6 +63,8 @@ CASSANDRA_OPTIONS = [
),
cfg.BoolOpt('archive_on_delete', default=True,
help='Archive services on delete?'),
cfg.BoolOpt('automatic_schema_migration', default=False,
help='Automatically migrate schema in request ?')
]