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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-18 22:02:00 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-18 22:02:00 +0400
commit9ada67881970b05d4be49cbe329b4bf50ffe4f77 (patch)
tree1c68833adba7876f20412b4e9ec6fef138eeb5fa /db
parentaa8d4d9fea175e209ac3652f3743ce2801144a66 (diff)
Split commit_id and noteable_id for Note
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20121218164840_move_noteable_commit_to_own_field.rb15
-rw-r--r--db/schema.rb26
2 files changed, 28 insertions, 13 deletions
diff --git a/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb b/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb
new file mode 100644
index 00000000000..556ac9e7898
--- /dev/null
+++ b/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb
@@ -0,0 +1,15 @@
+class MoveNoteableCommitToOwnField < ActiveRecord::Migration
+ def up
+ add_column :notes, :commit_id, :string, null: true
+ add_column :notes, :new_noteable_id, :integer, null: true
+ Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id')
+ Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (noteable_id AS INTEGER)')
+ remove_column :notes, :noteable_id
+ rename_column :notes, :new_noteable_id, :noteable_id
+ end
+
+ def down
+ remove_column :notes, :commit_id
+ remove_column :notes, :new_noteable_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 923d2c5543e..e4a1ec4da97 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 => 20121205201726) do
+ActiveRecord::Schema.define(:version => 20121218164840) do
create_table "events", :force => true do |t|
t.string "target_type"
@@ -69,19 +69,19 @@ ActiveRecord::Schema.define(:version => 20121205201726) 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.boolean "closed", :default => false, :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.boolean "merged", :default => false, :null => false
- t.integer "state", :default => 1, :null => false
+ t.boolean "closed", :default => false, :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "st_commits"
+ t.text "st_diffs"
+ t.boolean "merged", :default => false, :null => false
+ t.integer "state", :default => 1, :null => false
t.integer "milestone_id"
end
@@ -124,7 +124,6 @@ ActiveRecord::Schema.define(:version => 20121205201726) do
create_table "notes", :force => true do |t|
t.text "note"
- t.string "noteable_id"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at", :null => false
@@ -132,10 +131,11 @@ ActiveRecord::Schema.define(:version => 20121205201726) do
t.integer "project_id"
t.string "attachment"
t.string "line_code"
+ t.string "commit_id"
+ t.integer "noteable_id"
end
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
- add_index "notes", ["noteable_id"], :name => "index_notes_on_noteable_id"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"