@ -250,6 +250,7 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
'{BIGINT}' => 'bigint NOT NULL DEFAULT 0',
'{DATETIME}' => "datetime NOT NULL default '2000-01-01 00:00:00'", # different from {DATE} only for MySQL
'{DATE}' => "timestamp NOT NULL default '2000-01-01'", # MySQL needs a sane default (no default is interpreted as CURRENT_TIMESTAMP, which is ...
'{DATEFUTURE}' => "timestamp NOT NULL default '2038-01-19'", # different default timestamp for vacation.activeuntil
'{DATECURRENT}' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', # only allowed once per table in MySQL
);
$sql = "$sql $attach_mysql";
@ -272,6 +273,7 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
'{BIGINT}' => 'bigint(20) NOT NULL DEFAULT 0',
'{DATETIME}' => "datetime NOT NULL default '2000-01-01'",
'{DATE}' => "datetime NOT NULL default '2000-01-01'",
'{DATEFUTURE}' => "datetime NOT NULL default '2038-01-19'", # different default timestamp for vacation.activeuntil
'{DATECURRENT}' => 'datetime NOT NULL default CURRENT_TIMESTAMP',
);
} elseif($CONF['database_type'] == 'pgsql') {
@ -295,6 +297,7 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
'int(4)' => 'int',
'{DATETIME}' => "timestamp with time zone default '2000-01-01'", # stay in sync with MySQL
'{DATE}' => "timestamp with time zone default '2000-01-01'", # stay in sync with MySQL
'{DATEFUTURE}' => "timestamp with time zone default '2038-01-19'", # stay in sync with MySQL
'{DATECURRENT}' => 'timestamp with time zone default now()',
);
@ -1383,7 +1386,7 @@ function upgrade_945_mysql_pgsql() {
function upgrade_946_mysql_pgsql() {
# taken from upgrade_727_mysql, needs to be done for all databases
_db_add_field('vacation', 'activefrom', '{DATE}', 'body');
_db_add_field('vacation', 'activeuntil', '{DATE}', 'activefrom');
_db_add_field('vacation', 'activeuntil', '{DATEFUTURE }', 'activefrom');
}
function upgrade_968_pgsql() {
# pgsql counterpart for upgrade_169_mysql() - allow really big quota
@ -1629,7 +1632,7 @@ function upgrade_1824_sqlite() {
`subject` varchar(255) NOT NULL,
`body` {FULLTEXT} NOT NULL,
`activefrom` {DATE},
`activeuntil` {DATE},
`activeuntil` {DATEFUTURE },
`cache` {FULLTEXT} NOT NULL DEFAULT '',
`domain` varchar(255) NOT NULL,
`interval_time` {INT},
@ -1727,3 +1730,9 @@ function upgrade_1837_sqlite() {
function upgrade_1839() {
_db_add_field('log', 'id', '{AUTOINCREMENT} {PRIMARY}' , 'data');
}
function upgrade_1840_mysql_pgsql() {
# sqlite doesn't support changing the default value
$vacation = table_by_key('vacation');
db_query_parsed("ALTER TABLE $vacation ALTER COLUMN activeuntil SET DEFAULT '2038-01-19'");
}