diff options
author | alecpl <alec@alec.pl> | 2010-04-28 10:34:33 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-04-28 10:34:33 +0000 |
commit | e2402ef99af447b7cc30d661e62450cbb04b202b (patch) | |
tree | d118c0b7429404424ff6d83d906fbe25121d21fc /SQL | |
parent | 0f3764e59223d8e9c87f30ce85425c00422ff25d (diff) |
- Set DEFAULT NULL for users.last_login
Diffstat (limited to 'SQL')
-rw-r--r-- | SQL/mssql.initial.sql | 2 | ||||
-rw-r--r-- | SQL/mysql.initial.sql | 2 | ||||
-rw-r--r-- | SQL/mysql.update.sql | 5 | ||||
-rw-r--r-- | SQL/postgres.initial.sql | 2 | ||||
-rw-r--r-- | SQL/postgres.update.sql | 5 | ||||
-rw-r--r-- | SQL/sqlite.initial.sql | 2 | ||||
-rw-r--r-- | SQL/sqlite.update.sql | 37 |
7 files changed, 51 insertions, 4 deletions
diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql index 4891ad733..0f5ae0d40 100644 --- a/SQL/mssql.initial.sql +++ b/SQL/mssql.initial.sql @@ -86,7 +86,7 @@ CREATE TABLE [dbo].[users] ( [mail_host] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
[alias] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
[created] [datetime] NOT NULL ,
- [last_login] [datetime] NOT NULL ,
+ [last_login] [datetime] NULL ,
[language] [varchar] (5) COLLATE Latin1_General_CI_AI NULL ,
[preferences] [text] COLLATE Latin1_General_CI_AI NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index 3145ca543..08f7d93c9 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -24,7 +24,7 @@ CREATE TABLE `users` ( `mail_host` varchar(128) NOT NULL, `alias` varchar(128) NOT NULL, `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `last_login` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `last_login` datetime DEFAULT NULL, `language` varchar(5), `preferences` text, PRIMARY KEY(`user_id`), diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index f820415d3..49811c1e9 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -108,3 +108,8 @@ CREATE TABLE `contactgroupmembers` ( ) /*!40000 ENGINE=INNODB */; /*!40014 SET FOREIGN_KEY_CHECKS=1 */; + +-- Updates from version 0.4-beta + +ALTER TABLE `users` CHANGE `last_login` `last_login` datetime DEFAULT NULL; +UPDATE `users` SET `last_login` = NULL WHERE `last_login` = '1000-01-01 00:00:00'; diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql index 5770dcc4c..e57a70637 100644 --- a/SQL/postgres.initial.sql +++ b/SQL/postgres.initial.sql @@ -22,7 +22,7 @@ CREATE TABLE users ( mail_host varchar(128) DEFAULT '' NOT NULL, alias varchar(128) DEFAULT '' NOT NULL, created timestamp with time zone DEFAULT now() NOT NULL, - last_login timestamp with time zone DEFAULT now() NOT NULL, + last_login timestamp with time zone DEFAULT NULL, "language" varchar(5), preferences text DEFAULT ''::text NOT NULL ); diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql index 762f5fbc7..bbfbcc9c6 100644 --- a/SQL/postgres.update.sql +++ b/SQL/postgres.update.sql @@ -76,3 +76,8 @@ CREATE TABLE contactgroupmembers ( created timestamp with time zone DEFAULT now() NOT NULL, PRIMARY KEY (contactgroup_id, contact_id) ); + +-- Updates from version 0.4-beta + +ALTER TABLE users ALTER last_login DROP NOT NULL; +ALTER TABLE users ALTER last_login SET DEFAULT NULL; diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql index 8bd43f4b8..8565eae25 100644 --- a/SQL/sqlite.initial.sql +++ b/SQL/sqlite.initial.sql @@ -92,7 +92,7 @@ CREATE TABLE users ( mail_host varchar(128) NOT NULL default '', alias varchar(128) NOT NULL default '', created datetime NOT NULL default '0000-00-00 00:00:00', - last_login datetime NOT NULL default '0000-00-00 00:00:00', + last_login datetime DEFAULT NULL, language varchar(5), preferences text NOT NULL default '' ); diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql index 4b9b2f92e..0f7f994d0 100644 --- a/SQL/sqlite.update.sql +++ b/SQL/sqlite.update.sql @@ -105,3 +105,40 @@ CREATE TABLE contactgroupmembers ( PRIMARY KEY (contactgroup_id, contact_id) ); +-- Updates from version 0.3.1 + +CREATE TABLE tmp_users ( + user_id integer NOT NULL PRIMARY KEY, + username varchar(128) NOT NULL default '', + mail_host varchar(128) NOT NULL default '', + alias varchar(128) NOT NULL default '', + created datetime NOT NULL default '0000-00-00 00:00:00', + last_login datetime NOT NULL default '0000-00-00 00:00:00', + language varchar(5), + preferences text NOT NULL default '' +); + +INSERT INTO tmp_users (user_id, username, mail_host, alias, created, last_login, language, preferences) + SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM users; + +DROP INDEX ix_users_username ON users(username); +DROP INDEX ix_users_alias ON users(alias); +DROP TABLE users; + +CREATE TABLE users ( + user_id integer NOT NULL PRIMARY KEY, + username varchar(128) NOT NULL default '', + mail_host varchar(128) NOT NULL default '', + alias varchar(128) NOT NULL default '', + created datetime NOT NULL default '0000-00-00 00:00:00', + last_login datetime DEFAULT NULL, + language varchar(5), + preferences text NOT NULL default '' +); + +INSERT INTO users (user_id, username, mail_host, alias, created, last_login, language, preferences) + SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM tmp_users; + +CREATE INDEX ix_users_username ON users(username); +CREATE INDEX ix_users_alias ON users(alias); +DROP TABLE tmp_users; |