public class Migrator
extends java.lang.Object
Migrator
.| 限定符和类型 | 类和说明 |
|---|---|
static class |
Migrator.ModifyType
The Enum ModifyType.
|
| 构造器和说明 |
|---|
Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager)
Instantiates a new migrator.
|
Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager,
boolean generateSchema)
Instantiates a new migrator.
|
Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager,
boolean generateSchema,
java.lang.String schema)
Instantiates a new migrator.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
create(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
create database info for classMappings.
|
java.lang.String |
createSql(cn.featherfly.common.repository.mapping.ClassMapping<?> classMapping)
Creates the sql.
|
java.lang.String |
createSql(cn.featherfly.common.repository.mapping.ClassMapping<?> classMapping,
boolean dropIfExists)
Creates the sql.
|
Dialect |
getDialect()
返回dialect.
|
SqlExecutor |
getSqlExecutor()
返回sqlExecutor.
|
SqlTypeMappingManager |
getSqlTypeMappingManager()
返回sqlTypeMappingManager.
|
java.lang.String |
initSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
get the init sql.
|
void |
update(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
merge database info for classMappings.
|
void |
update(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropTableNotMapping,
Migrator.ModifyType columnModifyType,
boolean dropColumnNotMapping,
boolean dropIndexNotMapping)
merge database info for classMappings.
|
java.lang.String |
updateSql(DatabaseMetadata previousMetadata,
DatabaseMetadata currentMetadata,
Migrator.ModifyType tableModifyType,
boolean dropNotExistTable,
Migrator.ModifyType columnModifyType,
boolean dropNotExistColumn,
boolean dropNotExistIndex)
Update sql.
|
java.lang.String |
updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource)
Gets the update sql.
|
java.lang.String |
updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType modifyType)
Update sql.
|
java.lang.String |
updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType modifyType,
boolean dropNotExist)
Update sql.
|
java.lang.String |
updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType tableModifyType,
boolean dropNotExistTable,
Migrator.ModifyType columnModifyType,
boolean dropNotExistColumn,
boolean dropNotExistIndex)
Update sql.
|
java.lang.String |
updateSql(javax.sql.DataSource previousDataSource,
Migrator.ModifyType tableModifyType,
boolean dropNotExistTable,
Migrator.ModifyType columnModifyType,
boolean dropNotExistColumn,
boolean dropNotExistIndex)
Update sql.
|
java.lang.String |
updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
Gets the update sql.
|
java.lang.String |
updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType modifyType,
boolean dropNoMapping)
Update sql.
|
java.lang.String |
updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropNoMappingTable,
Migrator.ModifyType columnModifyType,
boolean dropNoMappingColumn,
boolean dropNoMappingIndex)
Gets the update sql with cached DatabaseMetadata(maybe different from
database).
|
java.lang.String |
updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropNoMappingTable,
Migrator.ModifyType columnModifyType,
boolean dropNoMappingColumn,
boolean dropNoMappingIndex,
DatabaseMetadata databaseMetadata)
Gets the update sql.
|
public Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager)
dataSource - the data sourcedialect - the dialectsqlTypeMappingManager - the sql type mapping managerpublic Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager,
boolean generateSchema)
dataSource - the data sourcedialect - the dialectsqlTypeMappingManager - the sql type mapping managergenerateSchema - the generate schemapublic Migrator(javax.sql.DataSource dataSource,
Dialect dialect,
SqlTypeMappingManager sqlTypeMappingManager,
boolean generateSchema,
java.lang.String schema)
dataSource - the data sourcedialect - the dialectsqlTypeMappingManager - the sql type mapping managergenerateSchema - the generate schemaschema - the schemapublic java.lang.String initSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
classMappings - the class mappingspublic java.lang.String createSql(cn.featherfly.common.repository.mapping.ClassMapping<?> classMapping)
classMapping - the class mappingpublic java.lang.String createSql(cn.featherfly.common.repository.mapping.ClassMapping<?> classMapping,
boolean dropIfExists)
classMapping - the class mappingdropIfExists - the drop if existspublic void create(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
classMappings - the class mappingspublic java.lang.String updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource)
previousDataSource - the previous data sourcecurrentDataSource - the current data sourcepublic java.lang.String updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType modifyType)
previousDataSource - the previous data sourcecurrentDataSource - the current data sourcemodifyType - the modify typepublic java.lang.String updateSql(javax.sql.DataSource previousDataSource,
Migrator.ModifyType tableModifyType,
boolean dropNotExistTable,
Migrator.ModifyType columnModifyType,
boolean dropNotExistColumn,
boolean dropNotExistIndex)
previousDataSource - the previous data sourcetableModifyType - the table modify typedropNotExistTable - the drop not exist tablecolumnModifyType - the column modify typedropNotExistColumn - the drop not exist columndropNotExistIndex - the drop not exist indexpublic java.lang.String updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType modifyType,
boolean dropNotExist)
previousDataSource - the previous data sourcecurrentDataSource - the current data sourcemodifyType - the modify typedropNotExist - the drop not existpublic java.lang.String updateSql(javax.sql.DataSource previousDataSource,
javax.sql.DataSource currentDataSource,
Migrator.ModifyType tableModifyType,
boolean dropNotExistTable,
Migrator.ModifyType columnModifyType,
boolean dropNotExistColumn,
boolean dropNotExistIndex)
previousDataSource - the previous data sourcecurrentDataSource - the current data sourcetableModifyType - the table modify typedropNotExistTable - the drop not exist tablecolumnModifyType - the column modify typedropNotExistColumn - the drop not exist columndropNotExistIndex - the drop not exist indexpublic java.lang.String updateSql(DatabaseMetadata previousMetadata, DatabaseMetadata currentMetadata, Migrator.ModifyType tableModifyType, boolean dropNotExistTable, Migrator.ModifyType columnModifyType, boolean dropNotExistColumn, boolean dropNotExistIndex)
previousMetadata - the previous metadatacurrentMetadata - the current metadatatableModifyType - the table modify typedropNotExistTable - the drop not exist tablecolumnModifyType - the column modify typedropNotExistColumn - the drop not exist columndropNotExistIndex - the drop not exist indexpublic java.lang.String updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
classMappings - the class mappingspublic java.lang.String updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType modifyType,
boolean dropNoMapping)
classMappings - the class mappingsmodifyType - the modify type for table and columndropNoMapping - the drop no mapping for table, column, indexpublic java.lang.String updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropNoMappingTable,
Migrator.ModifyType columnModifyType,
boolean dropNoMappingColumn,
boolean dropNoMappingIndex)
classMappings - the class mappingstableModifyType - the table modify typedropNoMappingTable - if true, drop the table which no mapping with
object; if false, do nothing.columnModifyType - the column modify typedropNoMappingColumn - if true, drop the column which no mapping with
object; if false, do nothing.dropNoMappingIndex - if true, drop the index which no mapping with
object; if false, do nothing.public java.lang.String updateSql(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropNoMappingTable,
Migrator.ModifyType columnModifyType,
boolean dropNoMappingColumn,
boolean dropNoMappingIndex,
DatabaseMetadata databaseMetadata)
classMappings - the class mappingstableModifyType - the table modify typedropNoMappingTable - if true, drop the table which no mapping with
object; if false, do nothing.columnModifyType - the column modify typedropNoMappingColumn - if true, drop the column which no mapping with
object; if false, do nothing.dropNoMappingIndex - if true, drop the index which no mapping with
object; if false, do nothing.databaseMetadata - database metadatapublic void update(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings)
classMappings - the class mappingspublic void update(java.util.Set<cn.featherfly.common.repository.mapping.ClassMapping<?>> classMappings,
Migrator.ModifyType tableModifyType,
boolean dropTableNotMapping,
Migrator.ModifyType columnModifyType,
boolean dropColumnNotMapping,
boolean dropIndexNotMapping)
classMappings - the class mappingstableModifyType - the table modify typedropTableNotMapping - the drop table not mappingcolumnModifyType - the column modify typedropColumnNotMapping - the drop column not mappingdropIndexNotMapping - the drop index not mappingpublic Dialect getDialect()
public SqlExecutor getSqlExecutor()
public SqlTypeMappingManager getSqlTypeMappingManager()