Skip to content

Commit

Permalink
fixes (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Apr 17, 2023
1 parent c28dd75 commit 29c26b9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
36 changes: 32 additions & 4 deletions controller/store/sql/sqlite3/011_v0_4_0_update_backend_modes.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-- +migrate Up

alter table shares rename to shares_old;

CREATE TABLE shares (
create table shares (
id integer primary key,
environment_id integer constraint fk_environments_shares references environments on delete cascade,
z_id string not null unique,
Expand All @@ -21,6 +20,35 @@ CREATE TABLE shares (
constraint chk_share_mode check (share_mode == 'public' or share_mode == 'private'),
constraint chk_backend_mode check (backend_mode == 'proxy' or backend_mode == 'web' or backend_mode == 'tunnel')
);

insert into shares select * from shares_old;
drop table shares_old;
drop table shares_old;

alter table frontends rename to frontends_old;
create table frontends (
id integer primary key,
environment_id integer references environments(id),
token varchar(32) not null unique,
z_id varchar(32) not null,
public_name varchar(64) unique,
url_template varchar(1024),
reserved boolean not null default(false),
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
deleted boolean not null default(false),
private_share_id integer references shares(id)
);
insert into frontends select * from frontends_old;
drop table frontends_old;

alter table share_limit_journal rename to share_limit_journal_old;
create table share_limit_journal (
id integer primary key,
share_id integer references shares(id),
rx_bytes bigint not null,
tx_bytes bigint not null,
action limit_action_type not null,
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now'))
);
insert into share_limit_journal select * from share_limit_journal_old;
drop table share_limit_journal_old;
2 changes: 1 addition & 1 deletion endpoints/tunnelBackend/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func New(cfg *Config) (*Backend, error) {
return nil, errors.Wrap(err, "error loading config")
}
listener, err := ziti.NewContextWithConfig(zcfg).ListenWithOptions(cfg.ShrToken, &options)
if err == nil {
if err != nil {
return nil, errors.Wrap(err, "error listening")
}
b := &Backend{
Expand Down

0 comments on commit 29c26b9

Please sign in to comment.