equal
deleted
inserted
replaced
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 |