Skip to content

Commit

Permalink
[db] add missing messagebus migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Jun 4, 2019
1 parent 080dac5 commit 60a191b
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
9 changes: 9 additions & 0 deletions db/migrate/20190603140450_ensure_message_bus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class EnsureMessageBus < ActiveRecord::Migration[5.2]
def down
drop_table :message_bus
end

def up
MessageBus.reset!
end
end
64 changes: 63 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,38 @@ CREATE SEQUENCE public.integrations_id_seq
ALTER SEQUENCE public.integrations_id_seq OWNED BY public.integrations.id;


--
-- Name: message_bus; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.message_bus (
id bigint NOT NULL,
channel text NOT NULL,
value text NOT NULL,
added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
CONSTRAINT message_bus_value_check CHECK ((octet_length(value) >= 2))
);


--
-- Name: message_bus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.message_bus_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: message_bus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.message_bus_id_seq OWNED BY public.message_bus.id;


--
-- Name: metrics; Type: TABLE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -758,6 +790,13 @@ ALTER TABLE ONLY public.integration_states ALTER COLUMN id SET DEFAULT nextval('
ALTER TABLE ONLY public.integrations ALTER COLUMN id SET DEFAULT nextval('public.integrations_id_seq'::regclass);


--
-- Name: message_bus id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.message_bus ALTER COLUMN id SET DEFAULT nextval('public.message_bus_id_seq'::regclass);


--
-- Name: metrics id; Type: DEFAULT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -869,6 +908,14 @@ ALTER TABLE ONLY public.integrations
ADD CONSTRAINT integrations_pkey PRIMARY KEY (id);


--
-- Name: message_bus message_bus_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.message_bus
ADD CONSTRAINT message_bus_pkey PRIMARY KEY (id);


--
-- Name: metrics metrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1175,6 +1222,20 @@ CREATE INDEX que_jobs_data_gin_idx ON public.que_jobs USING gin (data jsonb_path
CREATE INDEX que_poll_idx ON public.que_jobs USING btree (queue, priority, run_at, id) WHERE ((finished_at IS NULL) AND (expired_at IS NULL));


--
-- Name: table_added_at_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX table_added_at_index ON public.message_bus USING btree (added_at);


--
-- Name: table_channel_id_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX table_channel_id_index ON public.message_bus USING btree (channel, id);


--
-- Name: que_jobs que_job_notify; Type: TRIGGER; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1387,6 +1448,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20170620114832'),
('20181019101631'),
('20190410112007'),
('20190530080459');
('20190530080459'),
('20190603140450');


0 comments on commit 60a191b

Please sign in to comment.