diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql index b3bb1c8b8..a8d1a0b89 100644 --- a/SQL/mssql.initial.sql +++ b/SQL/mssql.initial.sql @@ -210,7 +210,8 @@ CREATE INDEX [IX_cache_created] ON [dbo].[cache]([created]) ON [PRIMARY] GO ALTER TABLE [dbo].[cache_index] ADD - CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed] + CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed], + CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid] GO CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY] @@ -224,7 +225,7 @@ CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [P GO ALTER TABLE [dbo].[cache_messages] ADD - CONSTRAINT [DF_cache_messages_changed] DEFAULT (getdate()) FOR [changed] + CONSTRAINT [DF_cache_messages_changed] DEFAULT (getdate()) FOR [changed], CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags], GO diff --git a/SQL/mssql.upgrade.sql b/SQL/mssql.upgrade.sql index 3def890bd..b506e5d96 100644 --- a/SQL/mssql.upgrade.sql +++ b/SQL/mssql.upgrade.sql @@ -157,6 +157,7 @@ CREATE TABLE [dbo].[cache_index] ( [user_id] [int] NOT NULL , [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , [changed] [datetime] NOT NULL , + [valid] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL , [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -201,7 +202,8 @@ ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD GO ALTER TABLE [dbo].[cache_index] ADD - CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed] + CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed], + CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid] GO CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY] diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index 7e8f98f03..6181622e7 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -177,6 +177,7 @@ CREATE TABLE `cache_index` ( `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', `mailbox` varchar(255) BINARY NOT NULL, `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `valid` tinyint(1) NOT NULL DEFAULT '0', `data` longtext NOT NULL, CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE, diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql index 741495fbe..7e650af7a 100644 --- a/SQL/postgres.update.sql +++ b/SQL/postgres.update.sql @@ -135,6 +135,7 @@ CREATE TABLE cache_index ( REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, mailbox varchar(255) NOT NULL, changed timestamp with time zone DEFAULT now() NOT NULL, + valid smallint NOT NULL DEFAULT 0, data text NOT NULL, PRIMARY KEY (user_id, mailbox) ); diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql index 6f009754e..f7fd168af 100644 --- a/SQL/sqlite.update.sql +++ b/SQL/sqlite.update.sql @@ -254,6 +254,7 @@ CREATE TABLE cache_index ( user_id integer NOT NULL, mailbox varchar(255) NOT NULL, changed datetime NOT NULL default '0000-00-00 00:00:00', + valid smallint NOT NULL DEFAULT '0', data text NOT NULL, PRIMARY KEY (user_id, mailbox) );