update
This commit is contained in:
17
scripts/sql/007_create_favorites.sql
Normal file
17
scripts/sql/007_create_favorites.sql
Normal file
@ -0,0 +1,17 @@
|
||||
-- 007: favorites —— 用户收藏(服务端持久化,按用户隔离)
|
||||
-- 与项目约定一致:表结构由 SQL 托管,不依赖 GORM AutoMigrate。
|
||||
-- target_uid 存前端卡片的 it.id(编码串),与前端直接对齐;title/cover/brand 为收藏时快照。
|
||||
CREATE TABLE IF NOT EXISTS `favorites` (
|
||||
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` int unsigned NOT NULL DEFAULT 0,
|
||||
`user_id` int unsigned NOT NULL,
|
||||
`target_type` varchar(16) NOT NULL DEFAULT '',
|
||||
`target_uid` varchar(64) NOT NULL DEFAULT '',
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`cover` varchar(512) NOT NULL DEFAULT '',
|
||||
`brand` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uniq_user_target` (`user_id`, `target_uid`),
|
||||
KEY `idx_user` (`user_id`),
|
||||
KEY `idx_user_created` (`user_id`, `created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
Reference in New Issue
Block a user