mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 01:23:49 +01:00
Merge pull request #514 from openziti/migration_fix_2
Migration Fix Redux (#504)
This commit is contained in:
commit
8d7c0d73b7
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
CHANGE: Updated `github.com/rubenv/sql-migrate` to `v1.6.0`
|
CHANGE: Updated `github.com/rubenv/sql-migrate` to `v1.6.0`
|
||||||
|
|
||||||
FIX: The migration `sqlite3/015_v0_4_19_share_unique_name_constraint.sql` has been adjusted to remove soft-deleted records from the `frontends` table when applying. This was necessary to properly support the foreign key relationship when migrating. A future release will revisit sqlite3 foreign key relationships (https://github.com/openziti/zrok/issues/504)
|
FIX: The migration `sqlite3/015_v0_4_19_share_unique_name_constraint.sql` has been adjusted to delete the old `shares_old` table as the last step of the migration process. Not sure exactly why, but SQLite is unhappy otherwise (https://github.com/openziti/zrok/issues/504)
|
||||||
|
|
||||||
## v0.4.20
|
## v0.4.20
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ create table shares (
|
|||||||
constraint chk_backend_mode check (backend_mode == 'proxy' or backend_mode == 'web' or backend_mode == 'tcpTunnel' or backend_mode == 'udpTunnel' or backend_mode == 'caddy' or backend_mode == 'drive')
|
constraint chk_backend_mode check (backend_mode == 'proxy' or backend_mode == 'web' or backend_mode == 'tcpTunnel' or backend_mode == 'udpTunnel' or backend_mode == 'caddy' or backend_mode == 'drive')
|
||||||
);
|
);
|
||||||
insert into shares select * from shares_old;
|
insert into shares select * from shares_old;
|
||||||
drop table shares_old;
|
|
||||||
create unique index shares_token_idx ON shares(token) WHERE deleted is false;
|
create unique index shares_token_idx ON shares(token) WHERE deleted is false;
|
||||||
|
|
||||||
alter table frontends rename to frontends_old;
|
alter table frontends rename to frontends_old;
|
||||||
@ -39,7 +38,7 @@ create table frontends (
|
|||||||
deleted boolean not null default(false),
|
deleted boolean not null default(false),
|
||||||
private_share_id integer references shares(id)
|
private_share_id integer references shares(id)
|
||||||
);
|
);
|
||||||
insert into frontends select * from frontends_old where not deleted;
|
insert into frontends select * from frontends_old;
|
||||||
drop table frontends_old;
|
drop table frontends_old;
|
||||||
|
|
||||||
alter table share_limit_journal rename to share_limit_journal_old;
|
alter table share_limit_journal rename to share_limit_journal_old;
|
||||||
@ -53,4 +52,6 @@ create table share_limit_journal (
|
|||||||
updated_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;
|
insert into share_limit_journal select * from share_limit_journal_old;
|
||||||
drop table share_limit_journal_old;
|
drop table share_limit_journal_old;
|
||||||
|
|
||||||
|
drop table shares_old;
|
Loading…
Reference in New Issue
Block a user