Class MysqlDefinitionLoader

    • Constructor Detail

      • MysqlDefinitionLoader

        MysqlDefinitionLoader()
    • Method Detail

      • showFullDdl

         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

         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

         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

         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

         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.