mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#930 - Refactor (renames etc) for SQL Server History support
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
package io.ebean.config.dbplatform.sqlserver;
|
||||
|
||||
import io.ebean.dbmigration.ddlgeneration.platform.MsSqlServer2016Ddl;
|
||||
|
||||
/**
|
||||
* @author Vilmos Nagy <vilmos.nagy@outlook.com>
|
||||
*/
|
||||
public class SqlServer2016Platform extends SqlServerPlatform {
|
||||
|
||||
public SqlServer2016Platform() {
|
||||
super();
|
||||
this.historySupport = new SqlServer2016HistorySupport();
|
||||
this.platformDdl = new MsSqlServer2016Ddl(this);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -3,9 +3,11 @@ package io.ebean.config.dbplatform.sqlserver;
|
||||
import io.ebean.config.dbplatform.DbStandardHistorySupport;
|
||||
|
||||
/**
|
||||
* History support only valid on SqlServer 2016 or later.
|
||||
*
|
||||
* @author Vilmos Nagy <vilmos.nagy@outlook.com>
|
||||
*/
|
||||
public class SqlServer2016HistorySupport extends DbStandardHistorySupport {
|
||||
public class SqlServerHistorySupport extends DbStandardHistorySupport {
|
||||
|
||||
/**
|
||||
* Return the ' as of timestamp ?' clause appended after the table name.
|
||||
@@ -6,7 +6,7 @@ import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.DbType;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.dbmigration.ddlgeneration.platform.MsSqlServerDdl;
|
||||
import io.ebean.dbmigration.ddlgeneration.platform.SqlServerDdl;
|
||||
|
||||
/**
|
||||
* Microsoft SQL Server platform.
|
||||
@@ -21,9 +21,10 @@ public class SqlServerPlatform extends DatabasePlatform {
|
||||
this.persistBatchOnCascade = PersistBatch.NONE;
|
||||
this.idInExpandedForm = true;
|
||||
this.selectCountWithAlias = true;
|
||||
this.sqlLimiter = new SqlServer2012SqlLimiter();
|
||||
this.sqlLimiter = new SqlServerSqlLimiter();
|
||||
this.basicSqlLimiter = new SqlServerBasicSqlLimiter();
|
||||
this.platformDdl = new MsSqlServerDdl(this);
|
||||
this.platformDdl = new SqlServerDdl(this);
|
||||
this.historySupport = new SqlServerHistorySupport();
|
||||
this.dbIdentity.setIdType(IdType.IDENTITY);
|
||||
this.dbIdentity.setSupportsGetGeneratedKeys(true);
|
||||
this.dbIdentity.setSupportsIdentity(true);
|
||||
|
||||
+3
-3
@@ -5,11 +5,11 @@ import io.ebean.config.dbplatform.SqlLimitResponse;
|
||||
import io.ebean.config.dbplatform.SqlLimiter;
|
||||
|
||||
/**
|
||||
* Use ANSI offset rows syntax or top n.
|
||||
* Use ANSI offset rows syntax or top n - SQL Server 2012 onwards.
|
||||
*/
|
||||
public class SqlServer2012SqlLimiter implements SqlLimiter {
|
||||
public class SqlServerSqlLimiter implements SqlLimiter {
|
||||
|
||||
public SqlServer2012SqlLimiter() {
|
||||
public SqlServerSqlLimiter() {
|
||||
}
|
||||
|
||||
public SqlLimitResponse limit(SqlLimitRequest request) {
|
||||
@@ -1,24 +0,0 @@
|
||||
package io.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.dbmigration.ddlgeneration.DdlBuffer;
|
||||
import io.ebean.dbmigration.ddlgeneration.DdlWrite;
|
||||
import io.ebean.dbmigration.migration.AddHistoryTable;
|
||||
import io.ebean.dbmigration.migration.AlterColumn;
|
||||
import io.ebean.dbmigration.migration.DropHistoryTable;
|
||||
import io.ebean.dbmigration.model.MTable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* MS SQL Server 2016 platform specific DDL.
|
||||
*/
|
||||
public class MsSqlServer2016Ddl extends MsSqlServerDdl {
|
||||
|
||||
public MsSqlServer2016Ddl(DatabasePlatform platform) {
|
||||
super(platform);
|
||||
this.historyDdl = new MsSqlServer2016HistoryDdl();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -9,15 +9,16 @@ import java.io.IOException;
|
||||
/**
|
||||
* MS SQL Server platform specific DDL.
|
||||
*/
|
||||
public class MsSqlServerDdl extends PlatformDdl {
|
||||
public class SqlServerDdl extends PlatformDdl {
|
||||
|
||||
public MsSqlServerDdl(DatabasePlatform platform) {
|
||||
public SqlServerDdl(DatabasePlatform platform) {
|
||||
super(platform);
|
||||
this.identitySuffix = " identity(1,1)";
|
||||
this.foreignKeyRestrict = "";
|
||||
this.inlineUniqueOneToOne = false;
|
||||
this.columnSetDefault = "add default";
|
||||
this.dropConstraintIfExists = "drop constraint";
|
||||
this.historyDdl = new SqlServerHistoryDdl();
|
||||
}
|
||||
|
||||
@Override
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* @author Vilmos Nagy <vilmos.nagy@outlook.com>
|
||||
*/
|
||||
public class MsSqlServer2016HistoryDdl implements PlatformHistoryDdl {
|
||||
public class SqlServerHistoryDdl implements PlatformHistoryDdl {
|
||||
|
||||
private String systemPeriodStart;
|
||||
private String systemPeriodEnd;
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.ebean.config.dbplatform.sqlserver;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -12,7 +11,7 @@ public class SqlServer2016PlatformTest {
|
||||
|
||||
@Test
|
||||
public void testHistorySupport() {
|
||||
SqlServer2016Platform platform = new SqlServer2016Platform();
|
||||
assertTrue(platform.getHistorySupport() instanceof SqlServer2016HistorySupport);
|
||||
SqlServerPlatform platform = new SqlServerPlatform();
|
||||
assertTrue(platform.getHistorySupport() instanceof SqlServerHistorySupport);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user