diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-09-18 15:33:24 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-03 12:04:47 +0100 |
commit | 8ac7f29726989bc0a20ee32780aa18625159f8b4 (patch) | |
tree | 756e41340d54143ee6a29e68cbde28ab9369d46f /db | |
parent | 636376dd4d41856cc965718725f06bb8caacfd34 (diff) | |
download | gitlab-ce-8ac7f29726989bc0a20ee32780aa18625159f8b4.tar.gz |
Create ci_artifacts table
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170918072948_create_artifacts.rb | 22 | ||||
-rw-r--r-- | db/schema.rb | 16 |
2 files changed, 35 insertions, 3 deletions
diff --git a/db/migrate/20170918072948_create_artifacts.rb b/db/migrate/20170918072948_create_artifacts.rb index 0b3241070ce..dd0af2a7066 100644 --- a/db/migrate/20170918072948_create_artifacts.rb +++ b/db/migrate/20170918072948_create_artifacts.rb @@ -1,8 +1,24 @@ class CreateArtifacts < ActiveRecord::Migration - def change - create_table :artifacts do |t| + def up + 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 :size, limit: 8, default: 0 - t.timestamps null: false + 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 + + add_index(:ci_artifacts, [:project_id, :ci_build_id], unique: true) + end + + def down + drop_table(:ci_artifacts) end end diff --git a/db/schema.rb b/db/schema.rb index effb2604af2..b37e0eabbd6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -226,6 +226,20 @@ ActiveRecord::Schema.define(version: 20171124150326) do add_index "chat_teams", ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree + create_table "ci_artifacts", force: :cascade do |t| + t.integer "project_id", null: false + t.integer "ci_build_id", 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.text "file" + end + + add_index "ci_artifacts", ["project_id", "ci_build_id"], name: "index_ci_artifacts_on_project_id_and_ci_build_id", unique: true, using: :btree + create_table "ci_build_trace_section_names", force: :cascade do |t| t.integer "project_id", null: false t.string "name", null: false @@ -1901,6 +1915,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do add_foreign_key "boards", "projects", name: "fk_f15266b5f9", on_delete: :cascade add_foreign_key "chat_teams", "namespaces", on_delete: :cascade + add_foreign_key "ci_artifacts", "ci_builds", on_delete: :cascade + add_foreign_key "ci_artifacts", "projects", on_delete: :cascade add_foreign_key "ci_build_trace_section_names", "projects", on_delete: :cascade add_foreign_key "ci_build_trace_sections", "ci_build_trace_section_names", column: "section_name_id", name: "fk_264e112c66", on_delete: :cascade add_foreign_key "ci_build_trace_sections", "ci_builds", column: "build_id", name: "fk_4ebe41f502", on_delete: :cascade |