Files
his/迁移记录-DB变更记录/0000add_table__MigrationsHistory迁移记录表,在初始化脚本执行完成后执行.sql
2025-12-10 14:20:24 +08:00

16 lines
868 B
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.

-- 创建 __MigrationsHistory 表(迁移历史表)
CREATE TABLE __MigrationsHistory (
-- 迁移ID唯一标识一条迁移记录非空
MigrationId VARCHAR(150) NOT NULL,
-- 产品版本:记录迁移对应的框架/产品版本,非空
ProductVersion VARCHAR(32) NOT NULL,
-- 主键约束:确保 MigrationId 唯一(迁移记录不可重复)
CONSTRAINT pk___migrationshistory PRIMARY KEY (MigrationId)
);
-- 为表添加备注
COMMENT ON TABLE __MigrationsHistory IS '用于记录数据库迁移历史的表,跟踪每次迁移的执行情况';
-- 为字段添加备注
COMMENT ON COLUMN __MigrationsHistory.MigrationId IS '迁移操作的唯一标识符,用于区分不同的迁移脚本';
COMMENT ON COLUMN __MigrationsHistory.ProductVersion IS '执行迁移时使用的产品/框架版本,用于版本兼容性检查';