pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
branchv0.6.x
changeset 387 05dc4e1f8dff
parent 382 5e6bcb2e010e
child 388 dd95ed5bc9d2
equal deleted inserted replaced
386:b7854259ad74 387:05dc4e1f8dff
    71     uid         bigint NOT NULL,
    71     uid         bigint NOT NULL,
    72     bytes       bigint NOT NULL DEFAULT 0,
    72     bytes       bigint NOT NULL DEFAULT 0,
    73     messages    integer NOT NULL DEFAULT 0,
    73     messages    integer NOT NULL DEFAULT 0,
    74     CONSTRAINT  pkey_userquota PRIMARY KEY (uid),
    74     CONSTRAINT  pkey_userquota PRIMARY KEY (uid),
    75     CONSTRAINT  fkey_userquota_uid_users FOREIGN KEY (uid)
    75     CONSTRAINT  fkey_userquota_uid_users FOREIGN KEY (uid)
    76         REFERENCES users (uid)
    76         REFERENCES users (uid) ON DELETE CASCADE
    77 );
    77 );
    78 
    78 
    79 CREATE OR REPLACE FUNCTION merge_userquota() RETURNS TRIGGER AS $$
    79 CREATE OR REPLACE FUNCTION merge_userquota() RETURNS TRIGGER AS $$
    80 BEGIN
    80 BEGIN
    81     IF NEW.messages < 0 OR NEW.messages IS NULL THEN
    81     IF NEW.messages < 0 OR NEW.messages IS NULL THEN