Skip to content

Commit

Permalink
satellite/metainfo/metabase: add created_at and repaired_at to segments
Browse files Browse the repository at this point in the history
The created_at columns is first added without a default value to avoid
setting the current time to existing segments.

Change-Id: Ic2fe3da238422e2949e6f3016fbac04eb89ba037
  • Loading branch information
kaloyan-raev authored and mniewrzal committed Mar 10, 2021
1 parent e0f07ef commit bdb33b3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions satellite/metainfo/metabase/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,23 @@ func (db *DB) PostgresMigration() *migrate.Migration {
`ALTER TABLE segments DROP COLUMN remote_pieces`,
},
},
{
DB: &db.db,
Description: "add created_at and repaired_at columns to segments table",
Version: 7,
Action: migrate.SQL{
`ALTER TABLE segments ADD COLUMN created_at TIMESTAMPTZ`,
`ALTER TABLE segments ADD COLUMN repaired_at TIMESTAMPTZ`,
},
},
{
DB: &db.db,
Description: "change default of created_at column in segments table to now()",
Version: 8,
Action: migrate.SQL{
`ALTER TABLE segments ALTER COLUMN created_at SET DEFAULT now()`,
},
},
},
}
}
Expand Down

0 comments on commit bdb33b3

Please sign in to comment.