/** * Causes the inclusion of an {@code IF NOT EXISTS} clause. * * @return this */ public CreateKeyspaceSpecification ifNotExists() { return ifNotExists(true); }
@Override protected List<CreateKeyspaceSpecification> getKeyspaceCreations() { CreateKeyspaceSpecification specification = CreateKeyspaceSpecification.createKeyspace(keySpace) .ifNotExists() .with(KeyspaceOption.DURABLE_WRITES, true); //.withNetworkReplication(DataCenterReplication.dcr("foo", 1), DataCenterReplication.dcr("bar", 2)); return Arrays.asList(specification); }
/** * Generate a {@link CreateKeyspaceSpecification} for the keyspace. * * @param ifNotExists {@literal true} to include {@code IF NOT EXISTS} rendering in the create statement. * @return the {@link CreateKeyspaceSpecification}. */ public CreateKeyspaceSpecification create(boolean ifNotExists) { CreateKeyspaceSpecification create = CreateKeyspaceSpecification.createKeyspace(name).ifNotExists(ifNotExists) .with(KeyspaceOption.DURABLE_WRITES, durableWrites); Map<Option, Object> replication = getReplication(); if (!replication.isEmpty()) { create.with(KeyspaceOption.REPLICATION, replication); } return create; }