Current section

65 Versions

Jump to

Compare versions

9 files changed
+84 additions
-28 deletions
  @@ -1,5 +1,15 @@
1 1 # Changelog
2 2
3 + ## v1.3.2
4 +
5 + ### Enhancements
6 +
7 + - Add postgrex `socket_options` option ([#242](https://github.com/commanded/eventstore/pull/242)).
8 +
9 + ### Bug fixes
10 +
11 + - Fix bug with subscriptions trigger in older Postgres versions ([#241](https://github.com/commanded/eventstore/pull/241)).
12 +
3 13 ## v1.3.1
4 14
5 15 ### Bug fixes
  @@ -15,6 +25,12 @@
15 25
16 26 - Fix bug with catch-up all streams subscription where the checkpoint is not committed for hard deleted streams ([#238](https://github.com/commanded/eventstore/pull/238)).
17 27
28 + ### Upgrading
29 +
30 + This release requires a database migration to be run. Please read the [Upgrading an EventStore](https://hexdocs.pm/eventstore/upgrades.html) guide for details on how to migrate an existing database.
31 +
32 + ---
33 +
18 34 ## v1.2.3
19 35
20 36 - Add `:configure` to postgrex connection options ([#233](https://github.com/commanded/eventstore/pull/233)).
  @@ -79,6 +79,7 @@
79 79 <<"priv/event_store/migrations">>,
80 80 <<"priv/event_store/migrations/v1.2.0.sql">>,
81 81 <<"priv/event_store/migrations/v1.1.0.sql">>,
82 + <<"priv/event_store/migrations/v1.3.2.sql">>,
82 83 <<"priv/event_store/migrations/v1.3.0.sql">>,
83 84 <<"priv/event_store/migrations/v0.10.0.sql">>,
84 85 <<"priv/event_store/migrations/v0.9.0.sql">>,
  @@ -93,7 +94,7 @@
93 94 <<"CHANGELOG.md">>]}.
94 95 {<<"licenses">>,[<<"MIT">>]}.
95 96 {<<"links">>,
96 - [{<<"Changelog">>,<<"https://hexdocs.pm/eventstore/1.3.1/changelog.html">>},
97 + [{<<"Changelog">>,<<"https://hexdocs.pm/eventstore/1.3.2/changelog.html">>},
97 98 {<<"GitHub">>,<<"https://github.com/commanded/eventstore">>}]}.
98 99 {<<"name">>,<<"eventstore">>}.
99 100 {<<"requirements">>,
  @@ -127,4 +128,4 @@
127 128 {<<"optional">>,true},
128 129 {<<"repository">>,<<"hexpm">>},
129 130 {<<"requirement">>,<<"~> 1.5">>}]]}.
130 - {<<"version">>,<<"1.3.1">>}.
131 + {<<"version">>,<<"1.3.2">>}.
  @@ -80,7 +80,8 @@ defmodule EventStore.Config do
80 80 :pool,
81 81 :pool_size,
82 82 :queue_target,
83 - :queue_interval
83 + :queue_interval,
84 + :socket_options
84 85 ]
85 86
86 87 def default_postgrex_opts(config) do
  @@ -1,35 +1,35 @@
1 1 defmodule EventStore.EExIOListEngine do
2 + @moduledoc false
2 3 @behaviour EEx.Engine
3 4
4 - @impl true
5 5 def init(_opts) do
6 6 %{iodata: [], dynamic: [], vars_count: 0}
7 7 end
8 8
9 - @impl true
10 9 def handle_begin(state) do
11 10 %{state | iodata: [], dynamic: []}
12 11 end
13 12
14 - @impl true
15 13 def handle_end(quoted) do
16 14 handle_body(quoted)
17 15 end
18 16
19 - @impl true
20 17 def handle_body(state) do
21 18 %{iodata: iodata, dynamic: dynamic} = state
22 19 iodata = Enum.reverse(iodata)
23 20 {:__block__, [], Enum.reverse([iodata | dynamic])}
24 21 end
25 22
26 - @impl true
23 + # Required for Elixir versions older than v1.12.0
27 24 def handle_text(state, text) do
25 + handle_text(state, [], text)
26 + end
27 +
28 + def handle_text(state, _meta, text) do
28 29 %{iodata: iodata} = state
29 30 %{state | iodata: [text | iodata]}
30 31 end
31 32
32 - @impl true
33 33 def handle_expr(state, "=", ast) do
34 34 %{iodata: iodata, dynamic: dynamic, vars_count: vars_count} = state
  @@ -186,6 +186,7 @@ defmodule EventStore.Sql.Init do
186 186 CREATE OR REPLACE FUNCTION notify_events()
187 187 RETURNS trigger AS $$
188 188 DECLARE
189 + old_stream_version bigint;
189 190 channel text;
190 191 payload text;
191 192 BEGIN
  @@ -196,8 +197,14 @@ defmodule EventStore.Sql.Init do
196 197 -- * last `stream_version`
197 198 -- Each separated by a comma (e.g. 'stream-12345,1,1,5')
198 199
200 + IF TG_OP = 'UPDATE' THEN
201 + old_stream_version := OLD.stream_version + 1;
202 + ELSE
203 + old_stream_version := 1;
204 + END IF;
205 +
199 206 channel := TG_TABLE_SCHEMA || '.events';
200 - payload := NEW.stream_uuid || ',' || NEW.stream_id || ',' || COALESCE(OLD.stream_version, 0) + 1 || ',' || NEW.stream_version;
207 + payload := NEW.stream_uuid || ',' || NEW.stream_id || ',' || old_stream_version || ',' || NEW.stream_version;
201 208
202 209 -- Notify events to listeners
203 210 PERFORM pg_notify(channel, payload);
  @@ -267,7 +274,7 @@ defmodule EventStore.Sql.Init do
267 274 defp record_event_store_schema_version do
268 275 """
269 276 INSERT INTO schema_migrations (major_version, minor_version, patch_version)
270 - VALUES (1, 3, 0);
277 + VALUES (1, 3, 2);
271 278 """
272 279 end
273 280 end
Loading more files…