update check
This commit is contained in:
parent
fdbd8d3d7c
commit
ef7a365287
@ -143,10 +143,12 @@ drop table if exists user_stat;
|
||||
create table user_stat
|
||||
(
|
||||
user_id int PRIMARY KEY,
|
||||
user_limit int NOT NULL,
|
||||
user_usedspace int NOT NULL DEFAULT 0,
|
||||
user_bookcount int NOT NULL DEFAULT 0,
|
||||
user_doccount int NOT NULL DEFAULT 0,
|
||||
user_notecount int NOT NULL DEFAULT 0,
|
||||
CONSTRAINT `fk_user_stat_user` FOREIGN KEY (`user_id`) REFERENCES user(`user_id`) ON DELETE RESTRICT
|
||||
CONSTRAINT `fk_user_stat_user` FOREIGN KEY (`user_id`) REFERENCES user(`user_id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `ck_usedspace` CHECK (user_usedspace <= user_limit)
|
||||
);
|
||||
-- insert into user_stat values (1,1,1,1,1);
|
||||
-- insert into user_stat values (1,1,1,1,1,1);
|
||||
@ -2,7 +2,7 @@ drop trigger if exists `trig_create_user_stat`;
|
||||
create trigger `trig_create_user_stat`
|
||||
after insert on user
|
||||
for each row begin
|
||||
insert into user_stat (`user_id`) values(NEW.user_id);
|
||||
insert into user_stat (`user_id`, `user_limit`) values(NEW.user_id, NEW.user_limit);
|
||||
end;
|
||||
|
||||
drop trigger if exists `trig_delete_user_stat`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user