"Fossies" - the Fresh Open Source Software Archive

Member "roundcubemail-1.4.2/SQL/mssql/2011092800.sql" (1 Jan 2020, 3958 Bytes) of package /linux/www/roundcubemail-1.4.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PL/SQL source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 -- Updates from version 0.6
    2 
    3 CREATE TABLE [dbo].[dictionary] (
    4     [user_id] [int] ,
    5     [language] [varchar] (5) COLLATE Latin1_General_CI_AI NOT NULL ,
    6     [data] [text] COLLATE Latin1_General_CI_AI NOT NULL 
    7 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    8 GO
    9 CREATE  UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) ON [PRIMARY]
   10 GO
   11 
   12 CREATE TABLE [dbo].[searches] (
   13     [search_id] [int] IDENTITY (1, 1) NOT NULL ,
   14     [user_id] [int] NOT NULL ,
   15     [type] [tinyint] NOT NULL ,
   16     [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
   17     [data] [text] COLLATE Latin1_General_CI_AI NOT NULL 
   18 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
   19 GO
   20 
   21 ALTER TABLE [dbo].[searches] WITH NOCHECK ADD 
   22     CONSTRAINT [PK_searches_search_id] PRIMARY KEY CLUSTERED 
   23     (
   24         [search_id]
   25     ) ON [PRIMARY] 
   26 GO
   27 
   28 ALTER TABLE [dbo].[searches] ADD 
   29     CONSTRAINT [DF_searches_user] DEFAULT (0) FOR [user_id],
   30     CONSTRAINT [DF_searches_type] DEFAULT (0) FOR [type],
   31 GO
   32 
   33 CREATE UNIQUE INDEX [IX_searches_user_type_name] ON [dbo].[searches]([user_id],[type],[name]) ON [PRIMARY]
   34 GO
   35 
   36 ALTER TABLE [dbo].[searches] ADD CONSTRAINT [FK_searches_user_id]
   37     FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
   38     ON DELETE CASCADE ON UPDATE CASCADE
   39 GO
   40 
   41 DROP TABLE [dbo].[messages]
   42 GO
   43 CREATE TABLE [dbo].[cache_index] (
   44     [user_id] [int] NOT NULL ,
   45     [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
   46     [changed] [datetime] NOT NULL ,
   47     [valid] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
   48     [data] [text] COLLATE Latin1_General_CI_AI NOT NULL 
   49 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
   50 GO
   51 
   52 CREATE TABLE [dbo].[cache_thread] (
   53     [user_id] [int] NOT NULL ,
   54     [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
   55     [changed] [datetime] NOT NULL ,
   56     [data] [text] COLLATE Latin1_General_CI_AI NOT NULL 
   57 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
   58 GO
   59 
   60 CREATE TABLE [dbo].[cache_messages] (
   61     [user_id] [int] NOT NULL ,
   62     [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
   63     [uid] [int] NOT NULL ,
   64     [changed] [datetime] NOT NULL ,
   65     [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,
   66     [flags] [int] NOT NULL
   67 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
   68 GO
   69 
   70 ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD 
   71      PRIMARY KEY CLUSTERED 
   72     (
   73         [user_id],[mailbox]
   74     ) ON [PRIMARY] 
   75 GO
   76 
   77 ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD 
   78      PRIMARY KEY CLUSTERED 
   79     (
   80         [user_id],[mailbox]
   81     ) ON [PRIMARY] 
   82 GO
   83 
   84 ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD 
   85      PRIMARY KEY CLUSTERED 
   86     (
   87         [user_id],[mailbox],[uid]
   88     ) ON [PRIMARY] 
   89 GO
   90 
   91 ALTER TABLE [dbo].[cache_index] ADD 
   92     CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed],
   93     CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid]
   94 GO
   95 
   96 CREATE  INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY]
   97 GO
   98 
   99 ALTER TABLE [dbo].[cache_thread] ADD 
  100     CONSTRAINT [DF_cache_thread_changed] DEFAULT (getdate()) FOR [changed]
  101 GO
  102 
  103 CREATE  INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]
  104 GO
  105 
  106 ALTER TABLE [dbo].[cache_messages] ADD 
  107     CONSTRAINT [DF_cache_messages_changed] DEFAULT (getdate()) FOR [changed],
  108     CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]
  109 GO
  110 
  111 CREATE  INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]
  112 GO
  113 
  114 ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]
  115     FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
  116     ON DELETE CASCADE ON UPDATE CASCADE
  117 GO
  118 
  119 ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]
  120     FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
  121     ON DELETE CASCADE ON UPDATE CASCADE
  122 GO
  123 
  124 ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]
  125     FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
  126     ON DELETE CASCADE ON UPDATE CASCADE
  127 GO