You've already forked postfixadmin
mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2025-12-03 23:11:12 +03:00
upgrade.php: reindent; fix postgresql fetchmail stuff
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@352 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
47
upgrade.php
47
upgrade.php
@@ -586,8 +586,7 @@ if(!_pgsql_object_exists('vacation_notification')) {
|
||||
on_vacation character varying(255) NOT NULL REFERENCES vacation(email) ON DELETE CASCADE,
|
||||
notified character varying(255) NOT NULL,
|
||||
notified_at timestamp with time zone NOT NULL DEFAULT now(),
|
||||
CONSTRAINT vacation_notification_pkey primary key(on_vacation,notified)
|
||||
);");
|
||||
CONSTRAINT vacation_notification_pkey primary key(on_vacation,notified));");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,8 +615,7 @@ function upgrade_5_mysql() {
|
||||
`active` tinyint(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`username`),
|
||||
KEY username (`username`)
|
||||
) TYPE=MyISAM DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Admins';
|
||||
");
|
||||
) TYPE=MyISAM DEFAULT {LATIN1} COMMENT='Postfix Admin - Virtual Admins'; ");
|
||||
|
||||
$result = db_query_parsed("
|
||||
CREATE TABLE {IF_NOT_EXISTS} `" . table_by_key('alias') . "` (
|
||||
@@ -797,8 +795,7 @@ foreach ($all_sql as $sql) {
|
||||
# create constraint...
|
||||
$result = db_query_parsed("
|
||||
ALTER TABLE $table_vacation_notification ADD CONSTRAINT `vacation_notification_pkey`
|
||||
FOREIGN KEY (`on_vacation`) REFERENCES vacation(`email`) ON DELETE CASCADE
|
||||
");
|
||||
FOREIGN KEY (`on_vacation`) REFERENCES vacation(`email`) ON DELETE CASCADE ");
|
||||
}
|
||||
|
||||
|
||||
@@ -807,10 +804,10 @@ $result = db_query_parsed("
|
||||
*/
|
||||
function upgrade_344_mysql() {
|
||||
|
||||
$table_vacation_notification = table_by_key('vacation_notification');
|
||||
$table_fetchmail = table_by_key('fetchmail');
|
||||
|
||||
db_query_parsed( "
|
||||
create table fetchmail(
|
||||
create table $table_fetchmail(
|
||||
id int(11) unsigned not null auto_increment,
|
||||
mailbox varchar(255) not null default '',
|
||||
src_server varchar(255) not null default '',
|
||||
@@ -832,6 +829,38 @@ function upgrade_344_mysql() {
|
||||
}
|
||||
|
||||
function upgrade_344_pgsql() {
|
||||
# TODO: create fetchmail table for PgSQL
|
||||
$fetchmail = table_by_key('fetchmail');
|
||||
// a field name called 'date' is probably a bad idea.
|
||||
if(!_pgsql_object_exists('fetchmail')) {
|
||||
db_query_parsed( "
|
||||
create table $fetchmail(
|
||||
id serial,
|
||||
mailbox varchar(255) not null default '',
|
||||
src_server varchar(255) not null default '',
|
||||
src_auth varchar(15) NOT NULL,
|
||||
src_user varchar(255) not null default '',
|
||||
src_password varchar(255) not null default '',
|
||||
src_folder varchar(255) not null default '',
|
||||
poll_time integer not null default 10,
|
||||
fetchall boolean not null default false,
|
||||
keep boolean not null default false,
|
||||
protocol varchar(15) NOT NULL,
|
||||
extra_options text,
|
||||
returned_text text,
|
||||
mda varchar(255) not null default '',
|
||||
date timestamp with time zone default now(),
|
||||
primary key(id),
|
||||
CHECK (src_auth IN ('password','kerberos_v5','kerberos','kerberos_v4','gssapi','cram-md5','otp','ntlm','msn','ssh','any')),
|
||||
CHECK (protocol IN ('POP3', 'IMAP', 'POP2', 'ETRN', 'AUTO'))
|
||||
);
|
||||
");
|
||||
}
|
||||
// MySQL expects sequences to start at 1. Stupid database.
|
||||
// fetchmail.php requires id parameters to be > 0, as it does if($id) like logic... hence if we don't
|
||||
// fudge the sequence starting point, you cannot delete/edit the first entry if using PostgreSQL.
|
||||
// I'm sure there's a more elegant way of fixing it properly.... but this should work for now.
|
||||
if(_pgsql_object_exists('fetchmail_id_seq')) {
|
||||
db_query_parsed("SELECT nextval('{$fetchmail}_id_seq')"); // I don't care about number waste.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user