From 25df666156279e5b392b429519b4f4ba01eefaac Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 19 Sep 2017 09:14:06 +0200 Subject: Create Ci::Artifacts To allow jobs/builds to have multiple artifacts, and to start seperating concerns from Ci::Build a new model is created: Ci::Artifact. Changes include the updating of the ArtifactUploader to adapt to a slightly different interface. The uploader expects to be initialized with a `Ci::Build`. Futher a migration with the minimal fields, the needed foreign keys and an index. Last, the way this works is by prepending a module to Ci::Build so we can basically override behaviour but if needed use `super` to get the original behaviour. --- db/migrate/20170918072948_create_artifacts.rb | 5 +---- db/schema.rb | 8 +++----- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'db') diff --git a/db/migrate/20170918072948_create_artifacts.rb b/db/migrate/20170918072948_create_artifacts.rb index dd0af2a7066..1dd5edc3f15 100644 --- a/db/migrate/20170918072948_create_artifacts.rb +++ b/db/migrate/20170918072948_create_artifacts.rb @@ -3,15 +3,12 @@ class CreateArtifacts < ActiveRecord::Migration create_table :ci_artifacts do |t| t.belongs_to :project, null: false, foreign_key: { on_delete: :cascade } t.belongs_to :ci_build, null: false, foreign_key: { on_delete: :cascade } + t.integer :type, default: 0, null: false t.integer :size, limit: 8, default: 0 t.datetime_with_timezone :created_at, null: false t.datetime_with_timezone :updated_at, null: false - t.datetime_with_timezone :expire_at - t.integer :erased_by_id, null: false - t.datetime_with_timezone :erased_at - t.text :file end diff --git a/db/schema.rb b/db/schema.rb index b37e0eabbd6..b4048371676 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -229,12 +229,10 @@ ActiveRecord::Schema.define(version: 20171124150326) do create_table "ci_artifacts", force: :cascade do |t| t.integer "project_id", null: false t.integer "ci_build_id", null: false + t.integer "type", default: 0, null: false t.integer "size", limit: 8, default: 0 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "expire_at" - t.integer "erased_by_id", null: false - t.datetime "erased_at" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.text "file" end -- cgit v1.2.1