Skip to content

Commit 99ba8e4

Browse files
committed
Use timestamp with time zone for timestamp fields in projection_versions.
Fixes #20.
1 parent 34e7660 commit 99ba8e4

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Upgrading
6+
7+
- Upgrade your existing `projection_versions` table by running:
8+
9+
```sql
10+
ALTER TABLE projection_versions ALTER COLUMN inserted_at TYPE timestamp with time zone USING inserted_at AT TIME ZONE 'UTC';
11+
ALTER TABLE projection_versions ALTER COLUMN updated_at TYPE timestamp with time zone USING updated_at AT TIME ZONE 'UTC';
12+
```
13+
314
## 1.4.0
415

516
### Enhancements

lib/projections/ecto.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ defmodule Commanded.Projections.Ecto do
211211
schema "projection_versions" do
212212
field(:last_seen_event_number, :integer)
213213

214-
timestamps(type: :naive_datetime_usec)
214+
timestamps(type: :utc_datetime_usec)
215215
end
216216
end
217217
end

priv/repo/migrations/20170609113553_create_projection_versions.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Commanded.Projections.Repo.Migrations.CreateProjectionVersions do
66
add(:projection_name, :text, primary_key: true)
77
add(:last_seen_event_number, :bigint)
88

9-
timestamps(type: :naive_datetime_usec)
9+
timestamps(type: :timestamptz)
1010
end
1111
end
1212
end

priv/repo/migrations/20170929080308_create_projection_version_with_prefix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule Commanded.Projections.Repo.Migrations.CreateProjectionVersionWithPrefi
88
add(:projection_name, :text, primary_key: true)
99
add(:last_seen_event_number, :bigint)
1010

11-
timestamps(type: :naive_datetime_usec)
11+
timestamps(type: :timestamptz)
1212
end
1313
end
1414

0 commit comments

Comments
 (0)