Interface SchemaDefinitionLoader
-
- All Implemented Interfaces:
public interface SchemaDefinitionLoaderProvides information about the table structure of the current database. Used for data sharding and triggers.
- Since:
2019-06-12
trydofor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSchemaDefinitionLoader.Companionpublic final classSchemaDefinitionLoader.Trg
-
Method Summary
Modifier and Type Method Description abstract List<String>showTables(DataSource dataSource)list all tables of current datasource abstract List<String>showFullDdl(DataSource dataSource, String table)List all DDLs that can create the current table with fields, constraints, indexes and triggers. abstract StringdiffBoneSame(DataSource dataSource, String table, String other, Integer types)Whether two tables have the same skeleton, including field (NAME, TYPE, COMMENT, POSITION), index and trigger. abstract StringdiffFullSame(DataSource dataSource, String table, String other, Integer types)Whether two tables have the same struct, including field (NAME, TYPE, COMMENT, POSITION, NULLABLE, DEFAULT), index and trigger. abstract List<String>showBoneCol(DataSource dataSource, String table)A DDL section that lists at least the Name,Type, andCommentof field in the table.abstract List<String>showPkeyCol(DataSource dataSource, String table)Get the field name of primary key in the table. abstract List<SchemaDefinitionLoader.Trg>showBoneTrg(DataSource dataSource, String table)Get the name and EVENTcontent of trigger in the table.abstract StringmakeDdlTrg(SchemaDefinitionLoader.Trg trg, Boolean drop)Create trigger DDL via trigger definition -
-
Method Detail
-
showTables
abstract List<String> showTables(DataSource dataSource)
list all tables of current datasource
- Parameters:
dataSource- current datasource
-
showFullDdl
abstract List<String> showFullDdl(DataSource dataSource, String table)
List all DDLs that can create the current table with fields, constraints, indexes and triggers. Foreign Key should not be considered, some normalization is no longer good in modern software development.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.
-
diffBoneSame
abstract String diffBoneSame(DataSource dataSource, String table, String other, Integer types)
Whether two tables have the same skeleton, including field (NAME, TYPE, COMMENT, POSITION), index and trigger.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.other- other plain table name, do NOT include any quote.- Returns:
diff info, empty mean the same
-
diffFullSame
abstract String diffFullSame(DataSource dataSource, String table, String other, Integer types)
Whether two tables have the same struct, including field (NAME, TYPE, COMMENT, POSITION, NULLABLE, DEFAULT), index and trigger.
- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.other- other plain table name, do NOT include any quote.- Returns:
diff info, empty mean the same
-
showBoneCol
abstract List<String> showBoneCol(DataSource dataSource, String table)
A DDL section that lists at least the
Name,Type, andCommentof field in the table. Used to populate theTABLE_BONEenvironment variable. Fields are comma-separated in SQL syntax (no comma at the end of the line)`LOGIN_INFO` text COMMENT 'login info', `OTHER_INFO` text COMMENT 'other info'- Parameters:
dataSource- current datasourcetable- the plain table name, do NOT include any quote.
-
showPkeyCol
abstract List<String> showPkeyCol(DataSource dataSource, String table)
Get the field name of primary key in the table.
- Parameters:
table- the plain table name, do NOT include any quote.
-
showBoneTrg
abstract List<SchemaDefinitionLoader.Trg> showBoneTrg(DataSource dataSource, String table)
Get the name and
EVENTcontent of trigger in the table.- Parameters:
table- the plain table name, do NOT include any quote.
-
makeDdlTrg
abstract String makeDdlTrg(SchemaDefinitionLoader.Trg trg, Boolean drop)
Create trigger DDL via trigger definition
- Parameters:
trg- trigger definitiondrop- drop or create
-
-
-
-