DROP TABLE IF EXISTS `users`;
create table `users`
(
    id            binary(16)   default (uuid_to_bin(
            uuid(),
            1)) primary key,
    username      varchar(256) unique                       not null,
    password      varchar(256)                              not null,
    nickname      varchar(256)                              not null,
    prermissions  json,
    roles         json,
    icon          mediumblob,
    admin         bool         default false,
    creation_time timestamp(6) default current_timestamp(6) not null,
    creator_id     binary(16)                                not null,
    update_time   timestamp(6)                              null,
    regenerator_id binary(16)                                null,
    foreign key (creator_id) references users (id),
    foreign key (regenerator_id) references users (id)
);
INSERT INTO users (id, username, password, nickname, prermissions, roles, icon, admin, creator_id, regenerator_id) VALUES (0x689EFC204D1F11F08134DB0063E177A7, 'admin', 'admin', '管理员', '[]', '[]', null, 1, 0x689EFC204D1F11F08134DB0063E177A7, 0x689EFC204D1F11F08134DB0063E177A7);
