summaryrefslogtreecommitdiff
path: root/SQL/sqlite.update.sql
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-01-05 08:45:22 +0000
committeralecpl <alec@alec.pl>2012-01-05 08:45:22 +0000
commit48be8f6428ba3be7375b84aea2b73d1c67de6da1 (patch)
treec1b27daef6533502054f395ef5d85f5a3499c1af /SQL/sqlite.update.sql
parenta01df71de495de79624d79b78d2959a443334cce (diff)
- Fix SQL Error when saving a contact with many email addresses (#1488286)
Diffstat (limited to 'SQL/sqlite.update.sql')
-rw-r--r--SQL/sqlite.update.sql40
1 files changed, 39 insertions, 1 deletions
diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql
index c722a84f8..9f410fb13 100644
--- a/SQL/sqlite.update.sql
+++ b/SQL/sqlite.update.sql
@@ -293,5 +293,43 @@ CREATE TABLE session (
ip varchar(40) NOT NULL default '',
vars text NOT NULL
);
-
CREATE INDEX ix_session_changed ON session (changed);
+
+-- Updates from version 0.7
+
+CREATE TABLE contacts_tmp (
+ contact_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL,
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ email text NOT NULL default '',
+ firstname varchar(128) NOT NULL default '',
+ surname varchar(128) NOT NULL default '',
+ vcard text NOT NULL default '',
+ words text NOT NULL default ''
+);
+
+INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words)
+ SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts;
+
+DROP TABLE contacts;
+
+CREATE TABLE contacts (
+ contact_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL,
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ email text NOT NULL default '',
+ firstname varchar(128) NOT NULL default '',
+ surname varchar(128) NOT NULL default '',
+ vcard text NOT NULL default '',
+ words text NOT NULL default ''
+);
+
+INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words)
+ SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts_tmp;
+
+CREATE INDEX ix_contacts_user_id ON contacts(user_id, del);
+DROP TABLE contacts_tmp;