Migrating ci_builds data to ci_artifacts
Artifacts will get their own table, and data needs to be moved from the ci_builds table.
Artifacts will have:
- id (primary key, auto increment)
- project_id
- build_id
- size, integer, limit: 8
- type (integer, enum, to differentiate between archive/metadata/trace)
- created_at
- updated_at
- erased_at
- erased_by_id
- expire_at
- file (text, carrierwave will mount this)
- is either
artifacts_fileor theartifacts_metadatacolumn - Trace is added later, but we might claim the ids already?
- is either
All these columns, expect the id, come from ci_builds. To move this data we have a few options:
- Usual way:
- Create table with all columns
- Add indexes and FKs
- Migrate data to there using
INSERT INTO
- CREATE TABLE AS
- Migrate and create in one go
- create primary key column and set all ids
- Copy the whole table
- Seems overkill, as there is much data we really dont need
- Please make suggestions in the notes
Now, what we'd like, is to be able to sort on the id so we know it maps to the build_id so we know that a low ID is created before each higher id. Thinking about this a bit more, I wonder how realistic this really is, but it would be nice as else me might need another index on this column.
Edited by 🤖 GitLab Bot 🤖