mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-14 06:45:21 +00:00
Refactor: remove MConfiguration from BaseDdlBuffer (it is unused, and may/should be re-added to the DdlWrite when needed)
This commit is contained in:
1 parent
6e5eb6b963
commit
53c8827a52
5 files changed
+11
-33
No files matched your search
-7
@@ -1,17 +1,10 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration;
|
||||
|
||||
import io.ebeaninternal.dbmigration.model.MConfiguration;
|
||||
|
||||
/**
|
||||
* Buffer to append generated DDL to.
|
||||
*/
|
||||
public interface DdlBuffer {
|
||||
|
||||
/**
|
||||
* Return the configuration (default tablespaces etc).
|
||||
*/
|
||||
MConfiguration getConfiguration();
|
||||
|
||||
/**
|
||||
* Return true if the buffer is empty.
|
||||
*/
|
||||
|
||||
+7
-14
@@ -12,19 +12,19 @@ public class DdlWrite {
|
||||
|
||||
private final ModelContainer currentModel;
|
||||
|
||||
private final DdlBuffer applyDropDependencies;
|
||||
private final DdlBuffer applyDropDependencies = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer apply;
|
||||
private final DdlBuffer apply = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer applyForeignKeys;
|
||||
private final DdlBuffer applyForeignKeys = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer applyHistoryView;
|
||||
private final DdlBuffer applyHistoryView = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer applyHistoryTrigger;
|
||||
private final DdlBuffer applyHistoryTrigger = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer dropAllForeignKeys;
|
||||
private final DdlBuffer dropAllForeignKeys = new BaseDdlBuffer();
|
||||
|
||||
private final DdlBuffer dropAll;
|
||||
private final DdlBuffer dropAll = new BaseDdlBuffer();
|
||||
|
||||
private final DdlOptions options;
|
||||
|
||||
@@ -40,13 +40,6 @@ public class DdlWrite {
|
||||
*/
|
||||
public DdlWrite(MConfiguration configuration, ModelContainer currentModel, DdlOptions options) {
|
||||
this.currentModel = currentModel;
|
||||
this.applyDropDependencies = new BaseDdlBuffer(configuration);
|
||||
this.apply = new BaseDdlBuffer(configuration);
|
||||
this.applyForeignKeys = new BaseDdlBuffer(configuration);
|
||||
this.applyHistoryView = new BaseDdlBuffer(configuration);
|
||||
this.applyHistoryTrigger = new BaseDdlBuffer(configuration);
|
||||
this.dropAllForeignKeys = new BaseDdlBuffer(configuration);
|
||||
this.dropAll = new BaseDdlBuffer(configuration);
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ public abstract class AbstractHanaDdl extends PlatformDdl {
|
||||
: (alter.getDefaultValue() != null ? alter.getDefaultValue() : alter.getCurrentDefaultValue());
|
||||
String defaultValueClause = (defaultValue == null || defaultValue.isEmpty()) ? "" : " default " + defaultValue;
|
||||
|
||||
DdlBuffer buffer = new BaseDdlBuffer(null);
|
||||
DdlBuffer buffer = new BaseDdlBuffer();
|
||||
if (!isConvertible(currentType, type)) {
|
||||
// add an intermediate conversion if possible
|
||||
if (isNumberType(currentType)) {
|
||||
@@ -115,7 +115,7 @@ public abstract class AbstractHanaDdl extends PlatformDdl {
|
||||
|
||||
@Override
|
||||
public String alterTableDropUniqueConstraint(String tableName, String uniqueConstraintName) {
|
||||
DdlBuffer buffer = new BaseDdlBuffer(null);
|
||||
DdlBuffer buffer = new BaseDdlBuffer();
|
||||
|
||||
buffer.append("delimiter $$").newLine();
|
||||
buffer.append("do").newLine();
|
||||
|
||||
+1
-9
@@ -11,18 +11,10 @@ public class BaseDdlBuffer implements DdlBuffer {
|
||||
|
||||
protected final StringBuilder writer;
|
||||
|
||||
protected final MConfiguration configuration;
|
||||
|
||||
public BaseDdlBuffer(MConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
public BaseDdlBuffer() {
|
||||
this.writer = new StringBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MConfiguration getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return writer.length() == 0;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class HanaColumnStoreDdl extends AbstractHanaDdl {
|
||||
|
||||
@Override
|
||||
public String dropIndex(String indexName, String tableName, boolean concurrent) {
|
||||
DdlBuffer buffer = new BaseDdlBuffer(null);
|
||||
DdlBuffer buffer = new BaseDdlBuffer();
|
||||
buffer.append("delimiter $$").newLine();
|
||||
buffer.append("do").newLine();
|
||||
buffer.append("begin").newLine();
|
||||
|
||||
Reference in new issue
Block a user