summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-26 10:38:40 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-26 10:38:40 +0200
commitd7b667fee238cfd457bdc143a37585ac931cf4ad (patch)
tree81f5eb8aba67e9fb872c4aa736b7c148f912d79e /db
parent0cc95ef2f56c4b779fca613c61789483fa8d2ae8 (diff)
parent6d68923edceb23ae6a5281e022a351a0d9c0d59b (diff)
downloadgitlab-ce-d7b667fee238cfd457bdc143a37585ac931cf4ad.tar.gz
Merge branch 'state-machine-stage-2' of https://github.com/Undev/gitlabhq into Undev-state-machine-stage-2
Conflicts: app/models/merge_request.rb
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb5
-rw-r--r--db/migrate/20130220125544_convert_merge_status_in_merge_request.rb17
-rw-r--r--db/migrate/20130220125545_remove_merge_status_from_merge_request.rb9
-rw-r--r--db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb5
-rw-r--r--db/schema.rb42
5 files changed, 57 insertions, 21 deletions
diff --git a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb
new file mode 100644
index 00000000000..d78bd0ae923
--- /dev/null
+++ b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb
@@ -0,0 +1,5 @@
+class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration
+ def change
+ add_column :merge_requests, :new_merge_status, :string
+ end
+end
diff --git a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb
new file mode 100644
index 00000000000..b310b35e373
--- /dev/null
+++ b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb
@@ -0,0 +1,17 @@
+class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration
+ def up
+ MergeRequest.transaction do
+ MergeRequest.where(merge_status: 1).update_all("new_merge_status = 'unchecked'")
+ MergeRequest.where(merge_status: 2).update_all("new_merge_status = 'can_be_merged'")
+ MergeRequest.where(merge_status: 3).update_all("new_merge_status = 'cannot_be_merged'")
+ end
+ end
+
+ def down
+ MergeRequest.transaction do
+ MergeRequest.where(new_merge_status: :unchecked).update_all("merge_status = 1")
+ MergeRequest.where(new_merge_status: :can_be_merged).update_all("merge_status = 2")
+ MergeRequest.where(new_merge_status: :cannot_be_merged).update_all("merge_status = 3")
+ end
+ end
+end
diff --git a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb
new file mode 100644
index 00000000000..9083183beb0
--- /dev/null
+++ b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb
@@ -0,0 +1,9 @@
+class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration
+ def up
+ remove_column :merge_requests, :merge_status
+ end
+
+ def down
+ add_column :merge_requests, :merge_status, :integer
+ end
+end
diff --git a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb
new file mode 100644
index 00000000000..3f8f38dc979
--- /dev/null
+++ b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb
@@ -0,0 +1,5 @@
+class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration
+ def change
+ rename_column :merge_requests, :new_merge_status, :merge_status
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f837e6edf98..74d5f9a360c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130218141554) do
+ActiveRecord::Schema.define(:version => 20130220133245) do
create_table "events", :force => true do |t|
t.string "target_type"
@@ -68,19 +68,19 @@ ActiveRecord::Schema.define(:version => 20130218141554) do
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
create_table "merge_requests", :force => true do |t|
- t.string "target_branch", :null => false
- t.string "source_branch", :null => false
- t.integer "project_id", :null => false
+ t.string "target_branch", :null => false
+ t.string "source_branch", :null => false
+ t.integer "project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
- t.integer "merge_status", :default => 1, :null => false
t.integer "milestone_id"
t.string "state"
+ t.string "merge_status"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
@@ -106,11 +106,11 @@ ActiveRecord::Schema.define(:version => 20130218141554) do
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
- t.string "name", :null => false
- t.string "path", :null => false
- t.integer "owner_id", :null => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.string "name", :null => false
+ t.string "path", :null => false
+ t.integer "owner_id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "type"
end
@@ -142,16 +142,16 @@ ActiveRecord::Schema.define(:version => 20130218141554) do
t.string "name"
t.string "path"
t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "creator_id"
t.string "default_branch"
- t.boolean "issues_enabled", :default => true, :null => false
- t.boolean "wall_enabled", :default => true, :null => false
- t.boolean "merge_requests_enabled", :default => true, :null => false
- t.boolean "wiki_enabled", :default => true, :null => false
+ t.boolean "issues_enabled", :default => true, :null => false
+ t.boolean "wall_enabled", :default => true, :null => false
+ t.boolean "merge_requests_enabled", :default => true, :null => false
+ t.boolean "wiki_enabled", :default => true, :null => false
t.integer "namespace_id"
- t.boolean "public", :default => false, :null => false
+ t.boolean "public", :default => false, :null => false
end
add_index "projects", ["creator_id"], :name => "index_projects_on_owner_id"
@@ -230,8 +230,8 @@ ActiveRecord::Schema.define(:version => 20130218141554) do
t.string "name"
t.string "path"
t.integer "owner_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|