summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-06 11:20:17 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-06 11:20:17 +0200
commit7ad7e10feed624e263b5b80f5cafd4b0ed900ad7 (patch)
treec5eb47727ba96c77e61a132ceaedd89218b60ae4 /db
parent9614c52266fd7009c1dd2960564d4f65b1a12f80 (diff)
parentfc809d689a03e69c581c1bb8ed0cf246953a7c08 (diff)
downloadgitlab-ce-7ad7e10feed624e263b5b80f5cafd4b0ed900ad7.tar.gz
Merge remote-tracking branch 'origin/master' into rename-ci-commit
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160416180807_add_award_emoji.rb14
-rw-r--r--db/migrate/20160416182152_convert_award_note_to_emoji_award.rb9
-rw-r--r--db/migrate/20160416190505_remove_note_is_award.rb5
-rw-r--r--db/schema.rb14
4 files changed, 40 insertions, 2 deletions
diff --git a/db/migrate/20160416180807_add_award_emoji.rb b/db/migrate/20160416180807_add_award_emoji.rb
new file mode 100644
index 00000000000..2ead181921b
--- /dev/null
+++ b/db/migrate/20160416180807_add_award_emoji.rb
@@ -0,0 +1,14 @@
+class AddAwardEmoji < ActiveRecord::Migration
+ def change
+ create_table :award_emoji do |t|
+ t.string :name
+ t.references :user
+ t.references :awardable, polymorphic: true
+
+ t.timestamps
+ end
+
+ add_index :award_emoji, :user_id
+ add_index :award_emoji, [:awardable_type, :awardable_id]
+ end
+end
diff --git a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
new file mode 100644
index 00000000000..073bbc0fc2a
--- /dev/null
+++ b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
@@ -0,0 +1,9 @@
+class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
+ def change
+ def up
+ execute "INSERT INTO award_emoji (awardable_type, awardable_id, user_id, name, created_at, updated_at) (SELECT noteable_type, noteable_id, author_id, note, created_at, updated_at FROM notes WHERE is_award = true)"
+
+ execute "DELETE FROM notes WHERE is_award = true"
+ end
+ end
+end
diff --git a/db/migrate/20160416190505_remove_note_is_award.rb b/db/migrate/20160416190505_remove_note_is_award.rb
new file mode 100644
index 00000000000..da16372a297
--- /dev/null
+++ b/db/migrate/20160416190505_remove_note_is_award.rb
@@ -0,0 +1,5 @@
+class RemoveNoteIsAward < ActiveRecord::Migration
+ def change
+ remove_column :notes, :is_award, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b2af810f600..28902119615 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -100,6 +100,18 @@ ActiveRecord::Schema.define(version: 20160530150109) do
add_index "audit_events", ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type", using: :btree
add_index "audit_events", ["type"], name: "index_audit_events_on_type", using: :btree
+ create_table "award_emoji", force: :cascade do |t|
+ t.string "name"
+ t.integer "user_id"
+ t.integer "awardable_id"
+ t.string "awardable_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "award_emoji", ["awardable_type", "awardable_id"], name: "index_award_emoji_on_awardable_type_and_awardable_id", using: :btree
+ add_index "award_emoji", ["user_id"], name: "index_award_emoji_on_user_id", using: :btree
+
create_table "broadcast_messages", force: :cascade do |t|
t.text "message", null: false
t.datetime "starts_at"
@@ -638,7 +650,6 @@ ActiveRecord::Schema.define(version: 20160530150109) do
t.boolean "system", default: false, null: false
t.text "st_diff"
t.integer "updated_by_id"
- t.boolean "is_award", default: false, null: false
t.string "type"
end
@@ -646,7 +657,6 @@ ActiveRecord::Schema.define(version: 20160530150109) do
add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree
add_index "notes", ["created_at", "id"], name: "index_notes_on_created_at_and_id", using: :btree
add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree
- add_index "notes", ["is_award"], name: "index_notes_on_is_award", using: :btree
add_index "notes", ["line_code"], name: "index_notes_on_line_code", using: :btree
add_index "notes", ["note"], name: "index_notes_on_note_trigram", using: :gin, opclasses: {"note"=>"gin_trgm_ops"}
add_index "notes", ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type", using: :btree