UpgradeMapper.xml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.gitee.gen.mapper.UpgradeMapper">
  4. <update id="runSql">
  5. ${sql}
  6. </update>
  7. <update id="addColumn">
  8. ALTER TABLE ${tableName} ADD ${columnName} ${type}
  9. </update>
  10. <update id="addColumnMysql">
  11. ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${type}
  12. </update>
  13. <select id="listColumnInfo" resultType="com.gitee.gen.entity.ColumnInfo">
  14. PRAGMA table_info('${tableName}')
  15. </select>
  16. <select id="listColumnInfoMysql" resultType="com.gitee.gen.entity.ColumnInfo">
  17. select COLUMN_NAME as 'name', DATA_TYPE as 'type'
  18. from information_schema.COLUMNS
  19. where table_name = '${tableName}'
  20. </select>
  21. <select id="listTableName" resultType="String">
  22. SELECT name FROM sqlite_master WHERE type='table'
  23. </select>
  24. <select id="listTableNameMysql" resultType="String">
  25. SHOW TABLES
  26. </select>
  27. </mapper>