summaryrefslogtreecommitdiff
path: root/SQL/mssql.upgrade.sql
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-09-06 16:35:14 +0000
committeralecpl <alec@alec.pl>2011-09-06 16:35:14 +0000
commitf8e48df71540b268ceac058d32b8ee848fc2ab6b (patch)
treed2e8ea19086014e8a89f761a9444e72d84145164 /SQL/mssql.upgrade.sql
parent66df084203a217ab74a416064c459cc3420a648c (diff)
- Merge devel-saved_search branch (Addressbook Saved Searches)
Diffstat (limited to 'SQL/mssql.upgrade.sql')
-rw-r--r--SQL/mssql.upgrade.sql30
1 files changed, 30 insertions, 0 deletions
diff --git a/SQL/mssql.upgrade.sql b/SQL/mssql.upgrade.sql
index a77362ac4..258b1d78a 100644
--- a/SQL/mssql.upgrade.sql
+++ b/SQL/mssql.upgrade.sql
@@ -121,3 +121,33 @@ CREATE TABLE [dbo].[dictionary] (
GO
CREATE UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) ON [PRIMARY]
GO
+
+CREATE TABLE [dbo].[searches] (
+ [search_id] [int] IDENTITY (1, 1) NOT NULL ,
+ [user_id] [int] NOT NULL ,
+ [type] [tinyint] NOT NULL ,
+ [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
+ [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+GO
+
+ALTER TABLE [dbo].[searches] WITH NOCHECK ADD
+ CONSTRAINT [PK_searches_search_id] PRIMARY KEY CLUSTERED
+ (
+ [search_id]
+ ) ON [PRIMARY]
+GO
+
+ALTER TABLE [dbo].[searches] ADD
+ CONSTRAINT [DF_searches_user] DEFAULT (0) FOR [user_id],
+ CONSTRAINT [DF_searches_type] DEFAULT (0) FOR [type],
+GO
+
+CREATE UNIQUE INDEX [IX_searches_user_type_name] ON [dbo].[searches]([user_id],[type],[name]) ON [PRIMARY]
+GO
+
+ALTER TABLE [dbo].[searches] ADD CONSTRAINT [FK_searches_user_id]
+ FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+