diff --git a/server/HoneyBox/scripts/create_goods_locks_table.sql b/server/HoneyBox/scripts/create_goods_locks_table.sql new file mode 100644 index 00000000..d1fbfb7c --- /dev/null +++ b/server/HoneyBox/scripts/create_goods_locks_table.sql @@ -0,0 +1,26 @@ +-- 创建 goods_locks 表(锁箱功能) +-- 用于一番赏、全局赏、追踪赏的锁箱功能 + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[goods_locks]') AND type in (N'U')) +BEGIN + CREATE TABLE [dbo].[goods_locks] ( + [id] INT IDENTITY(1,1) NOT NULL, + [user_id] INT NOT NULL, + [goods_id_num] NVARCHAR(50) NOT NULL, + [end_time] BIGINT NOT NULL, + [update_time] BIGINT NOT NULL, + CONSTRAINT [PK_goods_locks] PRIMARY KEY CLUSTERED ([id] ASC) + ); + + -- 创建索引 + CREATE INDEX [IX_goods_locks_goods_id_num] ON [dbo].[goods_locks] ([goods_id_num]); + CREATE INDEX [IX_goods_locks_user_id] ON [dbo].[goods_locks] ([user_id]); + CREATE INDEX [IX_goods_locks_end_time] ON [dbo].[goods_locks] ([end_time]); + + PRINT 'Table goods_locks created successfully.'; +END +ELSE +BEGIN + PRINT 'Table goods_locks already exists.'; +END +GO