Add new SQL columns: forwardings.dest_domain, alias_moderators.dest_domain.
This commit is contained in:
parent
3d08c50ad1
commit
8b07b7ebaa
|
@ -260,16 +260,23 @@ CREATE TABLE IF NOT EXISTS alias_moderators (
|
|||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, moderator),
|
||||
INDEX (domain)
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Forwardings. it contains
|
||||
-- - members of mail alias account
|
||||
-- - per-account alias addresses
|
||||
-- - per-user mail forwarding addresses
|
||||
CREATE TABLE IF NOT EXISTS forwardings (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
|
@ -280,6 +287,7 @@ CREATE TABLE IF NOT EXISTS forwardings (
|
|||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, forwarding),
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain),
|
||||
INDEX (is_list),
|
||||
INDEX (is_alias)
|
||||
) ENGINE=InnoDB;
|
||||
|
@ -398,18 +406,37 @@ SQL structure.
|
|||
|
||||
#### Create required new SQL tables
|
||||
|
||||
Please connect to PostgreSQL server as `vmailadmin` user, then execute SQL
|
||||
commands below to create required new tables:
|
||||
Please run shell commands below to connect to PostgreSQL server as
|
||||
`vmailadmin` user first:
|
||||
|
||||
```
|
||||
su - postgres
|
||||
psql -U vmailadmin -d vmail
|
||||
```
|
||||
|
||||
Then execute SQL commands below to create required new tables:
|
||||
|
||||
```
|
||||
CREATE TABLE alias_moderators (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX idx_alias_moderators_address ON alias_moderators (address);
|
||||
CREATE INDEX idx_alias_moderators_moderator ON alias_moderators (moderator);
|
||||
CREATE UNIQUE INDEX idx_alias_moderators_address_moderator ON alias_moderators (address, moderator);
|
||||
CREATE INDEX idx_alias_moderators_domain ON alias_moderators (domain);
|
||||
CREATE INDEX idx_alias_moderators_dest_domain ON alias_moderators (dest_domain);
|
||||
|
||||
CREATE TABLE forwardings (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list INT2 NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
|
@ -422,21 +449,11 @@ CREATE INDEX idx_forwardings_address ON forwardings (address);
|
|||
CREATE INDEX idx_forwardings_forwarding ON forwardings (forwarding);
|
||||
CREATE UNIQUE INDEX idx_forwardings_address_forwarding ON forwardings (address, forwarding);
|
||||
CREATE INDEX idx_forwardings_domain ON forwardings (domain);
|
||||
CREATE INDEX idx_forwardings_dest_domain ON forwardings (dest_domain);
|
||||
CREATE INDEX idx_forwardings_is_list ON forwardings (is_list);
|
||||
CREATE INDEX idx_forwardings_is_forwarding ON forwardings (is_forwarding);
|
||||
CREATE INDEX idx_forwardings_is_alias ON forwardings (is_alias);
|
||||
|
||||
CREATE TABLE alias_moderators (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX idx_alias_moderators_address ON alias_moderators (address);
|
||||
CREATE INDEX idx_alias_moderators_moderator ON alias_moderators (moderator);
|
||||
CREATE INDEX idx_alias_moderators_domain ON alias_moderators (domain);
|
||||
CREATE UNIQUE INDEX idx_alias_moderators_address_moderator ON alias_moderators (address, moderator);
|
||||
|
||||
-- Grant required privilege to vmail user
|
||||
GRANT SELECT ON TABLE forwardings to vmail;
|
||||
GRANT SELECT ON TABLE alias_moderators to vmail;
|
||||
|
|
|
@ -295,16 +295,23 @@ CREATE TABLE IF NOT EXISTS alias_moderators (
|
|||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, moderator),
|
||||
INDEX (domain)
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Forwardings. it contains
|
||||
-- - members of mail alias account
|
||||
-- - per-account alias addresses
|
||||
-- - per-user mail forwarding addresses
|
||||
CREATE TABLE IF NOT EXISTS forwardings (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
|
@ -315,6 +322,7 @@ CREATE TABLE IF NOT EXISTS forwardings (
|
|||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, forwarding),
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain),
|
||||
INDEX (is_list),
|
||||
INDEX (is_alias)
|
||||
) ENGINE=InnoDB;
|
||||
|
@ -420,16 +428,33 @@ SQL structure.</p>
|
|||
<p>Please backup SQL database <code>vmail</code> before you run any SQL commands below.</p>
|
||||
</div>
|
||||
<h4 id="create-required-new-sql-tables_1">Create required new SQL tables</h4>
|
||||
<p>Please connect to PostgreSQL server as <code>vmailadmin</code> user, then execute SQL
|
||||
commands below to create required new tables:</p>
|
||||
<p>Please run shell commands below to connect to PostgreSQL server as
|
||||
<code>vmailadmin</code> user first:</p>
|
||||
<pre><code>su - postgres
|
||||
psql -U vmailadmin -d vmail
|
||||
</code></pre>
|
||||
|
||||
<p>Then execute SQL commands below to create required new tables:</p>
|
||||
<pre><code>CREATE TABLE alias_moderators (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX idx_alias_moderators_address ON alias_moderators (address);
|
||||
CREATE INDEX idx_alias_moderators_moderator ON alias_moderators (moderator);
|
||||
CREATE UNIQUE INDEX idx_alias_moderators_address_moderator ON alias_moderators (address, moderator);
|
||||
CREATE INDEX idx_alias_moderators_domain ON alias_moderators (domain);
|
||||
CREATE INDEX idx_alias_moderators_dest_domain ON alias_moderators (dest_domain);
|
||||
|
||||
CREATE TABLE forwardings (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list INT2 NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
|
@ -442,21 +467,11 @@ CREATE INDEX idx_forwardings_address ON forwardings (address);
|
|||
CREATE INDEX idx_forwardings_forwarding ON forwardings (forwarding);
|
||||
CREATE UNIQUE INDEX idx_forwardings_address_forwarding ON forwardings (address, forwarding);
|
||||
CREATE INDEX idx_forwardings_domain ON forwardings (domain);
|
||||
CREATE INDEX idx_forwardings_dest_domain ON forwardings (dest_domain);
|
||||
CREATE INDEX idx_forwardings_is_list ON forwardings (is_list);
|
||||
CREATE INDEX idx_forwardings_is_forwarding ON forwardings (is_forwarding);
|
||||
CREATE INDEX idx_forwardings_is_alias ON forwardings (is_alias);
|
||||
|
||||
CREATE TABLE alias_moderators (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX idx_alias_moderators_address ON alias_moderators (address);
|
||||
CREATE INDEX idx_alias_moderators_moderator ON alias_moderators (moderator);
|
||||
CREATE INDEX idx_alias_moderators_domain ON alias_moderators (domain);
|
||||
CREATE UNIQUE INDEX idx_alias_moderators_address_moderator ON alias_moderators (address, moderator);
|
||||
|
||||
-- Grant required privilege to vmail user
|
||||
GRANT SELECT ON TABLE forwardings to vmail;
|
||||
GRANT SELECT ON TABLE alias_moderators to vmail;
|
||||
|
|
Loading…
Reference in New Issue