|
|
@ -259,6 +259,8 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
|
|
|
|
'{DATE}' => "timestamp NOT NULL default '2000-01-01'", # MySQL needs a sane default (no default is interpreted as CURRENT_TIMESTAMP, which is ...
|
|
|
|
'{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-18'", # different default timestamp for vacation.activeuntil
|
|
|
|
'{DATEFUTURE}' => "timestamp NOT NULL default '2038-01-18'", # different default timestamp for vacation.activeuntil
|
|
|
|
'{DATECURRENT}' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', # only allowed once per table in MySQL
|
|
|
|
'{DATECURRENT}' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', # only allowed once per table in MySQL
|
|
|
|
|
|
|
|
'{COLLATE}' => "CHARACTER SET latin1 COLLATE latin1_general_ci", # just incase someone has a unicode collation set.
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$sql = "$sql $attach_mysql";
|
|
|
|
$sql = "$sql $attach_mysql";
|
|
|
|
} elseif (db_sqlite()) {
|
|
|
|
} elseif (db_sqlite()) {
|
|
|
@ -281,6 +283,7 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
|
|
|
|
'{DATE}' => "datetime NOT NULL default '2000-01-01'",
|
|
|
|
'{DATE}' => "datetime NOT NULL default '2000-01-01'",
|
|
|
|
'{DATEFUTURE}' => "datetime NOT NULL default '2038-01-18'", # different default timestamp for vacation.activeuntil
|
|
|
|
'{DATEFUTURE}' => "datetime NOT NULL default '2038-01-18'", # different default timestamp for vacation.activeuntil
|
|
|
|
'{DATECURRENT}' => 'datetime NOT NULL default CURRENT_TIMESTAMP',
|
|
|
|
'{DATECURRENT}' => 'datetime NOT NULL default CURRENT_TIMESTAMP',
|
|
|
|
|
|
|
|
'{COLLATE}' => ''
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} elseif ($CONF['database_type'] == 'pgsql') {
|
|
|
|
} elseif ($CONF['database_type'] == 'pgsql') {
|
|
|
|
$replace = array(
|
|
|
|
$replace = array(
|
|
|
@ -305,6 +308,7 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") {
|
|
|
|
'{DATE}' => "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-18'", # stay in sync with MySQL
|
|
|
|
'{DATEFUTURE}' => "timestamp with time zone default '2038-01-18'", # stay in sync with MySQL
|
|
|
|
'{DATECURRENT}' => 'timestamp with time zone default now()',
|
|
|
|
'{DATECURRENT}' => 'timestamp with time zone default now()',
|
|
|
|
|
|
|
|
'{COLLATE}' => '',
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
echo_out("Sorry, unsupported database type " . $CONF['database_type']);
|
|
|
|
echo_out("Sorry, unsupported database type " . $CONF['database_type']);
|
|
|
@ -401,7 +405,7 @@ function upgrade_1_mysql() {
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`username`)
|
|
|
|
PRIMARY KEY (`username`)
|
|
|
|
) COMMENT='Postfix Admin - Virtual Admins';";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Admins';";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $alias (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $alias (
|
|
|
@ -412,7 +416,7 @@ function upgrade_1_mysql() {
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`address`)
|
|
|
|
PRIMARY KEY (`address`)
|
|
|
|
) COMMENT='Postfix Admin - Virtual Aliases'; ";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Aliases'; ";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $domain (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $domain (
|
|
|
@ -428,7 +432,7 @@ function upgrade_1_mysql() {
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`domain`)
|
|
|
|
PRIMARY KEY (`domain`)
|
|
|
|
) COMMENT='Postfix Admin - Virtual Domains'; ";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Domains'; ";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $domain_admins (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $domain_admins (
|
|
|
@ -437,7 +441,7 @@ function upgrade_1_mysql() {
|
|
|
|
`created` {DATETIME},
|
|
|
|
`created` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
KEY username (`username`)
|
|
|
|
KEY username (`username`)
|
|
|
|
) COMMENT='Postfix Admin - Domain Admins';";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Domain Admins';";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $log (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $log (
|
|
|
@ -447,7 +451,7 @@ function upgrade_1_mysql() {
|
|
|
|
`action` varchar(255) NOT NULL default '',
|
|
|
|
`action` varchar(255) NOT NULL default '',
|
|
|
|
`data` varchar(255) NOT NULL default '',
|
|
|
|
`data` varchar(255) NOT NULL default '',
|
|
|
|
KEY timestamp (`timestamp`)
|
|
|
|
KEY timestamp (`timestamp`)
|
|
|
|
) COMMENT='Postfix Admin - Log';";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Log';";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $mailbox (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $mailbox (
|
|
|
@ -461,7 +465,7 @@ function upgrade_1_mysql() {
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`modified` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`username`)
|
|
|
|
PRIMARY KEY (`username`)
|
|
|
|
) COMMENT='Postfix Admin - Virtual Mailboxes';";
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Mailboxes';";
|
|
|
|
|
|
|
|
|
|
|
|
$sql[] = "
|
|
|
|
$sql[] = "
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $vacation (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} $vacation (
|
|
|
@ -474,7 +478,7 @@ function upgrade_1_mysql() {
|
|
|
|
active tinyint(4) NOT NULL default '1',
|
|
|
|
active tinyint(4) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (email),
|
|
|
|
PRIMARY KEY (email),
|
|
|
|
KEY email (email)
|
|
|
|
KEY email (email)
|
|
|
|
) {INNODB} DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Vacation' ;";
|
|
|
|
) {INNODB} {COLLATE} COMMENT='Postfix Admin - Virtual Vacation' ;";
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($sql as $query) {
|
|
|
|
foreach ($sql as $query) {
|
|
|
|
db_query_parsed($query);
|
|
|
|
db_query_parsed($query);
|
|
|
@ -814,7 +818,7 @@ function upgrade_5_mysql() {
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`username`),
|
|
|
|
PRIMARY KEY (`username`),
|
|
|
|
KEY username (`username`)
|
|
|
|
KEY username (`username`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Admins'; ");
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Admins'; ");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} " . table_by_key('alias') . " (
|
|
|
|
CREATE TABLE {IF_NOT_EXISTS} " . table_by_key('alias') . " (
|
|
|
@ -826,7 +830,7 @@ function upgrade_5_mysql() {
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`address`),
|
|
|
|
PRIMARY KEY (`address`),
|
|
|
|
KEY address (`address`)
|
|
|
|
KEY address (`address`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Aliases';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Aliases';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
@ -844,7 +848,7 @@ function upgrade_5_mysql() {
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`domain`),
|
|
|
|
PRIMARY KEY (`domain`),
|
|
|
|
KEY domain (`domain`)
|
|
|
|
KEY domain (`domain`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Domains';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Domains';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
@ -854,7 +858,7 @@ function upgrade_5_mysql() {
|
|
|
|
`created` {DATETIME},
|
|
|
|
`created` {DATETIME},
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
KEY username (`username`)
|
|
|
|
KEY username (`username`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Domain Admins';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Domain Admins';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
@ -865,7 +869,7 @@ function upgrade_5_mysql() {
|
|
|
|
`action` varchar(255) NOT NULL default '',
|
|
|
|
`action` varchar(255) NOT NULL default '',
|
|
|
|
`data` varchar(255) NOT NULL default '',
|
|
|
|
`data` varchar(255) NOT NULL default '',
|
|
|
|
KEY timestamp (`timestamp`)
|
|
|
|
KEY timestamp (`timestamp`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Log';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Log';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
@ -881,7 +885,7 @@ function upgrade_5_mysql() {
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`username`),
|
|
|
|
PRIMARY KEY (`username`),
|
|
|
|
KEY username (`username`)
|
|
|
|
KEY username (`username`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Mailboxes';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Mailboxes';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
db_query_parsed("
|
|
|
|
db_query_parsed("
|
|
|
@ -895,7 +899,7 @@ function upgrade_5_mysql() {
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
`active` tinyint(1) NOT NULL default '1',
|
|
|
|
PRIMARY KEY (`email`),
|
|
|
|
PRIMARY KEY (`email`),
|
|
|
|
KEY email (`email`)
|
|
|
|
KEY email (`email`)
|
|
|
|
) DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Vacation';
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Virtual Vacation';
|
|
|
|
");
|
|
|
|
");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -975,7 +979,7 @@ function upgrade_318_mysql() {
|
|
|
|
CONSTRAINT `vacation_notification_pkey`
|
|
|
|
CONSTRAINT `vacation_notification_pkey`
|
|
|
|
FOREIGN KEY (`on_vacation`) REFERENCES $table_vacation(`email`) ON DELETE CASCADE
|
|
|
|
FOREIGN KEY (`on_vacation`) REFERENCES $table_vacation(`email`) ON DELETE CASCADE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
DEFAULT {LATIN1}
|
|
|
|
{COLLATE}
|
|
|
|
COMMENT='Postfix Admin - Virtual Vacation Notifications'
|
|
|
|
COMMENT='Postfix Admin - Virtual Vacation Notifications'
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
@ -1083,7 +1087,7 @@ function upgrade_438_mysql() {
|
|
|
|
PRIMARY KEY (`alias_domain`),
|
|
|
|
PRIMARY KEY (`alias_domain`),
|
|
|
|
KEY `active` (`active`),
|
|
|
|
KEY `active` (`active`),
|
|
|
|
KEY `target_domain` (`target_domain`)
|
|
|
|
KEY `target_domain` (`target_domain`)
|
|
|
|
) COMMENT='Postfix Admin - Domain Aliases'
|
|
|
|
) {COLLATE} COMMENT='Postfix Admin - Domain Aliases'
|
|
|
|
");
|
|
|
|
");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1361,7 +1365,7 @@ function upgrade_729_mysql_pgsql() {
|
|
|
|
path VARCHAR(100) {LATIN1} NOT NULL,
|
|
|
|
path VARCHAR(100) {LATIN1} NOT NULL,
|
|
|
|
current {BIGINT},
|
|
|
|
current {BIGINT},
|
|
|
|
PRIMARY KEY (username, path)
|
|
|
|
PRIMARY KEY (username, path)
|
|
|
|
) ;
|
|
|
|
) {COLLATE} ;
|
|
|
|
");
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
# table for dovecot >= 1.2
|
|
|
|
# table for dovecot >= 1.2
|
|
|
|