Skip to content

Commit

Permalink
Merge pull request #1072 from BigG1947/1036-cache-invalidation-data
Browse files Browse the repository at this point in the history
1036, add primary key to sys.states table
  • Loading branch information
Fivell authored Nov 30, 2021
2 parents 7bdafb1 + e2c0bb9 commit 83460de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/system/state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Table name: sys.states
#
# key :string primary key
# key :string not null, primary key
# value :bigint(8) default(0), not null
#
class System::State < ApplicationRecord
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20211130142405_add_primary_key_to_sys_state_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddPrimaryKeyToSysStateTable < ActiveRecord::Migration[6.1]
def up
execute <<-SQL
ALTER TABLE sys.states ADD PRIMARY KEY (key);
SQL
end

def down
execute <<-SQL
ALTER TABLE IF EXISTS sys.states DROP CONSTRAINT states_pkey;
SQL
end
end
13 changes: 11 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25894,7 +25894,7 @@ ALTER SEQUENCE sys.smtp_connections_id_seq OWNED BY sys.smtp_connections.id;
--

CREATE TABLE sys.states (
key character varying,
key character varying NOT NULL,
value bigint DEFAULT 0 NOT NULL
);

Expand Down Expand Up @@ -28652,6 +28652,14 @@ ALTER TABLE ONLY sys.smtp_connections
ADD CONSTRAINT smtp_connections_pkey PRIMARY KEY (id);


--
-- Name: states states_pkey; Type: CONSTRAINT; Schema: sys; Owner: -
--

ALTER TABLE ONLY sys.states
ADD CONSTRAINT states_pkey PRIMARY KEY (key);


--
-- Name: timezones timezones_name_key; Type: CONSTRAINT; Schema: sys; Owner: -
--
Expand Down Expand Up @@ -29958,6 +29966,7 @@ INSERT INTO "public"."schema_migrations" (version) VALUES
('20211002164333'),
('20211004152514'),
('20211005184247'),
('20211130113417');
('20211130113417'),
('20211130142405');


2 changes: 1 addition & 1 deletion spec/fixtures/sys.states.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Table name: sys.states
#
# key :string primary key
# key :string not null, primary key
# value :bigint(8) default(0), not null
#

Expand Down

0 comments on commit 83460de

Please sign in to comment.