mirror of
https://github.com/openziti/zrok.git
synced 2025-03-02 17:12:10 +01:00
fixes to postgres migrations to prevent primary key collisions (#160); fixes to migrations to remove renaming lint
This commit is contained in:
parent
8ef5225b20
commit
8f517876e0
@ -19,6 +19,7 @@ alter table services rename backend to backend_proxy_endpoint;
|
||||
alter table services rename name to token;
|
||||
|
||||
alter table services rename to services_old;
|
||||
alter sequence services_id_seq rename to services_id_seq_old;
|
||||
|
||||
create table services (
|
||||
id serial primary key,
|
||||
@ -41,4 +42,6 @@ create table services (
|
||||
insert into services (id, environment_id, z_id, token, share_mode, backend_mode, frontend_selection, frontend_endpoint, backend_proxy_endpoint, created_at, updated_at)
|
||||
select id, environment_id, z_id, token, share_mode, backend_mode, frontend_selection, frontend_endpoint, backend_proxy_endpoint, created_at, updated_at from services_old;
|
||||
|
||||
select setval('services_id_seq', (select max(id) from services));
|
||||
|
||||
drop table services_old;
|
@ -1,8 +1,8 @@
|
||||
-- +migrate Up
|
||||
|
||||
alter table services rename to shares;
|
||||
alter sequence services_id_seq1 rename to shares_id_seq1;
|
||||
alter index services_pkey1 rename to shares_pkey1;
|
||||
alter sequence services_id_seq rename to shares_id_seq;
|
||||
alter index services_pkey1 rename to shares_pkey;
|
||||
alter index services_token_key rename to shares_token_key;
|
||||
alter index services_z_id_key1 rename to shares_z_id_key1;
|
||||
alter index services_z_id_key1 rename to shares_z_id_key;
|
||||
alter table shares rename constraint services_environment_id_fkey to shares_environment_id_fkey;
|
@ -1,6 +1,7 @@
|
||||
-- +migrate Up
|
||||
|
||||
alter table accounts rename to accounts_old;
|
||||
alter sequence accounts_id_seq rename to accounts_id_seq_old;
|
||||
|
||||
create table accounts (
|
||||
id serial primary key,
|
||||
@ -19,7 +20,13 @@ create table accounts (
|
||||
insert into accounts(id, email, password, token, created_at, updated_at)
|
||||
select id, email, password, token, created_at, updated_at from accounts_old;
|
||||
|
||||
select setval('accounts_id_seq', (select max(id) from accounts));
|
||||
|
||||
alter table environments drop constraint fk_accounts_id;
|
||||
alter table environments add constraint fk_accounts_id foreign key (account_id) references accounts(id);
|
||||
|
||||
drop table accounts_old;
|
||||
drop table accounts_old;
|
||||
|
||||
alter index accounts_pkey1 rename to accounts_pkey;
|
||||
alter index accounts_email_key1 rename to accounts_email_key;
|
||||
alter index accounts_token_key1 rename to accounts_token_key;
|
||||
|
Loading…
Reference in New Issue
Block a user