Class SchemaHelper

java.lang.Object
cool.scx.jdbc.meta_data.SchemaHelper

public final class SchemaHelper extends Object
架构管理工具
  • Constructor Details

    • SchemaHelper

      public SchemaHelper()
  • Method Details

    • getMigrateSQL

      public static String getMigrateSQL(Table oldTable, Table newTable, Dialect dialect)
      获取迁移 SQL (当前只支持 创建不存在的新列) todo 需要支持删除旧列和修改列
      Parameters:
      oldTable - 旧表
      newTable - 新表
      dialect - 方言
      Returns:
      sql 不需要迁移语句则返回 null
    • verifyTable

      public static SchemaHelper.TableVerifyResult verifyTable(Table oldTable, Table newTable)
    • fixTable

      public static void fixTable(Table tableInfo, JDBCContext jdbcContext) throws SQLException
      和当前数据中同名表进行比对 进行修复 (若表不存在则创建,若存在则只添加不存在的列)
      Parameters:
      tableInfo - a
      Throws:
      SQLException - a
    • checkNeedFixTable

      public static boolean checkNeedFixTable(Table tableInfo, DataSource dataSource) throws SQLException
      检查是否需要修复表
      Parameters:
      tableInfo - a
      Returns:
      true 需要 false 不需要
      Throws:
      SQLException - e