iotsaas/backend/sql/V17__add_partner_app.sql
2995840376 0ce191c448 chore: 初始化 iotsaas 版本库基线
纳入范围:
- backend/  Spring Boot 多模块后端(iot-common/device/rule/data/alarm/auth)
- frontend/admin/  Vue3 + Element Plus 管理后台
- Android/   涂鸦原生 APP (com.xhai.iot)
- backend/sql/  Flyway 风格迁移脚本(V2~V21)
- docs/       对接文档与设计文档

排除范围:
- 构建产物: node_modules/ target/ build/ dist/ .gradle/
- 签名密钥: *.jks *.keystore (严禁入库)
- 本机配置: Android/local.properties
- 运行日志: logs/ *.log
- AI 协作本地数据 .codebuddy/ 与第三方 demo tuya-demo/

.gitattributes 统一以 LF 存储, Windows 批处理保留 CRLF
2026-10-27 12:00:41 +08:00

23 lines
1.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 开放平台应用(授权对接)凭证表
CREATE TABLE IF NOT EXISTS partner_app (
id BIGINT NOT NULL,
app_name VARCHAR(128) NOT NULL COMMENT '应用名称',
app_key VARCHAR(64) NOT NULL COMMENT 'Access Key(公开标识 ak-xxxx)',
app_secret_hash VARCHAR(100) NOT NULL COMMENT 'Secret Key 的 BCrypt 哈希',
scopes VARCHAR(512) DEFAULT '' COMMENT '授权范围 JSON 数组字符串',
rate_limit INT DEFAULT NULL COMMENT '单 key 限流(次/分钟),NULL 不限',
ip_whitelist VARCHAR(512) DEFAULT '' COMMENT 'IP 白名单(逗号分隔),空不限制',
status TINYINT NOT NULL DEFAULT 1 COMMENT '1启用 0禁用',
expire_at DATETIME DEFAULT NULL COMMENT '过期时间,NULL 不过期',
description VARCHAR(255) DEFAULT '' COMMENT '描述',
last_used_at DATETIME DEFAULT NULL COMMENT '最近一次调用时间',
tenant_id BIGINT DEFAULT 0,
create_by BIGINT DEFAULT 0,
update_by BIGINT DEFAULT 0,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY uk_app_key (app_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放平台应用(授权对接)凭证';