spark-server/migrations/0004_user_devices_autoincrement.sql
2026-09-23 17:11:56 +08:00

6 lines
364 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.

-- t_user_devices.id is a table-local AUTO_INCREMENT row key, not Snowflake.
-- Business identity remains (user_id, device_id). Existing Snowflake values stay; new rows continue from MAX(id)+1.
ALTER TABLE t_user_devices
MODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT COMMENT '行 id,表内自增,仅内部用;业务唯一键是 (user_id, device_id)';