fix: 给有 FK 依赖的建表脚本加数字前缀以保证字母序就是依赖序

This commit is contained in:
zetaloop
2026-05-03 07:31:12 +08:00
parent 22c7c4e7d9
commit 631469a713
16 changed files with 0 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
CREATE TABLE user_preferences (
user_id BIGINT PRIMARY KEY REFERENCES users(id),
notification_order BOOLEAN DEFAULT TRUE,
notification_community BOOLEAN DEFAULT TRUE,
notification_system BOOLEAN DEFAULT TRUE,
theme VARCHAR(20) DEFAULT 'light',
language VARCHAR(10) DEFAULT 'zh-CN',
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT chk_theme CHECK (theme IN ('light', 'dark', 'auto'))
);
CREATE TRIGGER trigger_preferences_updated_at
BEFORE UPDATE ON user_preferences
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();