cfmgrv4/app/Database/update.txt
2024-10-28 11:37:01 +09:00

43 lines
1.9 KiB
Plaintext

###cloudflareaccount 조정###
1. 필드추가
alter table cloudflareaccount add column id varchar(30) not null after auth_uid;
alter table cloudflareaccount add column authkey varchar(255) not null after id;
alter table cloudflareaccount add column oldkey varchar(255) null after authkey;
2. 내용복사
update cloudflareaccount
join cloudflareauth on cloudflareaccount.auth_uid = cloudflareauth.uid
set cloudflareaccount.id=cloudflareauth.id,
cloudflareaccount.authkey=cloudflareauth.authkey,
cloudflareaccount.oldkey=cloudflareauth.oldkey
3. foreign key 삭제 , index key 삭제
show create table cloudflareaccount;
ALTER TABLE cloudflareaccount DROP FOREIGN KEY cloudflareaccount_ibfk_1;
ALTER TABLE cloudflareaccount DROP KEY cloudflareaccount_ibfk_1;
4. auth_uid column 삭제
show create table cloudflareaccount;
ALTER TABLE cloudflareaccount DROP column auth_uid;
5. id unique key 추가
ALTER TABLE cloudflareaccount ADD UNIQUE key cloudflareaccount_ibuk_1 (id);
ALTER TABLE cloudflareaccount ADD UNIQUE key cloudflareaccount_ibuk_2 (authkey);
6. auditlog용 table추가
CREATE TABLE cloudflareauditlog (
uid varchar(255) NOT NULL COMMENT 'id',
action varchar(100) NOT NULL COMMENT 'action->type',
action_info varchar(255) NULL COMMENT 'action->info',
actor varchar(100) NOT NULL COMMENT 'actor->type',
interface varchar(100) NULL COMMENT 'interface',
zone_id varchar(100) NOT NULL COMMENT 'newValueJson->zone_id',
zone_name varchar(100) NULL COMMENT 'newValueJson->zone_name',
resource_id varchar(100) NOT NULL COMMENT 'newValueJson->id',
resource_name varchar(100) NULL COMMENT 'newValueJson->name',
resource_type varchar(50) NULL COMMENT 'newValueJson->type',
status varchar(10) NOT NULL COMMENT 'action->result',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL COMMENT 'when',
PRIMARY KEY (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='cloudflare Auditlog 정보';