重构通道管理逻辑,支持通过任务删除不同类型通道;引入 Asynq 处理异步任务;更新数据库结构以支持通道类型区分
This commit is contained in:
@@ -1,22 +1,3 @@
|
||||
-- 清空数据表
|
||||
do
|
||||
$$
|
||||
declare
|
||||
r record;
|
||||
begin
|
||||
for r in (
|
||||
select
|
||||
tablename
|
||||
from
|
||||
pg_tables
|
||||
where
|
||||
schemaname = 'public'
|
||||
) loop
|
||||
execute 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
|
||||
end loop;
|
||||
end
|
||||
$$;
|
||||
|
||||
-- ====================
|
||||
-- region 日志
|
||||
-- ====================
|
||||
@@ -620,39 +601,39 @@ comment on column whitelist.deleted_at is '删除时间';
|
||||
-- channel
|
||||
drop table if exists channel cascade;
|
||||
create table channel (
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
proxy_id int not null references proxy (id) --
|
||||
on update cascade --
|
||||
proxy_id int not null references proxy (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
edge_id int references edge (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
proxy_host varchar(255) not null default '',
|
||||
proxy_port int not null,
|
||||
edge_host varchar(255),
|
||||
protocol int,
|
||||
auth_ip bool not null default false,
|
||||
whitelists text,
|
||||
auth_pass bool not null default false,
|
||||
username varchar(255),
|
||||
password varchar(255),
|
||||
expiration timestamp not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
edge_id int references edge (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
resource_id int references resource (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
proxy_host varchar(255) not null default '',
|
||||
proxy_port int not null,
|
||||
edge_host varchar(255),
|
||||
protocol int,
|
||||
auth_ip bool not null default false,
|
||||
whitelists text,
|
||||
auth_pass bool not null default false,
|
||||
username varchar(255),
|
||||
password varchar(255),
|
||||
expiration timestamp not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
);
|
||||
create index channel_user_id_index on channel (user_id);
|
||||
create index channel_proxy_id_index on channel (proxy_id);
|
||||
create index channel_edge_id_index on channel (edge_id);
|
||||
create index channel_proxy_host_index on channel (proxy_host);
|
||||
create index channel_proxy_port_index on channel (proxy_port);
|
||||
create index channel_edge_host_index on channel (edge_host);
|
||||
create index channel_resource_id_index on channel (resource_id);
|
||||
create index channel_auth_ip_index on channel (auth_ip);
|
||||
create index channel_auth_pass_index on channel (auth_pass);
|
||||
create index channel_username_index on channel (username);
|
||||
create index channel_expiration_index on channel (expiration);
|
||||
create index channel_deleted_at_index on channel (deleted_at);
|
||||
|
||||
@@ -662,6 +643,7 @@ comment on column channel.id is '通道ID';
|
||||
comment on column channel.user_id is '用户ID';
|
||||
comment on column channel.proxy_id is '代理ID';
|
||||
comment on column channel.edge_id is '节点ID';
|
||||
comment on column channel.resource_id is '套餐ID';
|
||||
comment on column channel.proxy_host is '代理地址';
|
||||
comment on column channel.proxy_port is '转发端口';
|
||||
comment on column channel.edge_host is '节点地址';
|
||||
|
||||
Reference in New Issue
Block a user