satellite/metabase: add segment_copies table
Part of server-side copy implementation. Adds new table to metabase for keeping references between copied segments and its ancestors. Fixes https://github.com/storj/team-metainfo/issues/84 Change-Id: I436d4b533a3d951bcd752e222e3b721cee7f0844
This commit is contained in:
parent
06944f062d
commit
95921b8b39
@ -328,6 +328,21 @@ func (db *DB) PostgresMigration() *migrate.Migration {
|
||||
`ALTER TABLE segments ADD COLUMN placement integer`,
|
||||
},
|
||||
},
|
||||
{
|
||||
DB: &db.db,
|
||||
Description: "add table for segment copies",
|
||||
Version: 15,
|
||||
Action: migrate.SQL{
|
||||
`CREATE TABLE segment_copies (
|
||||
stream_id BYTEA NOT NULL,
|
||||
ancestor_stream_id BYTEA NOT NULL,
|
||||
|
||||
PRIMARY KEY (stream_id, ancestor_stream_id),
|
||||
CONSTRAINT not_self_ancestor CHECK (stream_id != ancestor_stream_id)
|
||||
)`,
|
||||
`CREATE INDEX ON segment_copies (ancestor_stream_id)`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user