Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/14_pipelines.rb4
-rw-r--r--db/migrate/20170918072948_create_job_artifacts.rb23
-rw-r--r--db/schema.rb16
3 files changed, 41 insertions, 2 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index 5de5339b70e..d3a63aa2a78 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -124,11 +124,11 @@ class Gitlab::Seeder::Pipelines
return unless %w[build test].include?(build.stage)
artifacts_cache_file(artifacts_archive_path) do |file|
- build.artifacts_file = file
+ build.job_artifacts.build(project: build.project, file_type: :archive, file: file)
end
artifacts_cache_file(artifacts_metadata_path) do |file|
- build.artifacts_metadata = file
+ build.job_artifacts.build(project: build.project, file_type: :metadata, file: file)
end
end
diff --git a/db/migrate/20170918072948_create_job_artifacts.rb b/db/migrate/20170918072948_create_job_artifacts.rb
new file mode 100644
index 00000000000..95f2c6c8ce8
--- /dev/null
+++ b/db/migrate/20170918072948_create_job_artifacts.rb
@@ -0,0 +1,23 @@
+class CreateJobArtifacts < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :ci_job_artifacts do |t|
+ t.belongs_to :project, null: false, index: true, foreign_key: { on_delete: :cascade }
+ t.integer :job_id, null: false
+ t.integer :file_type, null: false
+ t.integer :size, limit: 8
+
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+ t.datetime_with_timezone :expire_at
+
+ t.string :file
+
+ t.foreign_key :ci_builds, column: :job_id, on_delete: :cascade
+ t.index [:job_id, :file_type], unique: true
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index effb2604af2..8e5bcc8b51d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -319,6 +319,20 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_index "ci_group_variables", ["group_id", "key"], name: "index_ci_group_variables_on_group_id_and_key", unique: true, using: :btree
+ create_table "ci_job_artifacts", force: :cascade do |t|
+ t.integer "project_id", null: false
+ t.integer "job_id", null: false
+ t.integer "file_type", null: false
+ t.integer "size", limit: 8
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.datetime_with_timezone "expire_at"
+ t.string "file"
+ end
+
+ add_index "ci_job_artifacts", ["job_id", "file_type"], name: "index_ci_job_artifacts_on_job_id_and_file_type", unique: true, using: :btree
+ add_index "ci_job_artifacts", ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree
+
create_table "ci_pipeline_schedule_variables", force: :cascade do |t|
t.string "key", null: false
t.text "value"
@@ -1909,6 +1923,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_foreign_key "ci_builds", "ci_stages", column: "stage_id", name: "fk_3a9eaa254d", on_delete: :cascade
add_foreign_key "ci_builds", "projects", name: "fk_befce0568a", on_delete: :cascade
add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade
+ add_foreign_key "ci_job_artifacts", "ci_builds", column: "job_id", on_delete: :cascade
+ add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade
add_foreign_key "ci_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", on_delete: :cascade
add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade
add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify