diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-09-11 12:01:03 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-09-11 12:01:03 +0300 |
commit | 019801a430e27c95d03cbb24fc233ec22e692500 (patch) | |
tree | cbb783c8abbdec870b1f2dd49c1dbcde2fc9f99a | |
parent | 2847154cd0b11d4dead83507b8b272d8509d9aaa (diff) |
Removed support for MS SQL Server and Oracle (#7854)
55 files changed, 6 insertions, 2346 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 90b6946c2..d7d7dfd48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Removed support for MS SQL Server and Oracle (#7854) - Advanced mail search syntax with more possibilities (without UI) (#8502) - Support for HAproxy protocol header in IMAP connections (#8625) - Enigma: Support Kolab's Web Of Anti-Trust feature (#8626) @@ -27,8 +27,7 @@ REQUIREMENTS - suhosin.session.encrypt disabled - mbstring.func_overload disabled - pcre.backtrack_limit >= 100000 -* A MySQL, PostgreSQL, MS SQL Server (2005 or newer), Oracle database - or SQLite v3 support in PHP - with permission to create tables +* A MySQL, PostgreSQL, or SQLite v3 support in PHP - with permission to create tables * Composer installed either locally or globally (https://getcomposer.org) @@ -143,12 +142,6 @@ Now you can run the Installer or configure the database access options in 'config/config.inc.php' and run: `bin/initdb.sh --dir=SQL`. -* Microsoft SQL Server ----------------------- -Language/locale of the database must be set to us_english (1033). More info -on this at https://github.com/roundcube/roundcubemail/issues/4078. - - Database cleaning ----------------- To keep your database slick and clean we recommend to periodically execute diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql deleted file mode 100644 index b49a1eae7..000000000 --- a/SQL/mssql.initial.sql +++ /dev/null @@ -1,491 +0,0 @@ -CREATE TABLE [dbo].[cache] (
- [user_id] [int] NOT NULL ,
- [cache_key] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,
- [expires] [datetime] NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[cache_shared] (
- [cache_key] [varchar] (255) COLLATE Latin1_General_CS_AS NOT NULL ,
- [expires] [datetime] NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[cache_index] (
- [user_id] [int] NOT NULL ,
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,
- [expires] [datetime] 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
-
-CREATE TABLE [dbo].[cache_thread] (
- [user_id] [int] NOT NULL ,
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,
- [expires] [datetime] NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[cache_messages] (
- [user_id] [int] NOT NULL ,
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,
- [uid] [int] NOT NULL ,
- [expires] [datetime] NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,
- [flags] [int] NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[collected_addresses] (
- [address_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [type] [int] NOT NULL
-) ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[contacts] (
- [contact_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [email] [varchar] (8000) COLLATE Latin1_General_CI_AI NOT NULL ,
- [firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [vcard] [text] COLLATE Latin1_General_CI_AI NULL ,
- [words] [text] COLLATE Latin1_General_CI_AI NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[contactgroups] (
- [contactgroup_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[contactgroupmembers] (
- [contactgroup_id] [int] NOT NULL ,
- [contact_id] [int] NOT NULL ,
- [created] [datetime] NOT NULL
-) ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[identities] (
- [identity_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [standard] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [organization] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [email] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [reply-to] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [bcc] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [signature] [text] COLLATE Latin1_General_CI_AI NULL,
- [html_signature] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[responses] (
- [response_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL,
- [is_html] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[session] (
- [sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [changed] [datetime] NULL ,
- [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL ,
- [vars] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[users] (
- [user_id] [int] IDENTITY (1, 1) NOT NULL ,
- [username] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,
- [mail_host] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [created] [datetime] NOT NULL ,
- [last_login] [datetime] NULL ,
- [failed_login] [datetime] NULL ,
- [failed_login_counter] [int] NULL ,
- [language] [varchar] (16) COLLATE Latin1_General_CI_AI NULL ,
- [preferences] [text] COLLATE Latin1_General_CI_AI NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[dictionary] (
- [user_id] [int] ,
- [language] [varchar] (16) COLLATE Latin1_General_CI_AI NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_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
-
-CREATE TABLE [dbo].[filestore] (
- [file_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [context] [varchar] (32) COLLATE Latin1_General_CI_AI NOT NULL ,
- [filename] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [mtime] [int] NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NULL ,
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[system] (
- [name] [varchar] (64) COLLATE Latin1_General_CI_AI NOT NULL ,
- [value] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[cache_key]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [cache_key]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox],[uid]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[collected_addresses] WITH NOCHECK ADD
- CONSTRAINT [PK_collected_addresses_address_id] PRIMARY KEY CLUSTERED
- (
- [address_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contacts] WITH NOCHECK ADD
- CONSTRAINT [PK_contacts_contact_id] PRIMARY KEY CLUSTERED
- (
- [contact_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroups] WITH NOCHECK ADD
- CONSTRAINT [PK_contactgroups_contactgroup_id] PRIMARY KEY CLUSTERED
- (
- [contactgroup_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] WITH NOCHECK ADD
- CONSTRAINT [PK_contactgroupmembers_id] PRIMARY KEY CLUSTERED
- (
- [contactgroup_id], [contact_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[identities] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [identity_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[responses] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [response_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[session] WITH NOCHECK ADD
- CONSTRAINT [PK_session_sess_id] PRIMARY KEY CLUSTERED
- (
- [sess_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[users] WITH NOCHECK ADD
- CONSTRAINT [PK_users_user_id] PRIMARY KEY CLUSTERED
- (
- [user_id]
- ) 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].[filestore] WITH NOCHECK ADD
- CONSTRAINT [PK_filestore_file_id] PRIMARY KEY CLUSTERED
- (
- [file_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[system] WITH NOCHECK ADD
- CONSTRAINT [PK_system_name] PRIMARY KEY CLUSTERED
- (
- [name]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache] ADD
- CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],
- CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key]
-GO
-
-ALTER TABLE [dbo].[cache_index] ADD
- CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid]
-GO
-
-ALTER TABLE [dbo].[cache_messages] ADD
- CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]
-GO
-
-CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_index_expires] ON [dbo].[cache_index]([expires]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_thread_expires] ON [dbo].[cache_thread]([expires]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_messages_expires] ON [dbo].[cache_messages]([expires]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[collected_addresses] ADD
- CONSTRAINT [DF_collected_addresses_user_id] DEFAULT (0) FOR [user_id],
- CONSTRAINT [DF_collected_addresses_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_collected_addresses_name] DEFAULT ('') FOR [name]
-GO
-
-CREATE UNIQUE INDEX [IX_collected_addresses_user_id] ON [dbo].[collected_addresses]([user_id],[type],[email]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contacts] ADD
- CONSTRAINT [DF_contacts_user_id] DEFAULT (0) FOR [user_id],
- CONSTRAINT [DF_contacts_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_contacts_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_contacts_name] DEFAULT ('') FOR [name],
- CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email],
- CONSTRAINT [DF_contacts_firstname] DEFAULT ('') FOR [firstname],
- CONSTRAINT [DF_contacts_surname] DEFAULT ('') FOR [surname],
- CONSTRAINT [CK_contacts_del] CHECK ([del] = '1' or [del] = '0')
-GO
-
-CREATE INDEX [IX_contacts_user_id] ON [dbo].[contacts]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroups] ADD
- CONSTRAINT [DF_contactgroups_user_id] DEFAULT (0) FOR [user_id],
- CONSTRAINT [DF_contactgroups_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_contactgroups_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_contactgroups_name] DEFAULT ('') FOR [name],
- CONSTRAINT [CK_contactgroups_del] CHECK ([del] = '1' or [del] = '0')
-GO
-
-CREATE INDEX [IX_contactgroups_user_id] ON [dbo].[contactgroups]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] ADD
- CONSTRAINT [DF_contactgroupmembers_contactgroup_id] DEFAULT (0) FOR [contactgroup_id],
- CONSTRAINT [DF_contactgroupmembers_contact_id] DEFAULT (0) FOR [contact_id],
- CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created]
-GO
-
-CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[identities] ADD
- CONSTRAINT [DF_identities_user] DEFAULT ('0') FOR [user_id],
- CONSTRAINT [DF_identities_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_identities_standard] DEFAULT ('0') FOR [standard],
- CONSTRAINT [DF_identities_name] DEFAULT ('') FOR [name],
- CONSTRAINT [DF_identities_organization] DEFAULT ('') FOR [organization],
- CONSTRAINT [DF_identities_email] DEFAULT ('') FOR [email],
- CONSTRAINT [DF_identities_reply] DEFAULT ('') FOR [reply-to],
- CONSTRAINT [DF_identities_bcc] DEFAULT ('') FOR [bcc],
- CONSTRAINT [DF_identities_html_signature] DEFAULT ('0') FOR [html_signature],
- CHECK ([standard] = '1' or [standard] = '0'),
- CHECK ([del] = '1' or [del] = '0')
-GO
-
-CREATE INDEX [IX_identities_user_id] ON [dbo].[identities]([user_id]) ON [PRIMARY]
-GO
-CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[responses] ADD
- CONSTRAINT [DF_responses_user] DEFAULT ('0') FOR [user_id],
- CONSTRAINT [DF_responses_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_responses_is_html] DEFAULT ('0') FOR [is_html],
- CHECK ([del] = '1' or [del] = '0'),
- CHECK ([is_html] = '1' or [is_html] = '0')
-GO
-
-CREATE INDEX [IX_responses_user_id] ON [dbo].[responses]([user_id]) ON [PRIMARY]
-GO
-ALTER TABLE [dbo].[session] ADD
- CONSTRAINT [DF_session_sess_id] DEFAULT ('') FOR [sess_id],
- CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip]
-GO
-
-CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_filestore_user_id] ON [dbo].[filestore]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[users] ADD
- CONSTRAINT [DF_users_username] DEFAULT ('') FOR [username],
- CONSTRAINT [DF_users_mail_host] DEFAULT ('') FOR [mail_host],
- CONSTRAINT [DF_users_created] DEFAULT (getdate()) FOR [created]
-GO
-
-CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) ON [PRIMARY]
-GO
-
-CREATE UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) 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
-
-CREATE UNIQUE INDEX [IX_filestore_user_id_context_filename] ON [dbo].[filestore]([user_id],[context],[filename]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[identities] ADD CONSTRAINT [FK_identities_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[responses] ADD CONSTRAINT [FK_responses_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[collected_addresses] ADD CONSTRAINT [FK_collected_addresses_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [FK_contacts_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache] ADD CONSTRAINT [FK_cache_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contactgroup_id]
- FOREIGN KEY ([contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-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
-
-ALTER TABLE [dbo].[filestore] ADD CONSTRAINT [FK_filestore_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
--- Use trigger instead of foreign key (#1487112)
--- "Introducing FOREIGN KEY constraint ... may cause cycles or multiple cascade paths."
-CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]
- AFTER DELETE AS
- DELETE FROM [dbo].[contactgroupmembers]
- WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)
-GO
-
-INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2022081200')
-GO
-
\ No newline at end of file diff --git a/SQL/mssql/2009103100.sql b/SQL/mssql/2009103100.sql deleted file mode 100644 index 646fe38af..000000000 --- a/SQL/mssql/2009103100.sql +++ /dev/null @@ -1,87 +0,0 @@ --- Updates from version 0.3.1
-
-ALTER TABLE [dbo].[messages] ADD CONSTRAINT [FK_messages_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache] ADD CONSTRAINT [FK_cache_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [FK_contacts_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[identities] ADD CONSTRAINT [FK_identities_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[identities] ADD [changed] [datetime] NULL
-GO
-
-CREATE TABLE [dbo].[contactgroups] (
- [contactgroup_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[contactgroupmembers] (
- [contactgroup_id] [int] NOT NULL ,
- [contact_id] [int] NOT NULL ,
- [created] [datetime] NOT NULL
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroups] WITH NOCHECK ADD
- CONSTRAINT [PK_contactgroups_contactgroup_id] PRIMARY KEY CLUSTERED
- (
- [contactgroup_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] WITH NOCHECK ADD
- CONSTRAINT [PK_contactgroupmembers_id] PRIMARY KEY CLUSTERED
- (
- [contactgroup_id], [contact_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroups] ADD
- CONSTRAINT [DF_contactgroups_user_id] DEFAULT (0) FOR [user_id],
- CONSTRAINT [DF_contactgroups_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_contactgroups_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_contactgroups_name] DEFAULT ('') FOR [name],
- CONSTRAINT [CK_contactgroups_del] CHECK ([del] = '1' or [del] = '0')
-GO
-
-CREATE INDEX [IX_contactgroups_user_id] ON [dbo].[contacts]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] ADD
- CONSTRAINT [DF_contactgroupmembers_contactgroup_id] DEFAULT (0) FOR [contactgroup_id],
- CONSTRAINT [DF_contactgroupmembers_contact_id] DEFAULT (0) FOR [contact_id],
- CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created]
-GO
-
-ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contactgroup_id]
- FOREIGN KEY ([contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]
- AFTER DELETE AS
- DELETE FROM [dbo].[contactgroupmembers]
- WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)
-GO
-
-ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
diff --git a/SQL/mssql/2010100600.sql b/SQL/mssql/2010100600.sql deleted file mode 100644 index fb045e303..000000000 --- a/SQL/mssql/2010100600.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Updates from version 0.4.2
-
-DROP INDEX [IX_users_username]
-GO
-CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) ON [PRIMARY]
-GO
-ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL
-GO
-
\ No newline at end of file diff --git a/SQL/mssql/2011011200.sql b/SQL/mssql/2011011200.sql deleted file mode 100644 index 8715455df..000000000 --- a/SQL/mssql/2011011200.sql +++ /dev/null @@ -1,10 +0,0 @@ --- Updates from version 0.5.x
-
-ALTER TABLE [dbo].[contacts] ADD [words] [text] COLLATE Latin1_General_CI_AI NULL
-GO
-CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY]
-GO
-DELETE FROM [dbo].[messages]
-GO
-DELETE FROM [dbo].[cache]
-GO
diff --git a/SQL/mssql/2011092800.sql b/SQL/mssql/2011092800.sql deleted file mode 100644 index 00f79bbc0..000000000 --- a/SQL/mssql/2011092800.sql +++ /dev/null @@ -1,127 +0,0 @@ --- Updates from version 0.6
-
-CREATE TABLE [dbo].[dictionary] (
- [user_id] [int] ,
- [language] [varchar] (5) COLLATE Latin1_General_CI_AI NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-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
-
-DROP TABLE [dbo].[messages]
-GO
-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
-
-CREATE TABLE [dbo].[cache_thread] (
- [user_id] [int] NOT NULL ,
- [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE TABLE [dbo].[cache_messages] (
- [user_id] [int] NOT NULL ,
- [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [uid] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,
- [flags] [int] NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [user_id],[mailbox],[uid]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_index] ADD
- 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]
-GO
-
-ALTER TABLE [dbo].[cache_thread] ADD
- CONSTRAINT [DF_cache_thread_changed] DEFAULT (getdate()) FOR [changed]
-GO
-
-CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_messages] ADD
- CONSTRAINT [DF_cache_messages_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]
-GO
-
-CREATE INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
-ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
diff --git a/SQL/mssql/2011111600.sql b/SQL/mssql/2011111600.sql deleted file mode 100644 index 387877604..000000000 --- a/SQL/mssql/2011111600.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Updates from version 0.7-beta
-
-ALTER TABLE [dbo].[session] ALTER COLUMN [sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL
-GO
diff --git a/SQL/mssql/2011121400.sql b/SQL/mssql/2011121400.sql deleted file mode 100644 index fde63ea79..000000000 --- a/SQL/mssql/2011121400.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Updates from version 0.7
-
-ALTER TABLE [dbo].[contacts] DROP CONSTRAINT [DF_contacts_email]
-GO
-ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [text] COLLATE Latin1_General_CI_AI NOT NULL
-GO
-ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email]
-GO
-
\ No newline at end of file diff --git a/SQL/mssql/2012051800.sql b/SQL/mssql/2012051800.sql deleted file mode 100644 index 8dcf7bfc0..000000000 --- a/SQL/mssql/2012051800.sql +++ /dev/null @@ -1,18 +0,0 @@ --- Updates from version 0.8-rc
-
-ALTER TABLE [dbo].[contacts] DROP CONSTRAINT [DF_contacts_email]
-GO
-ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [varchar] (8000) COLLATE Latin1_General_CI_AI NOT NULL
-GO
-ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email]
-GO
-
--- Updates from version 0.8
-
-ALTER TABLE [dbo].[cache] DROP COLUMN [cache_id]
-GO
-ALTER TABLE [dbo].[users] DROP COLUMN [alias]
-GO
-CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]
-GO
-
\ No newline at end of file diff --git a/SQL/mssql/2012080700.sql b/SQL/mssql/2012080700.sql deleted file mode 100644 index 33e6133b3..000000000 --- a/SQL/mssql/2012080700.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Updates from version 0.8
-
-ALTER TABLE [dbo].[cache] DROP COLUMN [cache_id]
-GO
-ALTER TABLE [dbo].[users] DROP COLUMN [alias]
-GO
-CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]
-GO
diff --git a/SQL/mssql/2013011000.sql b/SQL/mssql/2013011000.sql deleted file mode 100644 index 2eb51e6b5..000000000 --- a/SQL/mssql/2013011000.sql +++ /dev/null @@ -1,14 +0,0 @@ --- Upgrades from 0.9-beta - -CREATE TABLE [dbo].[system] (
- [name] [varchar] (64) COLLATE Latin1_General_CI_AI NOT NULL ,
- [value] [text] COLLATE Latin1_General_CI_AI
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[system] WITH NOCHECK ADD
- CONSTRAINT [PK_system_name] PRIMARY KEY CLUSTERED
- (
- [name]
- ) ON [PRIMARY]
-GO
diff --git a/SQL/mssql/2013042700.sql b/SQL/mssql/2013042700.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/mssql/2013042700.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/mssql/2013052500.sql b/SQL/mssql/2013052500.sql deleted file mode 100644 index 6a7e31d46..000000000 --- a/SQL/mssql/2013052500.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE [dbo].[cache_shared] (
- [cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [created] [datetime] NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[cache_shared] ADD
- CONSTRAINT [DF_cache_shared_created] DEFAULT (getdate()) FOR [created]
-GO
-
-CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_shared_created] ON [dbo].[cache_shared]([created]) ON [PRIMARY]
-GO
-
diff --git a/SQL/mssql/2013061000.sql b/SQL/mssql/2013061000.sql deleted file mode 100644 index 5e8b791f1..000000000 --- a/SQL/mssql/2013061000.sql +++ /dev/null @@ -1,44 +0,0 @@ -ALTER TABLE [dbo].[cache] ADD [expires] [datetime] NULL
-GO
-ALTER TABLE [dbo].[cache_shared] ADD [expires] [datetime] NULL
-GO
-ALTER TABLE [dbo].[cache_index] ADD [expires] [datetime] NULL
-GO
-ALTER TABLE [dbo].[cache_thread] ADD [expires] [datetime] NULL
-GO
-ALTER TABLE [dbo].[cache_messages] ADD [expires] [datetime] NULL
-GO
-
-UPDATE [dbo].[cache] SET [expires] = DATEADD(second, 604800, [created])
-GO
-UPDATE [dbo].[cache_shared] SET [expires] = DATEADD(second, 604800, [created])
-GO
-UPDATE [dbo].[cache_index] SET [expires] = DATEADD(second, 604800, [changed])
-GO
-UPDATE [dbo].[cache_thread] SET [expires] = DATEADD(second, 604800, [changed])
-GO
-UPDATE [dbo].[cache_messages] SET [expires] = DATEADD(second, 604800, [changed])
-GO
-
-DROP INDEX [IX_cache_created]
-GO
-DROP INDEX [IX_cache_shared_created]
-GO
-ALTER TABLE [dbo].[cache_index] DROP COLUMN [changed]
-GO
-ALTER TABLE [dbo].[cache_thread] DROP COLUMN [changed]
-GO
-ALTER TABLE [dbo].[cache_messages] DROP COLUMN [changed]
-GO
-
-CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]
-GO
-CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]
-GO
-CREATE INDEX [IX_cache_index_expires] ON [dbo].[cache_index]([expires]) ON [PRIMARY]
-GO
-CREATE INDEX [IX_cache_thread_expires] ON [dbo].[cache_thread]([expires]) ON [PRIMARY]
-GO
-CREATE INDEX [IX_cache_messages_expires] ON [dbo].[cache_messages]([expires]) ON [PRIMARY]
-GO
-
\ No newline at end of file diff --git a/SQL/mssql/2014042900.sql b/SQL/mssql/2014042900.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/mssql/2014042900.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/mssql/2015030800.sql b/SQL/mssql/2015030800.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/mssql/2015030800.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/mssql/2015111100.sql b/SQL/mssql/2015111100.sql deleted file mode 100644 index 11c9da3c3..000000000 --- a/SQL/mssql/2015111100.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE [dbo].[users] ADD [failed_login] [datetime] NULL
-GO
-ALTER TABLE [dbo].[users] ADD [failed_login_counter] [int] NULL
-GO
diff --git a/SQL/mssql/2016081200.sql b/SQL/mssql/2016081200.sql deleted file mode 100644 index 8a089443e..000000000 --- a/SQL/mssql/2016081200.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE [dbo].[session] DROP CONSTRAINT [DF_session_created]
-GO
-
-ALTER TABLE [dbo].[session] DROP COLUMN [created]
-GO
diff --git a/SQL/mssql/2016100900.sql b/SQL/mssql/2016100900.sql deleted file mode 100644 index 38b359a48..000000000 --- a/SQL/mssql/2016100900.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE [dbo].[session] ALTER COLUMN [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL -GO diff --git a/SQL/mssql/2016112200.sql b/SQL/mssql/2016112200.sql deleted file mode 100644 index 302a3ae16..000000000 --- a/SQL/mssql/2016112200.sql +++ /dev/null @@ -1,36 +0,0 @@ -DROP TABLE [dbo].[cache] -GO -DROP TABLE [dbo].[cache_shared] -GO - -CREATE TABLE [dbo].[cache] ( - [user_id] [int] NOT NULL , - [cache_key] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , - [expires] [datetime] NULL , - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO -CREATE TABLE [dbo].[cache_shared] ( - [cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL , - [expires] [datetime] NULL , - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO -ALTER TABLE [dbo].[cache] ADD - CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id], - CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key] -GO -CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY] -GO -CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY] -GO -ALTER TABLE [dbo].[cache] WITH NOCHECK ADD - PRIMARY KEY CLUSTERED ( - [user_id],[cache_key] - ) ON [PRIMARY] -GO -ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD - PRIMARY KEY CLUSTERED ( - [cache_key] - ) ON [PRIMARY] -GO diff --git a/SQL/mssql/2018021600.sql b/SQL/mssql/2018021600.sql deleted file mode 100644 index dae515d77..000000000 --- a/SQL/mssql/2018021600.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE [dbo].[filestore] (
- [file_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [filename] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [mtime] [int] NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NULL ,
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[filestore] WITH NOCHECK ADD
- CONSTRAINT [PK_filestore_file_id] PRIMARY KEY CLUSTERED
- (
- [file_id]
- ) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_filestore_user_id] ON [dbo].[filestore]([user_id]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[filestore] ADD CONSTRAINT [FK_filestore_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
diff --git a/SQL/mssql/2018122300.sql b/SQL/mssql/2018122300.sql deleted file mode 100644 index a4b295c9b..000000000 --- a/SQL/mssql/2018122300.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TABLE [dbo].[filestore] ADD [context] varchar(32) COLLATE Latin1_General_CI_AI NOT NULL
-GO
-
-UPDATE [dbo].[filestore] SET [context] = 'enigma'
-GO
-
-CREATE UNIQUE INDEX [IX_filestore_user_id_context_filename] ON [dbo].[filestore]([user_id],[context],[filename]) ON [PRIMARY]
-GO
-
diff --git a/SQL/mssql/2019092900.sql b/SQL/mssql/2019092900.sql deleted file mode 100644 index bebf01c95..000000000 --- a/SQL/mssql/2019092900.sql +++ /dev/null @@ -1,18 +0,0 @@ -ALTER TABLE [dbo].[cache] ALTER COLUMN
- [cache_key] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL
-GO
-ALTER TABLE [dbo].[cache_shared] ALTER COLUMN
- [cache_key] [varchar] (255) COLLATE Latin1_General_CS_AS NOT NULL
-GO
-ALTER TABLE [dbo].[cache_index] ALTER COLUMN
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL
-GO
-ALTER TABLE [dbo].[cache_messages] ALTER COLUMN
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL
-GO
-ALTER TABLE [dbo].[cache_thread] ALTER COLUMN
- [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL
-GO
-ALTER TABLE [dbo].[users] ALTER COLUMN
- [username] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL
-GO
diff --git a/SQL/mssql/2020020100.sql b/SQL/mssql/2020020100.sql deleted file mode 100644 index c5d059713..000000000 --- a/SQL/mssql/2020020100.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE [dbo].[users] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NULL
-GO
-ALTER TABLE [dbo].[dictionary] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NOT NULL
-GO
diff --git a/SQL/mssql/2020020101.sql b/SQL/mssql/2020020101.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/mssql/2020020101.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/mssql/2020091000.sql b/SQL/mssql/2020091000.sql deleted file mode 100644 index 202f9ef3f..000000000 --- a/SQL/mssql/2020091000.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE [dbo].[collected_addresses] (
- [address_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [type] [int] NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[collected_addresses] WITH NOCHECK ADD
- CONSTRAINT [PK_collected_addresses_address_id] PRIMARY KEY CLUSTERED
- (
- [address_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[collected_addresses] ADD
- CONSTRAINT [DF_collected_addresses_user_id] DEFAULT (0) FOR [user_id],
- CONSTRAINT [DF_collected_addresses_changed] DEFAULT (getdate()) FOR [changed],
- CONSTRAINT [DF_collected_addresses_name] DEFAULT ('') FOR [name],
-GO
-
-CREATE UNIQUE INDEX [IX_collected_addresses_user_id] ON [dbo].[collected_addresses]([user_id],[type],[email]) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[collected_addresses] ADD CONSTRAINT [FK_collected_addresses_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
diff --git a/SQL/mssql/2020122900.sql b/SQL/mssql/2020122900.sql deleted file mode 100644 index 73cbb589f..000000000 --- a/SQL/mssql/2020122900.sql +++ /dev/null @@ -1 +0,0 @@ ---empty
\ No newline at end of file diff --git a/SQL/mssql/2021081000.sql b/SQL/mssql/2021081000.sql deleted file mode 100644 index 4fa037c17..000000000 --- a/SQL/mssql/2021081000.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE [dbo].[responses] (
- [response_id] [int] IDENTITY (1, 1) NOT NULL ,
- [user_id] [int] NOT NULL ,
- [changed] [datetime] NOT NULL ,
- [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
- [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
- [data] [text] COLLATE Latin1_General_CI_AI NOT NULL,
- [is_html] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[responses] WITH NOCHECK ADD
- PRIMARY KEY CLUSTERED
- (
- [response_id]
- ) ON [PRIMARY]
-GO
-
-ALTER TABLE [dbo].[responses] ADD
- CONSTRAINT [DF_responses_user] DEFAULT ('0') FOR [user_id],
- CONSTRAINT [DF_responses_del] DEFAULT ('0') FOR [del],
- CONSTRAINT [DF_responses_is_html] DEFAULT ('0') FOR [is_html],
- CHECK ([del] = '1' or [del] = '0'),
- CHECK ([is_html] = '1' or [is_html] = '0')
-GO
-
-CREATE INDEX [IX_responses_user_id] ON [dbo].[responses]([user_id]) ON [PRIMARY]
-GO
-ALTER TABLE [dbo].[responses] ADD CONSTRAINT [FK_responses_user_id]
- FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
- ON DELETE CASCADE ON UPDATE CASCADE
-GO
-
diff --git a/SQL/mssql/2021100300.sql b/SQL/mssql/2021100300.sql deleted file mode 100644 index 49daeda32..000000000 --- a/SQL/mssql/2021100300.sql +++ /dev/null @@ -1 +0,0 @@ --- SQLite only
\ No newline at end of file diff --git a/SQL/mssql/2022081200.sql b/SQL/mssql/2022081200.sql deleted file mode 100644 index 105e39efb..000000000 --- a/SQL/mssql/2022081200.sql +++ /dev/null @@ -1 +0,0 @@ --- SQLite/Postgres only
\ No newline at end of file diff --git a/SQL/oracle.initial.sql b/SQL/oracle.initial.sql deleted file mode 100644 index 989681cf4..000000000 --- a/SQL/oracle.initial.sql +++ /dev/null @@ -1,288 +0,0 @@ --- Roundcube Webmail initial database structure --- This was tested with Oracle 11g - -CREATE TABLE "users" ( - "user_id" integer PRIMARY KEY, - "username" varchar(128) NOT NULL, - "mail_host" varchar(128) NOT NULL, - "created" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "last_login" timestamp with time zone DEFAULT NULL, - "failed_login" timestamp with time zone DEFAULT NULL, - "failed_login_counter" integer DEFAULT NULL, - "language" varchar(16), - "preferences" long DEFAULT NULL, - CONSTRAINT "users_username_key" UNIQUE ("username", "mail_host") -); - -CREATE SEQUENCE "users_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "users_seq_trig" -BEFORE INSERT ON "users" FOR EACH ROW -BEGIN - :NEW."user_id" := "users_seq".nextval; -END; -/ - -CREATE TABLE "session" ( - "sess_id" varchar(128) NOT NULL PRIMARY KEY, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "ip" varchar(41) NOT NULL, - "vars" long NOT NULL -); - -CREATE INDEX "session_changed_idx" ON "session" ("changed"); - - -CREATE TABLE "identities" ( - "identity_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "del" smallint DEFAULT 0 NOT NULL, - "standard" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) NOT NULL, - "organization" varchar(128), - "email" varchar(128) NOT NULL, - "reply-to" varchar(128), - "bcc" varchar(128), - "signature" long, - "html_signature" integer DEFAULT 0 NOT NULL -); - -CREATE INDEX "identities_user_id_idx" ON "identities" ("user_id", "del"); -CREATE INDEX "identities_email_idx" ON "identities" ("email", "del"); - -CREATE SEQUENCE "identities_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "identities_seq_trig" -BEFORE INSERT ON "identities" FOR EACH ROW -BEGIN - :NEW."identity_id" := "identities_seq".nextval; -END; -/ - - -CREATE TABLE "responses" ( - "response_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "del" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) NOT NULL, - "data" long NOT NULL, - "is_html" smallint DEFAULT 0 NOT NULL -); - -CREATE INDEX "responses_user_id_idx" ON "responses" ("user_id", "del"); - -CREATE SEQUENCE "responses_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "responses_seq_trig" -BEFORE INSERT ON "responses" FOR EACH ROW -BEGIN - :NEW."response_id" := "response_seq".nextval; -END; -/ - - -CREATE TABLE "collected_addresses" ( - "address_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "name" varchar(255) DEFAULT NULL, - "email" varchar(255) DEFAULT NULL, - "type" integer NOT NULL -); - -CREATE UNIQUE INDEX "collected_addresses_user_id_idx" ON "collected_addresses" ("user_id", "type", "email"); - -CREATE SEQUENCE "collected_addresses_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "collected_addresses_seq_trig" -BEFORE INSERT ON "collected_addresses" FOR EACH ROW -BEGIN - :NEW."address_id" := "collected_addresses_seq".nextval; -END; -/ - -CREATE TABLE "contacts" ( - "contact_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "del" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) DEFAULT NULL, - "email" varchar(4000) DEFAULT NULL, - "firstname" varchar(128) DEFAULT NULL, - "surname" varchar(128) DEFAULT NULL, - "vcard" long, - "words" varchar(4000) -); - -CREATE INDEX "contacts_user_id_idx" ON "contacts" ("user_id", "del"); - -CREATE SEQUENCE "contacts_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "contacts_seq_trig" -BEFORE INSERT ON "contacts" FOR EACH ROW -BEGIN - :NEW."contact_id" := "contacts_seq".nextval; -END; -/ - -CREATE TABLE "contactgroups" ( - "contactgroup_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "del" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) NOT NULL -); - -CREATE INDEX "contactgroups_user_id_idx" ON "contactgroups" ("user_id", "del"); - -CREATE SEQUENCE "contactgroups_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "contactgroups_seq_trig" -BEFORE INSERT ON "contactgroups" FOR EACH ROW -BEGIN - :NEW."contactgroup_id" := "contactgroups_seq".nextval; -END; -/ - -CREATE TABLE "contactgroupmembers" ( - "contactgroup_id" integer NOT NULL - REFERENCES "contactgroups" ("contactgroup_id") ON DELETE CASCADE, - "contact_id" integer NOT NULL - REFERENCES "contacts" ("contact_id") ON DELETE CASCADE, - "created" timestamp with time zone DEFAULT current_timestamp NOT NULL, - PRIMARY KEY ("contactgroup_id", "contact_id") -); - -CREATE INDEX "contactgroupmembers_idx" ON "contactgroupmembers" ("contact_id"); - - -CREATE TABLE "cache" ( - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "cache_key" varchar(128) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - PRIMARY KEY ("user_id", "cache_key") -); - -CREATE INDEX "cache_expires_idx" ON "cache" ("expires"); - - -CREATE TABLE "cache_shared" ( - "cache_key" varchar(255) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - PRIMARY KEY ("cache_key") -); - -CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires"); - - -CREATE TABLE "cache_index" ( - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "mailbox" varchar(255) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "valid" smallint DEFAULT 0 NOT NULL, - "data" long NOT NULL, - PRIMARY KEY ("user_id", "mailbox") -); - -CREATE INDEX "cache_index_expires_idx" ON "cache_index" ("expires"); - - -CREATE TABLE "cache_thread" ( - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "mailbox" varchar(255) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - PRIMARY KEY ("user_id", "mailbox") -); - -CREATE INDEX "cache_thread_expires_idx" ON "cache_thread" ("expires"); - - -CREATE TABLE "cache_messages" ( - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "mailbox" varchar(255) NOT NULL, - "uid" integer NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - "flags" integer DEFAULT 0 NOT NULL, - PRIMARY KEY ("user_id", "mailbox", "uid") -); - -CREATE INDEX "cache_messages_expires_idx" ON "cache_messages" ("expires"); - - -CREATE TABLE "dictionary" ( - "user_id" integer DEFAULT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "language" varchar(16) NOT NULL, - "data" long DEFAULT NULL, - CONSTRAINT "dictionary_user_id_lang_key" UNIQUE ("user_id", "language") -); - - -CREATE TABLE "searches" ( - "search_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "type" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) NOT NULL, - "data" long NOT NULL, - CONSTRAINT "searches_user_id_key" UNIQUE ("user_id", "type", "name") -); - -CREATE SEQUENCE "searches_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "searches_seq_trig" -BEFORE INSERT ON "searches" FOR EACH ROW -BEGIN - :NEW."search_id" := "searches_seq".nextval; -END; -/ - -CREATE TABLE "filestore" ( - "file_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE ON UPDATE CASCADE, - "context" varchar(32) NOT NULL, - "filename" varchar(128) NOT NULL, - "mtime" integer NOT NULL, - "data" long, - CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "context", "filename") -); - -CREATE SEQUENCE "filestore_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "filestore_seq_trig" -BEFORE INSERT ON "filestore" FOR EACH ROW -BEGIN - :NEW."user_id" := "filestore_seq".nextval; -END; -/ - -CREATE TABLE "system" ( - "name" varchar(64) NOT NULL PRIMARY KEY, - "value" long -); - -INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2022081200'); diff --git a/SQL/oracle/2015030800.sql b/SQL/oracle/2015030800.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/oracle/2015030800.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/oracle/2015111100.sql b/SQL/oracle/2015111100.sql deleted file mode 100644 index 010203f9f..000000000 --- a/SQL/oracle/2015111100.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "users" ADD "failed_login" timestamp with time zone DEFAULT NULL; -ALTER TABLE "users" ADD "failed_login_counter" integer DEFAULT NULL; diff --git a/SQL/oracle/2016081200.sql b/SQL/oracle/2016081200.sql deleted file mode 100644 index aacfe4186..000000000 --- a/SQL/oracle/2016081200.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "session" DROP COLUMN "created"; diff --git a/SQL/oracle/2016100900.sql b/SQL/oracle/2016100900.sql deleted file mode 100644 index 030f169e3..000000000 --- a/SQL/oracle/2016100900.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "session" MODIFY "ip" varchar(41) NOT NULL; diff --git a/SQL/oracle/2016112200.sql b/SQL/oracle/2016112200.sql deleted file mode 100644 index 3aab26510..000000000 --- a/SQL/oracle/2016112200.sql +++ /dev/null @@ -1,23 +0,0 @@ -DROP TABLE "cache"; -DROP TABLE "cache_shared"; - -CREATE TABLE "cache" ( - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "cache_key" varchar(128) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - PRIMARY KEY ("user_id", "cache_key") -); - -CREATE INDEX "cache_expires_idx" ON "cache" ("expires"); - - -CREATE TABLE "cache_shared" ( - "cache_key" varchar(255) NOT NULL, - "expires" timestamp with time zone DEFAULT NULL, - "data" long NOT NULL, - PRIMARY KEY ("cache_key") -); - -CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires"); diff --git a/SQL/oracle/2018021600.sql b/SQL/oracle/2018021600.sql deleted file mode 100644 index 2fe3bcd42..000000000 --- a/SQL/oracle/2018021600.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "filestore" ( - "file_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE ON UPDATE CASCADE, - "filename" varchar(128) NOT NULL, - "mtime" integer NOT NULL, - "data" long, - CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "filename") -); - -CREATE SEQUENCE "filestore_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "filestore_seq_trig" -BEFORE INSERT ON "filestore" FOR EACH ROW -BEGIN - :NEW."user_id" := "filestore_seq".nextval; -END; -/ diff --git a/SQL/oracle/2018122300.sql b/SQL/oracle/2018122300.sql deleted file mode 100644 index dd75dfc82..000000000 --- a/SQL/oracle/2018122300.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "filestore" ADD COLUMN "context" varchar(32) NOT NULL; -UPDATE "filestore" SET "context" = 'enigma'; -ALTER TABLE "filestore" DROP CONSTRAINT "filestore_user_id_key"; -ALTER TABLE "filestore" ADD CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "context", "filename"); diff --git a/SQL/oracle/2019092900.sql b/SQL/oracle/2019092900.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/oracle/2019092900.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/oracle/2020020100.sql b/SQL/oracle/2020020100.sql deleted file mode 100644 index 2590179e3..000000000 --- a/SQL/oracle/2020020100.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "users" MODIFY "language" varchar(16) NOT NULL; -ALTER TABLE "dictionary" MODIFY "language" varchar(16); diff --git a/SQL/oracle/2020020101.sql b/SQL/oracle/2020020101.sql deleted file mode 100644 index fe6741a02..000000000 --- a/SQL/oracle/2020020101.sql +++ /dev/null @@ -1 +0,0 @@ --- empty
\ No newline at end of file diff --git a/SQL/oracle/2020091000.sql b/SQL/oracle/2020091000.sql deleted file mode 100644 index 0e598cda6..000000000 --- a/SQL/oracle/2020091000.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "collected_addresses" ( - "address_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "name" varchar(255) DEFAULT NULL, - "email" varchar(255) DEFAULT NULL, - "type" integer NOT NULL -); - -CREATE UNIQUE INDEX "collected_addresses_user_id_idx" ON "collected_addresses" ("user_id", "type", "email"); - -CREATE SEQUENCE "collected_addresses_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "collected_addresses_seq_trig" -BEFORE INSERT ON "collected_addresses" FOR EACH ROW -BEGIN - :NEW."address_id" := "collected_addresses_seq".nextval; -END; -/ diff --git a/SQL/oracle/2020122900.sql b/SQL/oracle/2020122900.sql deleted file mode 100644 index 73cbb589f..000000000 --- a/SQL/oracle/2020122900.sql +++ /dev/null @@ -1 +0,0 @@ ---empty
\ No newline at end of file diff --git a/SQL/oracle/2021081000.sql b/SQL/oracle/2021081000.sql deleted file mode 100644 index fb99b5dbc..000000000 --- a/SQL/oracle/2021081000.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "responses" ( - "response_id" integer PRIMARY KEY, - "user_id" integer NOT NULL - REFERENCES "users" ("user_id") ON DELETE CASCADE, - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, - "del" smallint DEFAULT 0 NOT NULL, - "name" varchar(128) NOT NULL, - "data" long NOT NULL, - "is_html" smallint DEFAULT 0 NOT NULL -); - -CREATE INDEX "responses_user_id_idx" ON "responses" ("user_id", "del"); - -CREATE SEQUENCE "responses_seq" - START WITH 1 INCREMENT BY 1 NOMAXVALUE; - -CREATE TRIGGER "responses_seq_trig" -BEFORE INSERT ON "responses" FOR EACH ROW -BEGIN - :NEW."response_id" := "response_seq".nextval; -END; -/ diff --git a/SQL/oracle/2021100300.sql b/SQL/oracle/2021100300.sql deleted file mode 100644 index 49daeda32..000000000 --- a/SQL/oracle/2021100300.sql +++ /dev/null @@ -1 +0,0 @@ --- SQLite only
\ No newline at end of file diff --git a/SQL/oracle/2022081200.sql b/SQL/oracle/2022081200.sql deleted file mode 100644 index 105e39efb..000000000 --- a/SQL/oracle/2022081200.sql +++ /dev/null @@ -1 +0,0 @@ --- SQLite/Postgres only
\ No newline at end of file diff --git a/installer/check.php b/installer/check.php index e7c941d80..2eb012baa 100644 --- a/installer/check.php +++ b/installer/check.php @@ -80,7 +80,6 @@ $source_urls = [ 'Iconv' => 'https://www.php.net/manual/en/book.iconv.php', 'Intl' => 'https://www.php.net/manual/en/book.intl.php', 'Exif' => 'https://www.php.net/manual/en/book.exif.php', - 'oci8' => 'https://www.php.net/manual/en/book.oci8.php', 'PDO' => 'https://www.php.net/manual/en/book.pdo.php', 'LDAP' => 'https://www.php.net/manual/en/book.ldap.php', 'GD' => 'https://www.php.net/manual/en/book.image.php', @@ -93,9 +92,6 @@ $source_urls = [ 'pdo_mysql' => 'https://www.php.net/manual/en/ref.pdo-mysql.php', 'pdo_pgsql' => 'https://www.php.net/manual/en/ref.pdo-pgsql.php', 'pdo_sqlite' => 'https://www.php.net/manual/en/ref.pdo-sqlite.php', - 'pdo_sqlite2' => 'https://www.php.net/manual/en/ref.pdo-sqlite.php', - 'pdo_sqlsrv' => 'https://www.php.net/manual/en/ref.pdo-sqlsrv.php', - 'pdo_dblib' => 'https://www.php.net/manual/en/ref.pdo-dblib.php', 'PEAR' => 'https://pear.php.net', 'Net_SMTP' => 'https://pear.php.net/package/Net_SMTP', 'Mail_mime' => 'https://pear.php.net/package/Mail_mime', @@ -143,7 +139,7 @@ foreach ($required_php_exts as $name => $ext) { ?> -<p class="hint">The next couple of extensions are <em>optional</em> and recommended to get the best performance:</p> +<p class="hint">The next couple of extensions are <em>optional</em> and recommended to get the best performance or extra features:</p> <?php foreach ($optional_php_exts as $name => $ext) { diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index 0585d0f94..eb922e0f5 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -70,10 +70,6 @@ class rcmail_install 'MySQL' => 'pdo_mysql', 'PostgreSQL' => 'pdo_pgsql', 'SQLite' => 'pdo_sqlite', - 'SQLite (v2)' => 'pdo_sqlite2', - 'SQL Server (SQLSRV)' => 'pdo_sqlsrv', - 'SQL Server (DBLIB)' => 'pdo_dblib', - 'Oracle' => 'oci8', ]; /** @var array List of config options with default value change per-release */ diff --git a/program/lib/Roundcube/README.md b/program/lib/Roundcube/README.md index 99ef46908..caf0109f3 100644 --- a/program/lib/Roundcube/README.md +++ b/program/lib/Roundcube/README.md @@ -20,7 +20,7 @@ REQUIREMENTS ------------ PHP Version 7.3 or greater including: - PCRE, DOM, JSON, Session, Sockets, OpenSSL, Mbstring, Filter, Ctype, Intl (required) - - PHP PDO with driver for either MySQL, PostgreSQL, SQL Server, Oracle or SQLite (required) + - PHP PDO with driver for either MySQL, PostgreSQL, or SQLite (required) - Iconv, Zip, Fileinfo, Exif (recommended) - LDAP for LDAP addressbook support (optional) diff --git a/program/lib/Roundcube/db/mssql.php b/program/lib/Roundcube/db/mssql.php deleted file mode 100644 index bd5c570d7..000000000 --- a/program/lib/Roundcube/db/mssql.php +++ /dev/null @@ -1,185 +0,0 @@ -<?php - -/** - +-----------------------------------------------------------------------+ - | This file is part of the Roundcube Webmail client | - | | - | Copyright (C) The Roundcube Dev Team | - | | - | Licensed under the GNU General Public License version 3 or | - | any later version with exceptions for skins & plugins. | - | See the README file for a full license statement. | - | | - | PURPOSE: | - | Database wrapper class that implements PHP PDO functions | - | for MS SQL Server database | - +-----------------------------------------------------------------------+ - | Author: Aleksander Machniak <alec@alec.pl> | - +-----------------------------------------------------------------------+ -*/ - -/** - * Database independent query interface - * This is a wrapper for the PHP PDO - * - * @package Framework - * @subpackage Database - */ -class rcube_db_mssql extends rcube_db -{ - public $db_provider = 'mssql'; - - /** - * {@inheritdoc} - */ - public function __construct($db_dsnw, $db_dsnr = '', $pconn = false) - { - parent::__construct($db_dsnw, $db_dsnr, $pconn); - - $this->options['identifier_start'] = '['; - $this->options['identifier_end'] = ']'; - } - - /** - * Driver-specific configuration of database connection - * - * @param array $dsn DSN for DB connections - * @param PDO $dbh Connection handler - */ - protected function conn_configure($dsn, $dbh) - { - // Set date format in case of non-default language (#1488918) - $dbh->query("SET DATEFORMAT ymd"); - } - - /** - * Return SQL function for current time and date - * - * @param int $interval Optional interval (in seconds) to add/subtract - * - * @return string SQL function to use in query - */ - public function now($interval = 0) - { - if ($interval) { - $interval = intval($interval); - return "dateadd(second, $interval, getdate())"; - } - - return "getdate()"; - } - - /** - * Return SQL statement to convert a field value into a unix timestamp - * - * @param string $field Field name - * - * @return string SQL statement to use in query - * @deprecated - */ - public function unixtimestamp($field) - { - return "DATEDIFF(second, '19700101', $field) + DATEDIFF(second, GETDATE(), GETUTCDATE())"; - } - - /** - * Abstract SQL statement for value concatenation - * - * @return string ...$args Values to concatenate - */ - public function concat(...$args) - { - if (count($args) == 1 && is_array($args[0])) { - $args = $args[0]; - } - - return '(' . implode('+', $args) . ')'; - } - - /** - * Adds TOP (LIMIT,OFFSET) clause to the query - * - * @param string $query SQL query - * @param int $limit Number of rows - * @param int $offset Offset - * - * @return string SQL query - */ - protected function set_limit($query, $limit = 0, $offset = 0) - { - $limit = intval($limit); - $offset = intval($offset); - $end = $offset + $limit; - - // query without OFFSET - if (!$offset) { - $query = preg_replace('/^SELECT\s/i', "SELECT TOP $limit ", $query); - return $query; - } - - $orderby = stristr($query, 'ORDER BY'); - $offset += 1; - - if ($orderby !== false) { - $query = trim(substr($query, 0, -1 * strlen($orderby))); - } - else { - // it shouldn't happen, paging without sorting has not much sense - // @FIXME: I don't know how to build paging query without ORDER BY - $orderby = "ORDER BY 1"; - } - - $query = preg_replace('/^SELECT\s/i', '', $query); - $query = "WITH paging AS (SELECT ROW_NUMBER() OVER ($orderby) AS [RowNumber], $query)" - . " SELECT * FROM paging WHERE [RowNumber] BETWEEN $offset AND $end ORDER BY [RowNumber]"; - - return $query; - } - - /** - * Returns PDO DSN string from DSN array - */ - protected function dsn_string($dsn) - { - $params = []; - $result = $dsn['phptype'] . ':'; - - if (isset($dsn['hostspec'])) { - $host = $dsn['hostspec']; - if (isset($dsn['port'])) { - $host .= ',' . $dsn['port']; - } - $params[] = 'host=' . $host; - } - - if (isset($dsn['database'])) { - $params[] = 'dbname=' . $dsn['database']; - } - - if (!empty($params)) { - $result .= implode(';', $params); - } - - return $result; - } - - /** - * Parse SQL file and fix table names according to table prefix - */ - protected function fix_table_names($sql) - { - if (!$this->options['table_prefix']) { - return $sql; - } - - // replace sequence names, and other postgres-specific commands - $sql = preg_replace_callback( - '/((TABLE|(?<!ON )UPDATE|INSERT INTO|FROM(?! deleted)| ON(?! (DELETE|UPDATE|\[PRIMARY\]))' - . '|REFERENCES|CONSTRAINT|TRIGGER|INDEX)\s+(\[dbo\]\.)?[\[\]]*)([^\[\]\( \r\n]+)/', - [$this, 'fix_table_names_callback'], - $sql - ); - - return $sql; - } -} diff --git a/program/lib/Roundcube/db/oracle.php b/program/lib/Roundcube/db/oracle.php deleted file mode 100644 index 038a4a52d..000000000 --- a/program/lib/Roundcube/db/oracle.php +++ /dev/null @@ -1,631 +0,0 @@ -<?php - -/** - +-----------------------------------------------------------------------+ - | This file is part of the Roundcube Webmail client | - | | - | Copyright (C) The Roundcube Dev Team | - | | - | Licensed under the GNU General Public License version 3 or | - | any later version with exceptions for skins & plugins. | - | See the README file for a full license statement. | - | | - | PURPOSE: | - | Database wrapper class that implements database functions | - | for Oracle database using OCI8 extension | - +-----------------------------------------------------------------------+ - | Author: Aleksander Machniak <machniak@kolabsys.com> | - +-----------------------------------------------------------------------+ -*/ - -/** - * Database independent query interface - * - * @package Framework - * @subpackage Database - */ -class rcube_db_oracle extends rcube_db -{ - public $db_provider = 'oracle'; - public $in_transaction = false; - - /** - * Create connection instance - */ - protected function conn_create($dsn) - { - // Get database specific connection options - $dsn_options = $this->dsn_options($dsn); - - $function = $this->db_pconn ? 'oci_pconnect' : 'oci_connect'; - - if (!function_exists($function)) { - $this->db_error = true; - $this->db_error_msg = 'OCI8 extension not loaded. See http://php.net/manual/en/book.oci8.php'; - - rcube::raise_error([ - 'code' => 500, 'type' => 'db', - 'line' => __LINE__, 'file' => __FILE__, - 'message' => $this->db_error_msg - ], true, false); - - return; - } - - // connect - $dbh = @$function($dsn['username'], $dsn['password'], $dsn_options['database'], $dsn_options['charset']); - - if (!$dbh) { - $error = oci_error(); - $this->db_error = true; - $this->db_error_msg = $error['message']; - - rcube::raise_error([ - 'code' => 500, 'type' => 'db', - 'line' => __LINE__, 'file' => __FILE__, - 'message' => $this->db_error_msg - ], true, false); - - return; - } - - // configure session - $this->conn_configure($dsn, $dbh); - - return $dbh; - } - - /** - * Driver-specific configuration of database connection - * - * @param array $dsn DSN for DB connections - * @param PDO $dbh Connection handler - */ - protected function conn_configure($dsn, $dbh) - { - $init_queries = [ - "ALTER SESSION SET nls_date_format = 'YYYY-MM-DD'", - "ALTER SESSION SET nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'", - ]; - - foreach ($init_queries as $query) { - $stmt = oci_parse($dbh, $query); - oci_execute($stmt); - } - } - - /** - * Connection state checker - * - * @return bool True if in connected state - */ - public function is_connected() - { - return empty($this->dbh) ? false : $this->db_connected; - } - - /** - * Execute a SQL query with limits - * - * @param string $query SQL query to execute - * @param int $offset Offset for LIMIT statement - * @param int $numrows Number of rows for LIMIT statement - * @param array $params Values to be inserted in query - * - * @return PDOStatement|bool Query handle or False on error - */ - protected function _query($query, $offset, $numrows, $params) - { - $query = ltrim($query); - - $this->db_connect($this->dsn_select($query), true); - - // check connection before proceeding - if (!$this->is_connected()) { - return $this->last_result = false; - } - - if ($numrows || $offset) { - $query = $this->set_limit($query, $numrows, $offset); - } - - // replace self::DEFAULT_QUOTE with driver-specific quoting - $query = $this->query_parse($query); - - // Because in Roundcube we mostly use queries that are - // executed only once, we will not use prepared queries - $pos = 0; - $idx = 0; - $args = []; - - if (!empty($params)) { - while ($pos = strpos($query, '?', $pos)) { - if ($query[$pos+1] == '?') { // skip escaped '?' - $pos += 2; - } - else { - $val = $this->quote($params[$idx++]); - - // long strings are not allowed inline, need to be parametrized - if (strlen($val) > 4000) { - $key = ':param' . (count($args) + 1); - $args[$key] = $params[$idx-1]; - $val = $key; - } - - unset($params[$idx-1]); - $query = substr_replace($query, $val, $pos, 1); - $pos += strlen($val); - } - } - } - - $query = rtrim($query, " \t\n\r\0\x0B;"); - - // replace escaped '?' and quotes back to normal, see self::quote() - $query = str_replace( - ['??', self::DEFAULT_QUOTE.self::DEFAULT_QUOTE], - ['?', self::DEFAULT_QUOTE], - $query - ); - - // log query - $this->debug($query); - - // destroy reference to previous result - $this->last_result = null; - $this->db_error_msg = null; - - // prepare query - $result = @oci_parse($this->dbh, $query); - $mode = $this->in_transaction ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS; - - if ($result) { - foreach (array_keys($args) as $param) { - oci_bind_by_name($result, $param, $args[$param], -1, SQLT_LNG); - } - } - - // execute query - if (!$result || !@oci_execute($result, $mode)) { - $result = $this->handle_error($query, $result); - } - - return $this->last_result = $result; - } - - /** - * Helper method to handle DB errors. - * This by default logs the error but could be overridden by a driver implementation - * - * @param string Query that triggered the error - * @param resource Query result - * - * @return bool Result to be stored and returned - */ - protected function handle_error($query, $result = null) - { - $error = oci_error($result ?: $this->dbh); - - // @TODO: Find error codes for key errors - if (empty($this->options['ignore_key_errors']) || !in_array($error['code'], ['23000', '23505'])) { - $this->db_error = true; - $this->db_error_msg = sprintf('[%s] %s', $error['code'], $error['message']); - - rcube::raise_error([ - 'code' => 500, 'type' => 'db', - 'line' => __LINE__, 'file' => __FILE__, - 'message' => $this->db_error_msg . " (SQL Query: $query)" - ], true, false); - } - - return false; - } - - /** - * Get last inserted record ID - * - * @param string $table Table name (to find the incremented sequence) - * - * @return mixed ID or false on failure - */ - public function insert_id($table = null) - { - if (!$this->db_connected || $this->db_mode == 'r' || empty($table)) { - return false; - } - - $sequence = $this->quote_identifier($this->sequence_name($table)); - $result = $this->query("SELECT $sequence.currval FROM dual"); - $result = $this->fetch_array($result); - - return !empty($result[0]) ? $result[0] : false; - } - - /** - * Get number of affected rows for the last query - * - * @param mixed $result Optional query handle - * - * @return int Number of (matching) rows - */ - public function affected_rows($result = null) - { - if ($result || ($result === null && ($result = $this->last_result))) { - return oci_num_rows($result); - } - - return 0; - } - - /** - * Get number of rows for a SQL query - * If no query handle is specified, the last query will be taken as reference - * - * @param mixed $result Optional query handle - * - * @return mixed Number of rows or false on failure - * @deprecated This method shows very poor performance and should be avoided. - */ - public function num_rows($result = null) - { - // not implemented - return false; - } - - /** - * Get an associative array for one row - * If no query handle is specified, the last query will be taken as reference - * - * @param mixed $result Optional query handle - * - * @return mixed Array with col values or false on failure - */ - public function fetch_assoc($result = null) - { - return $this->_fetch_row($result, OCI_ASSOC); - } - - /** - * Get an index array for one row - * If no query handle is specified, the last query will be taken as reference - * - * @param mixed $result Optional query handle - * - * @return mixed Array with col values or false on failure - */ - public function fetch_array($result = null) - { - return $this->_fetch_row($result, OCI_NUM); - } - - /** - * Get col values for a result row - * - * @param mixed $result Optional query handle - * @param int $mode Fetch mode identifier - * - * @return array|false Array with col values or false on failure - */ - protected function _fetch_row($result, $mode) - { - if ($result || ($result === null && ($result = $this->last_result))) { - return oci_fetch_array($result, $mode + OCI_RETURN_NULLS + OCI_RETURN_LOBS); - } - - return false; - } - - /** - * Formats input so it can be safely used in a query - * PDO_OCI does not implement quote() method - * - * @param mixed $input Value to quote - * @param string $type Type of data (integer, bool, ident) - * - * @return string Quoted/converted string for use in query - */ - public function quote($input, $type = null) - { - // handle int directly for better performance - if ($type == 'integer' || $type == 'int') { - return intval($input); - } - - if (is_null($input)) { - return 'NULL'; - } - - if ($input instanceof DateTime) { - return $this->quote($input->format($this->options['datetime_format'])); - } - - if ($type == 'ident') { - return $this->quote_identifier($input); - } - - switch ($type) { - case 'bool': - case 'integer': - return intval($input); - default: - return "'" . strtr($input, [ - '?' => '??', - "'" => "''", - rcube_db::DEFAULT_QUOTE => rcube_db::DEFAULT_QUOTE . rcube_db::DEFAULT_QUOTE - ]) . "'"; - } - } - - /** - * Return correct name for a specific database sequence - * - * @param string $table Table name - * - * @return string Translated sequence name - */ - protected function sequence_name($table) - { - // Note: we support only one sequence per table - // Note: The sequence name must be <table_name>_seq - $sequence = $table . '_seq'; - - // modify sequence name if prefix is configured - if ($prefix = $this->options['table_prefix']) { - return $prefix . $sequence; - } - - return $sequence; - } - - /** - * Return SQL statement for case insensitive LIKE - * - * @param string $column Field name - * @param string $value Search value - * - * @return string SQL statement to use in query - */ - public function ilike($column, $value) - { - return 'UPPER(' . $this->quote_identifier($column) . ') LIKE UPPER(' . $this->quote($value) . ')'; - } - - /** - * Return SQL function for current time and date - * - * @param int $interval Optional interval (in seconds) to add/subtract - * - * @return string SQL function to use in query - */ - public function now($interval = 0) - { - if ($interval) { - $interval = intval($interval); - return "current_timestamp + INTERVAL '$interval' SECOND"; - } - - return "current_timestamp"; - } - - /** - * Return SQL statement to convert a field value into a unix timestamp - * - * @param string $field Field name - * - * @return string SQL statement to use in query - * @deprecated - */ - public function unixtimestamp($field) - { - return "(($field - to_date('1970-01-01','YYYY-MM-DD')) * 60 * 60 * 24)"; - } - - /** - * Adds TOP (LIMIT,OFFSET) clause to the query - * - * @param string $query SQL query - * @param int $limit Number of rows - * @param int $offset Offset - * - * @return string SQL query - */ - protected function set_limit($query, $limit = 0, $offset = 0) - { - $limit = intval($limit); - $offset = intval($offset); - $end = $offset + $limit; - - // @TODO: Oracle 12g has better OFFSET support - - if (!$offset) { - $query = "SELECT * FROM ($query) a WHERE rownum <= $end"; - } - else { - $query = "SELECT * FROM (SELECT a.*, rownum as rn FROM ($query) a WHERE rownum <= $end) b WHERE rn > $offset"; - } - - return $query; - } - - /** - * Parse SQL file and fix table names according to table prefix - */ - protected function fix_table_names($sql) - { - if (!$this->options['table_prefix']) { - return $sql; - } - - $sql = parent::fix_table_names($sql); - - // replace sequence names, and other Oracle-specific commands - $sql = preg_replace_callback('/(SEQUENCE ["]?)([^" \r\n]+)/', - [$this, 'fix_table_names_callback'], - $sql - ); - - $sql = preg_replace_callback( - '/([ \r\n]+["]?)([^"\' \r\n\.]+)(["]?\.nextval)/', - [$this, 'fix_table_names_seq_callback'], - $sql - ); - - return $sql; - } - - /** - * Preg_replace callback for fix_table_names() - */ - protected function fix_table_names_seq_callback($matches) - { - return $matches[1] . $this->options['table_prefix'] . $matches[2] . $matches[3]; - } - - /** - * Returns connection options from DSN array - */ - protected function dsn_options($dsn) - { - $params = []; - - if (isset($dsn['hostspec'])) { - $host = $dsn['hostspec']; - if (isset($dsn['port'])) { - $host .= ':' . $dsn['port']; - } - - $params['database'] = $host . '/' . $dsn['database']; - } - - $params['charset'] = 'UTF8'; - - return $params; - } - - /** - * Execute the given SQL script - * - * @param string $sql SQL queries to execute - * - * @return bool True on success, False on error - */ - public function exec_script($sql) - { - $sql = $this->fix_table_names($sql); - $buff = ''; - $body = false; - - foreach (explode("\n", $sql) as $line) { - $tok = strtolower(trim($line)); - if (preg_match('/^--/', $line) || $tok == '' || $tok == '/') { - continue; - } - - $buff .= $line . "\n"; - - // detect PL/SQL function bodies, don't break on semicolon - if ($body && $tok == 'end;') { - $body = false; - } - else if (!$body && $tok == 'begin') { - $body = true; - } - - if (!$body && substr($tok, -1) == ';') { - $this->query($buff); - $buff = ''; - if ($this->db_error) { - break; - } - } - } - - return !$this->db_error; - } - - /** - * Start transaction - * - * @return bool True on success, False on failure - */ - public function startTransaction() - { - $this->db_connect('w', true); - - // check connection before proceeding - if (!$this->is_connected()) { - return $this->last_result = false; - } - - $this->debug('BEGIN TRANSACTION'); - - return $this->last_result = $this->in_transaction = true; - } - - /** - * Commit transaction - * - * @return bool True on success, False on failure - */ - public function endTransaction() - { - $this->db_connect('w', true); - - // check connection before proceeding - if (!$this->is_connected()) { - return $this->last_result = false; - } - - $this->debug('COMMIT TRANSACTION'); - - if ($result = @oci_commit($this->dbh)) { - $this->in_transaction = true; - } - else { - $this->handle_error('COMMIT'); - } - - return $this->last_result = $result; - } - - /** - * Rollback transaction - * - * @return bool True on success, False on failure - */ - public function rollbackTransaction() - { - $this->db_connect('w', true); - - // check connection before proceeding - if (!$this->is_connected()) { - return $this->last_result = false; - } - - $this->debug('ROLLBACK TRANSACTION'); - - if (@oci_rollback($this->dbh)) { - $this->in_transaction = false; - } - else { - $this->handle_error('ROLLBACK'); - } - - return $this->last_result = $this->dbh->rollBack(); - } - - /** - * Terminate database connection. - */ - public function closeConnection() - { - // release statement and close connection(s) - $this->last_result = null; - foreach ($this->dbhs as $dbh) { - oci_close($dbh); - } - - parent::closeConnection(); - } -} diff --git a/program/lib/Roundcube/db/sqlsrv.php b/program/lib/Roundcube/db/sqlsrv.php deleted file mode 100644 index f064c95ae..000000000 --- a/program/lib/Roundcube/db/sqlsrv.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -/** - +-----------------------------------------------------------------------+ - | This file is part of the Roundcube Webmail client | - | | - | Copyright (C) The Roundcube Dev Team | - | | - | Licensed under the GNU General Public License version 3 or | - | any later version with exceptions for skins & plugins. | - | See the README file for a full license statement. | - | | - | PURPOSE: | - | Database wrapper class that implements PHP PDO functions | - | for MS SQL Server database | - +-----------------------------------------------------------------------+ - | Author: Aleksander Machniak <alec@alec.pl> | - +-----------------------------------------------------------------------+ -*/ - -/** - * Database independent query interface - * This is a wrapper for the PHP PDO - * - * @package Framework - * @subpackage Database - */ -class rcube_db_sqlsrv extends rcube_db_mssql -{ - - /** - * Get last inserted record ID - * - * @param string $table Table name (to find the incremented sequence) - * - * @return string|false The ID or False on failure - */ - public function insert_id($table = '') - { - if (!$this->db_connected || $this->db_mode == 'r') { - return false; - } - - if ($table) { - // For some unknown reason the constant described in the driver docs - // might not exist, we'll fallback to PDO::ATTR_CLIENT_VERSION (#7564) - if (defined('PDO::ATTR_DRIVER_VERSION')) { - $driver_version = $this->dbh->getAttribute(PDO::ATTR_DRIVER_VERSION); - } - else if (defined('PDO::ATTR_CLIENT_VERSION')) { - $client_version = $this->dbh->getAttribute(PDO::ATTR_CLIENT_VERSION); - $driver_version = $client_version['ExtensionVer']; - } - else { - $driver_version = 5; - } - - // Starting from version 5 of the driver lastInsertId() method expects - // a sequence name instead of a table name. We'll unset the argument - // to get the last insert sequence (#7564) - if (version_compare($driver_version, '5', '>=')) { - $table = null; - } - else { - // resolve table name - $table = $this->table_name($table); - } - } - - return $this->dbh->lastInsertId($table); - } - - /** - * Returns PDO DSN string from DSN array - */ - protected function dsn_string($dsn) - { - $params = []; - $result = 'sqlsrv:'; - - if (isset($dsn['hostspec'])) { - $host = $dsn['hostspec']; - - if (isset($dsn['port'])) { - $host .= ',' . $dsn['port']; - } - - $params[] = 'Server=' . $host; - } - - if (isset($dsn['database'])) { - $params[] = 'Database=' . $dsn['database']; - } - - if (!empty($params)) { - $result .= implode(';', $params); - } - - return $result; - } -} diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php index af1eee923..cab70eeb9 100644 --- a/program/lib/Roundcube/rcube_db.php +++ b/program/lib/Roundcube/rcube_db.php @@ -80,11 +80,7 @@ class rcube_db $driver = strtolower(substr($db_dsnw, 0, strpos($db_dsnw, ':'))); $driver_map = [ 'sqlite2' => 'sqlite', - 'sybase' => 'mssql', - 'dblib' => 'mssql', 'mysqli' => 'mysql', - 'oci' => 'oracle', - 'oci8' => 'oracle', ]; $driver = $driver_map[$driver] ?? $driver; @@ -1418,10 +1414,7 @@ class rcube_db continue; } - if ($trimmed == 'GO') { - $exec = $buff; - } - else if ($trimmed[strlen($trimmed)-1] == ';') { + if ($trimmed[strlen($trimmed)-1] == ';') { $exec = $buff . substr(rtrim($line), 0, -1); } diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php index 0de7a77af..a115ed4d3 100644 --- a/program/lib/Roundcube/rcube_imap_cache.php +++ b/program/lib/Roundcube/rcube_imap_cache.php @@ -544,8 +544,6 @@ class rcube_imap_cache } } - $binary_check = $this->db->db_provider == 'oracle' ? "BITAND(`flags`, %d)" : "(`flags` & %d)"; - $this->db->query( "UPDATE {$this->messages_table}" ." SET `expires` = ". ($this->ttl ? $this->db->now($this->ttl) : 'NULL') @@ -553,7 +551,7 @@ class rcube_imap_cache ." WHERE `user_id` = ?" ." AND `mailbox` = ?" .(!empty($uids) ? " AND `uid` IN (".$this->db->array2list($uids, 'integer').")" : "") - ." AND " . sprintf($binary_check, $idx) . ($enabled ? " = 0" : " = $idx"), + ." AND (`flags` & $idx) = " . ($enabled ? '0' : $idx), $this->userid, $mailbox ); } |