← 返回 Skills 市场
imtzc

Autotable Usage

作者 唐振超 · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
38
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install autotable-usage
功能描述
AutoTable 框架完整使用指南。基于 JDBC 的自动建表框架(非 MyBatis 依赖),支持 9 种数据库。覆盖注解配置、多数据库适配、生命周期钩子、SPI 扩展、SQL 审计、数据初始化、多数据源等。当用户询问 AutoTable 的用法、注解、配置、扩展、最佳实践时激活。
使用说明 (SKILL.md)

AutoTable 完整使用指南

AutoTable 是一个基于 JDBC(commons-dbutils)的自动维护数据库表结构的 Java 框架,不依赖任何 ORM 框架,可与 MyBatis/MyBatis-Plus/MyBatis-Flex/JPA 等共存。

快速定位

用户问题 参考文档
如何安装、启用、定义实体 references/quick-start.md
某个注解的完整属性、用法 references/annotation-reference.md
Spring Boot / Solon 配置项 references/configuration.md
生命周期回调、拦截器 references/lifecycle.md
MySQL / Doris / PostgreSQL 专属功能 references/database-specific.md
类型映射、自定义类型转换 references/type-mapping.md
多数据源配置 references/multi-datasource.md
生产部署、测试、最佳实践 references/best-practices.md
内部架构、SPI 扩展、自定义策略 references/architecture.md

核心概念速查

运行模式(RunMode)

模式 说明 适用场景
update 增量更新表结构(默认) 开发环境
validate 仅校验,不一致则报错 生产环境
create 删表重建(⚠️ 丢数据) 测试环境
none 不做任何处理 禁用

支持数据库

MySQL、MariaDB、PostgreSQL、Oracle、SQLite、H2、Doris、达梦(DM)、人大金仓(KingBase)

注解层级

@AutoTable (类级) → 声明建表
├── @TableIndex (类级,组合索引,可重复)
├── @MysqlEngine / @MysqlCharset (MySQL 类级)
├── @MysqlTableFullTextIndex (MySQL 全文索引)
├── @DorisTable (Doris 类级)
│
@AutoColumn (字段级) → 聚合配置
├── @ColumnName / @ColumnType / @ColumnNotNull
├── @ColumnDefault / @ColumnComment
├── @PrimaryKey / @AutoIncrement
├── @Index (字段级索引)
├── @Ignore (忽略字段)
├── @MysqlFullTextIndex / @MysqlColumnCharset 等
├── @DorisColumn
└── @AutoColumns (多数据库适配容器)

最小依赖

\x3C!-- Spring Boot(兼容 2.x 和 3.x) -->
\x3Cdependency>
    \x3CgroupId>org.dromara.autotable\x3C/groupId>
    \x3CartifactId>auto-table-spring-boot-starter\x3C/artifactId>
    \x3Cversion>2.5.17\x3C/version>
\x3C/dependency>

\x3C!-- Solon -->
\x3Cdependency>
    \x3CgroupId>org.dromara.autotable\x3C/groupId>
    \x3CartifactId>auto-table-solon-plugin\x3C/artifactId>
    \x3Cversion>2.5.17\x3C/version>
\x3C/dependency>

启用方式

// Spring Boot
@EnableAutoTable
@SpringBootApplication
public class Application { ... }

// Solon
@EnableAutoTable  // 标注在 @SolonMain 类上
public class Application { ... }

最小实体

@Data
@AutoTable(comment = "用户表")
public class User {
    @PrimaryKey(autoIncrement = true)
    private Long id;

    @AutoColumn(comment = "用户名", notNull = true)
    private String username;
}

关键陷阱

  1. 基于 JDBC,非 MyBatis:pom.xml 旧版 description 写的"Mybatis下"是历史遗留,实际核心依赖 commons-dbutils
  2. create 模式会删表:测试完务必切回 update
  3. auto-drop-table/column 生产环境必须关闭,会造成数据丢失
  4. 索引名前缀:自动生成 auto_idx_ 前缀,超长时 hash 处理
  5. 父类字段排序super-insert-position 默认 after(父类字段在子类后面),不符合直觉时可改为 before
  6. MySQL 云数据库:部分云厂商禁止 ALTER TABLE 中混用 DROP 和 ADD,需开启 mysql.alter-table-separate-drop
  7. Doris 大表更新:默认超过 1GB 跳过更新(doris.update-limit-table-data-length),需按需调整
安全使用建议
Review the database lifecycle settings before installing or using this skill. Do not enable create, auto-drop, or automatic update behavior against production databases unless you have backups, migration review, explicit approval, and a tested rollback plan. Prefer validate, dry-run, or reviewed migration flows for live systems.
能力评估
Purpose & Capability
The described create/update lifecycle behavior is coherent with a database schema automation or ORM-oriented skill, but it includes destructive DDL such as dropping and recreating tables and deleting unregistered tables.
Instruction Scope
The referenced guidance appears to present destructive or automatic schema operations without clear, prominent warnings, confirmation requirements, dry-run review, backups, or production environment gating.
Install Mechanism
No artifact-backed evidence was provided of hidden installers, obfuscated setup steps, or automatic execution at install time.
Credentials
Automatic schema creation, updates, or table deletion can affect production databases and business data; the supplied evidence does not show sufficient scoping to development or controlled migration workflows.
Persistence & Privilege
No evidence was provided of background persistence, privilege escalation, credential harvesting, or unrelated local data access.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install autotable-usage
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /autotable-usage 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
AutoTable 使用指南首发版: - 提供基于 JDBC 的 AutoTable 框架完整使用文档,非 MyBatis 依赖,支持 9 种主流数据库。 - 覆盖注解详解、多数据库适配、生命周期钩子、SPI 扩展、SQL 审计、数据初始化与多数据源等核心特性。 - 包含快速定位表格、关键注解和运行模式说明、最小依赖与实体示例,以及易踩陷阱提示。 - 针对常见场景(配置、注解、最佳实践、扩展点等)一目了然,方便直接查用。
元数据
Slug autotable-usage
版本 0.1.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Autotable Usage 是什么?

AutoTable 框架完整使用指南。基于 JDBC 的自动建表框架(非 MyBatis 依赖),支持 9 种数据库。覆盖注解配置、多数据库适配、生命周期钩子、SPI 扩展、SQL 审计、数据初始化、多数据源等。当用户询问 AutoTable 的用法、注解、配置、扩展、最佳实践时激活。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 38 次。

如何安装 Autotable Usage?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install autotable-usage」即可一键安装,无需额外配置。

Autotable Usage 是免费的吗?

是的,Autotable Usage 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Autotable Usage 支持哪些平台?

Autotable Usage 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Autotable Usage?

由 唐振超(@imtzc)开发并维护,当前版本 v0.1.0。

💬 留言讨论