@@ -30,61 +30,61 @@ You should already have [Ecto](https://github.com/elixir-ecto/ecto) installed an
3030
31311 . Add ` commanded_ecto_projections ` to your list of dependencies in ` mix.exs ` :
3232
33- ``` elixir
34- def deps do
35- [
36- {:commanded_ecto_projections , " ~> 0.8" },
37- ]
38- end
39- ```
33+ ``` elixir
34+ def deps do
35+ [
36+ {:commanded_ecto_projections , " ~> 0.8" },
37+ ]
38+ end
39+ ```
4040
41412 . Configure ` commanded_ecto_projections ` with the Ecto repo used by your application:
4242
43- ```elixir
44- config :commanded_ecto_projections ,
45- repo: MyApp .Projections .Repo
46- ```
43+ ``` elixir
44+ config :commanded_ecto_projections ,
45+ repo: MyApp .Projections .Repo
46+ ```
4747
48- Or alternatively in case of umbrella application define it later per projection:
48+ Or alternatively in case of umbrella application define it later per projection:
4949
50- ```elixir
51- defmodule MyApp .ExampleProjector do
52- use Commanded .Projections .Ecto ,
53- name: " example_projection" ,
54- repo: MyApp .Projections .Repo
50+ ``` elixir
51+ defmodule MyApp .ExampleProjector do
52+ use Commanded .Projections .Ecto ,
53+ name: " example_projection" ,
54+ repo: MyApp .Projections .Repo
5555
56- .. .
57- end
58- ```
56+ .. .
57+ end
58+ ```
5959
60603 . Generate an Ecto migration in your app:
6161
62- ```console
63- $ mix ecto.gen.migration create_projection_versions
64- ```
62+ ``` console
63+ $ mix ecto.gen.migration create_projection_versions
64+ ```
6565
66664 . Modify the generated migration, in ` priv/repo/migrations ` , to create the ` projection_versions ` table:
6767
68- ```elixir
69- defmodule CreateProjectionVersions do
70- use Ecto .Migration
68+ ``` elixir
69+ defmodule CreateProjectionVersions do
70+ use Ecto .Migration
7171
72- def change do
73- create table (:projection_versions , primary_key: false ) do
74- add :projection_name , :text , primary_key: true
75- add :last_seen_event_number , :bigint
72+ def change do
73+ create table (:projection_versions , primary_key: false ) do
74+ add :projection_name , :text , primary_key: true
75+ add :last_seen_event_number , :bigint
7676
77- timestamps ()
78- end
79- end
80- end
81- ```
77+ timestamps (type: :timestamptz )
78+ end
79+ end
80+ end
81+ ```
8282
83- 4 . Run the Ecto migration:
83+ 5 . Run the Ecto migration:
8484
85- ```console
86- $ mix ecto.migrate
87- ```
85+ ``` console
86+ $ mix ecto.migrate
87+ ```
8888
8989### Schema Prefix
9090
@@ -250,19 +250,19 @@ To rebuild a projection you will need to:
250250
2512511 . Delete the row containing the last seen event for the projection name:
252252
253- ``` SQL
254- delete from projection_versions
255- where projection_name = ' example_projection' ;
256- ```
253+ ``` SQL
254+ delete from projection_versions
255+ where projection_name = ' example_projection' ;
256+ ```
257257
2582582 . Truncate the tables that are being populated by the projection, and restart their identity:
259259
260- ` ` ` SQL
261- truncate table
262- example_projections,
263- other_projections
264- restart identity;
265- ` ` `
260+ ``` SQL
261+ truncate table
262+ example_projections,
263+ other_projections
264+ restart identity;
265+ ```
266266
267267You will also need to reset the event store subscription for the commanded event handler. This is specific to whichever event store you are using.
268268
0 commit comments