Interface SchemaDefinitionLoader

  • All Implemented Interfaces:

    
    public interface SchemaDefinitionLoader
    
                        

    Provides information about the table structure of the current database. Used for data sharding and triggers.

    Since:

    2019-06-12

    Author:

    trydofor

    • Constructor Detail

    • 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 datasource
        table - 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 datasource
        table - 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 datasource
        table - 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, and Comment of field in the table. Used to populate the TABLE_BONE environment 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 datasource
        table - 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.