Skip to content

Commit 4e90e00

Browse files
committed
add applied at
1 parent 8049444 commit 4e90e00

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

gloat.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gloat
22

33
import (
44
"database/sql"
5+
"time"
56
)
67

78
// Gloat glues all the components needed to apply and revert
@@ -86,6 +87,7 @@ func (c *Gloat) Current() (*Migration, error) {
8687

8788
// Apply applies a migration.
8889
func (c *Gloat) Apply(migration *Migration) error {
90+
migration.AppliedAt = time.Now().UTC()
8991
return c.Executor.Up(migration, c.Store)
9092
}
9193

gloat_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func TestCurrent_Nil(t *testing.T) {
199199
func TestApply(t *testing.T) {
200200
called := false
201201

202+
m := &Migration{}
202203
gl.Store = &testingStore{}
203204
gl.Executor = &stubbedExecutor{
204205
up: func(*Migration, Store) error {
@@ -207,9 +208,10 @@ func TestApply(t *testing.T) {
207208
},
208209
}
209210

210-
gl.Apply(nil)
211+
gl.Apply(m)
211212

212213
assert.True(t, called)
214+
assert.NotEmpty(t, m.AppliedAt)
213215
}
214216

215217
func TestRevert(t *testing.T) {

0 commit comments

Comments
 (0)