create_tables.pgsql
changeset 7 96761c442dcf
parent 6 07d141039f74
child 8 7e3ce56f49e6
equal deleted inserted replaced
6:07d141039f74 7:96761c442dcf
    59         REFERENCES maildir (mid),
    59         REFERENCES maildir (mid),
    60     CONSTRAINT fkey_users_tid_transport FOREIGN KEY (tid)
    60     CONSTRAINT fkey_users_tid_transport FOREIGN KEY (tid)
    61         REFERENCES transport (tid)
    61         REFERENCES transport (tid)
    62 );
    62 );
    63 
    63 
    64 CREATE SEQUENCE alias_id;
       
    65 CREATE TABLE alias (
    64 CREATE TABLE alias (
    66     id          bigint NOT NULL DEFAULT nextval('alias_id'),
       
    67     gid         bigint NOT NULL,
    65     gid         bigint NOT NULL,
    68     address     varchar(256) NOT NULL,
    66     address     varchar(256) NOT NULL,
    69     destination varchar(320) NOT NULL,
    67     destination varchar(320) NOT NULL,
    70     CONSTRAINT pkey_alias PRIMARY KEY (gid, address, destination),
    68     CONSTRAINT pkey_alias PRIMARY KEY (gid, address, destination),
    71     CONSTRAINT fkey_alias_gid_domains FOREIGN KEY (gid)
    69     CONSTRAINT fkey_alias_gid_domains FOREIGN KEY (gid)
    72         REFERENCES domains (gid)
    70         REFERENCES domains (gid)
    73 );
    71 );
    74 
    72 
    75 CREATE SEQUENCE relocated_id;
       
    76 CREATE TABLE relocated (
    73 CREATE TABLE relocated (
    77     id          bigint NOT NULL DEFAULT nextval('relocated_id'),
       
    78     gid         bigint NOT NULL,
    74     gid         bigint NOT NULL,
    79     address     varchar(64) NOT NULL,
    75     address     varchar(64) NOT NULL,
    80     destination varchar(320) NOT NULL,
    76     destination varchar(320) NOT NULL,
    81     CONSTRAINT pkey_relocated PRIMARY KEY (gid, address),
    77     CONSTRAINT pkey_relocated PRIMARY KEY (gid, address),
    82     CONSTRAINT fkey_relocated_gid_domains FOREIGN KEY (gid)
    78     CONSTRAINT fkey_relocated_gid_domains FOREIGN KEY (gid)