From ea023138bf5116a729e5accd5f81d4e586af6b02 Mon Sep 17 00:00:00 2001
From: Alessio Caiazza <acaiazza@gitlab.com>
Date: Fri, 6 Oct 2017 11:05:23 +0200
Subject: [PATCH] Repack migration correctly

---
 ...ns.rb => 20171006090001_create_ci_build_trace_sections.rb} | 2 +-
 ...90010_add_build_foreign_key_to_ci_build_trace_sections.rb} | 0
 ... => 20171006090100_create_ci_build_trace_section_names.rb} | 0
 ...091000_add_name_foreign_key_to_ci_build_trace_sections.rb} | 0
 db/schema.rb                                                  | 4 ++--
 5 files changed, 3 insertions(+), 3 deletions(-)
 rename db/migrate/{20170926102201_create_ci_build_trace_sections.rb => 20171006090001_create_ci_build_trace_sections.rb} (100%)
 rename db/migrate/{20170926134436_add_build_foreign_key_to_ci_build_trace_sections.rb => 20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb} (100%)
 rename db/migrate/{20170929123651_create_ci_build_trace_section_names.rb => 20171006090100_create_ci_build_trace_section_names.rb} (100%)
 rename db/migrate/{20170929123915_add_name_foreign_key_to_ci_build_trace_sections.rb => 20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb} (100%)

diff --git a/db/migrate/20170926102201_create_ci_build_trace_sections.rb b/db/migrate/20171006090001_create_ci_build_trace_sections.rb
similarity index 100%
rename from db/migrate/20170926102201_create_ci_build_trace_sections.rb
rename to db/migrate/20171006090001_create_ci_build_trace_sections.rb
index ad11b31b75d..ab5ef319618 100644
--- a/db/migrate/20170926102201_create_ci_build_trace_sections.rb
+++ b/db/migrate/20171006090001_create_ci_build_trace_sections.rb
@@ -5,11 +5,11 @@ class CreateCiBuildTraceSections < ActiveRecord::Migration
 
   def change
     create_table :ci_build_trace_sections do |t|
+      t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }
       t.datetime_with_timezone :date_start, null: false
       t.datetime_with_timezone :date_end, null: false
       t.integer :byte_start, limit: 8, null: false
       t.integer :byte_end, limit: 8, null: false
-      t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }
       t.integer :build_id, null: false
       t.integer :section_name_id, null: false
     end
diff --git a/db/migrate/20170926134436_add_build_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb
similarity index 100%
rename from db/migrate/20170926134436_add_build_foreign_key_to_ci_build_trace_sections.rb
rename to db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb
diff --git a/db/migrate/20170929123651_create_ci_build_trace_section_names.rb b/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
similarity index 100%
rename from db/migrate/20170929123651_create_ci_build_trace_section_names.rb
rename to db/migrate/20171006090100_create_ci_build_trace_section_names.rb
diff --git a/db/migrate/20170929123915_add_name_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb
similarity index 100%
rename from db/migrate/20170929123915_add_name_foreign_key_to_ci_build_trace_sections.rb
rename to db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb
diff --git a/db/schema.rb b/db/schema.rb
index 4f2424ff2ab..5f16e14139c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 20171004121444) do
+ActiveRecord::Schema.define(version: 20171006091000) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -215,11 +215,11 @@ ActiveRecord::Schema.define(version: 20171004121444) do
   add_index "ci_build_trace_section_names", ["project_id", "name"], name: "index_ci_build_trace_section_names_on_project_id_and_name", unique: true, using: :btree
 
   create_table "ci_build_trace_sections", force: :cascade do |t|
+    t.integer "project_id", null: false
     t.datetime_with_timezone "date_start", null: false
     t.datetime_with_timezone "date_end", null: false
     t.integer "byte_start", limit: 8, null: false
     t.integer "byte_end", limit: 8, null: false
-    t.integer "project_id", null: false
     t.integer "build_id", null: false
     t.integer "section_name_id", null: false
   end
-- 
2.30.9