diff options
author | thomascube <thomas@roundcube.net> | 2010-04-23 08:30:26 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2010-04-23 08:30:26 +0000 |
commit | 084f224d2ac8e9b1484f121865c7b5f292813317 (patch) | |
tree | 5c8964a2516bc2c1be2c943a27f0bc1abd1cc038 | |
parent | dd0f19654ef3f30691c54527ec6bb0c827dc0aa3 (diff) |
Apply changes from r3542 to release branchv0.4-beta@3548
-rw-r--r-- | SQL/mssql.initial.sql | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql index 9451dc545..4891ad733 100644 --- a/SQL/mssql.initial.sql +++ b/SQL/mssql.initial.sql @@ -209,7 +209,7 @@ ALTER TABLE [dbo].[identities] ADD CHECK ([del] = '1' or [del] = '0')
GO
- CREATE INDEX [IX_identities_user_id] ON [dbo].[identities]([user_id]) ON [PRIMARY]
+CREATE INDEX [IX_identities_user_id] ON [dbo].[identities]([user_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[messages] ADD
@@ -227,16 +227,16 @@ ALTER TABLE [dbo].[messages] ADD CONSTRAINT [DF_messages_size] DEFAULT (0) FOR [size]
GO
- CREATE INDEX [IX_messages_user_id] ON [dbo].[messages]([user_id]) ON [PRIMARY]
+CREATE INDEX [IX_messages_user_id] ON [dbo].[messages]([user_id]) ON [PRIMARY]
GO
- CREATE INDEX [IX_messages_cache_key] ON [dbo].[messages]([cache_key]) ON [PRIMARY]
+CREATE INDEX [IX_messages_cache_key] ON [dbo].[messages]([cache_key]) ON [PRIMARY]
GO
- CREATE INDEX [IX_messages_uid] ON [dbo].[messages]([uid]) ON [PRIMARY]
+CREATE INDEX [IX_messages_uid] ON [dbo].[messages]([uid]) ON [PRIMARY]
GO
- CREATE INDEX [IX_messages_created] ON [dbo].[messages]([created]) ON [PRIMARY]
+CREATE INDEX [IX_messages_created] ON [dbo].[messages]([created]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[session] ADD
@@ -245,7 +245,7 @@ ALTER TABLE [dbo].[session] ADD CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip]
GO
- CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]
+CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[users] ADD
@@ -255,9 +255,44 @@ ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_created] DEFAULT (getdate()) FOR [created]
GO
- CREATE INDEX [IX_users_username] ON [dbo].[users]([username]) ON [PRIMARY]
+CREATE INDEX [IX_users_username] ON [dbo].[users]([username]) ON [PRIMARY]
GO
- CREATE INDEX [IX_users_alias] ON [dbo].[users]([alias]) ON [PRIMARY]
+CREATE INDEX [IX_users_alias] ON [dbo].[users]([alias]) ON [PRIMARY]
+GO
+
+ALTER TABLE [dbo].[identities] ADD
+ FOREIGN KEY ([FK_identities_user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[contacts] ADD
+ FOREIGN KEY ([FK_contacts_user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[contactgroups] ADD
+ FOREIGN KEY ([FK_contactgroups_user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[cache] ADD
+ FOREIGN KEY ([FK_cache_user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[messages] ADD
+ FOREIGN KEY ([FK_messages_user_id]) REFERENCES [dbo].[users] ([user_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[contactgroupmembers] ADD
+ FOREIGN KEY ([FK_contactgroupmembers_contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
+GO
+
+ALTER TABLE [dbo].[contactgroupmembers] ADD
+ FOREIGN KEY ([FK_contactgroupmembers_contact_id]) REFERENCES [dbo].[contacts] ([contact_id])
+ ON DELETE CASCADE ON UPDATE CASCADE
GO
|