correct folder
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8ae67799a1
commit
7021e52705
|
@ -0,0 +1,27 @@
|
||||||
|
create table `salix`.`authCode`
|
||||||
|
(
|
||||||
|
userFk int UNSIGNED not null,
|
||||||
|
code int not null,
|
||||||
|
expires TIMESTAMP not null,
|
||||||
|
constraint authCode_pk
|
||||||
|
primary key (userFk),
|
||||||
|
constraint authCode_unique
|
||||||
|
unique (code),
|
||||||
|
constraint authCode_user_id_fk
|
||||||
|
foreign key (userFk) references `account`.`user` (id)
|
||||||
|
on update cascade on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table `salix`.`userAccess`
|
||||||
|
(
|
||||||
|
userFk int UNSIGNED not null,
|
||||||
|
ip VARCHAR(25) not null,
|
||||||
|
agent text null,
|
||||||
|
platform VARCHAR(25) null,
|
||||||
|
browser VARCHAR(25) null,
|
||||||
|
constraint userAccess_pk
|
||||||
|
primary key (userFk),
|
||||||
|
constraint userAccess_user_null_fk
|
||||||
|
foreign key (userFk) references `account`.`user` (id)
|
||||||
|
)
|
||||||
|
auto_increment = 0;
|
|
@ -0,0 +1,24 @@
|
||||||
|
alter table `vn`.`department`
|
||||||
|
add `twoFactor` ENUM ('email') null comment 'Default user two-factor auth type';
|
||||||
|
|
||||||
|
drop trigger `vn`.`department_afterUpdate`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
create definer = root@localhost trigger department_afterUpdate
|
||||||
|
after update
|
||||||
|
on department
|
||||||
|
for each row
|
||||||
|
BEGIN
|
||||||
|
IF !(OLD.parentFk <=> NEW.parentFk) THEN
|
||||||
|
UPDATE vn.department_recalc SET isChanged = TRUE;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(OLD.twoFactor <=> NEW.twoFactor) THEN
|
||||||
|
UPDATE account.user u
|
||||||
|
JOIN vn.workerDepartment wd ON wd.workerFk = u.id
|
||||||
|
SET u.twoFactor = NEW.twoFactor
|
||||||
|
WHERE wd.departmentFk = NEW.id;
|
||||||
|
END IF;
|
||||||
|
END;$$
|
||||||
|
DELIMITER ;
|
Loading…
Reference in New Issue