summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2018-03-05 17:51:40 +0000
committerDouwe Maan <douwe@gitlab.com>2018-03-05 17:51:40 +0000
commit8fe880dc064e0e6cd10f7176ade7c312cfb37b90 (patch)
treefd52091357726e167d27690e5d1e99a981e1821d /db
parent49f72d06654bd7bdea259154e1092a53aab57acc (diff)
downloadgitlab-ce-8fe880dc064e0e6cd10f7176ade7c312cfb37b90.tar.gz
Projects and groups badges API
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20180214093516_create_badges.rb17
-rw-r--r--db/schema.rb15
2 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20180214093516_create_badges.rb b/db/migrate/20180214093516_create_badges.rb
new file mode 100644
index 00000000000..6559f834484
--- /dev/null
+++ b/db/migrate/20180214093516_create_badges.rb
@@ -0,0 +1,17 @@
+class CreateBadges < ActiveRecord::Migration
+ DOWNTIME = false
+
+ def change
+ create_table :badges do |t|
+ t.string :link_url, null: false
+ t.string :image_url, null: false
+ t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: true
+ t.integer :group_id, index: true, null: true
+ t.string :type, null: false
+
+ t.timestamps_with_timezone null: false
+ end
+
+ add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4937fbd3df1..9e117440ed2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -183,6 +183,19 @@ ActiveRecord::Schema.define(version: 20180304204842) do
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"], name: "index_award_emoji_on_user_id_and_name", using: :btree
+ create_table "badges", force: :cascade do |t|
+ t.string "link_url", null: false
+ t.string "image_url", null: false
+ t.integer "project_id"
+ t.integer "group_id"
+ t.string "type", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ end
+
+ add_index "badges", ["group_id"], name: "index_badges_on_group_id", using: :btree
+ add_index "badges", ["project_id"], name: "index_badges_on_project_id", using: :btree
+
create_table "boards", force: :cascade do |t|
t.integer "project_id", null: false
t.datetime "created_at", null: false
@@ -1969,6 +1982,8 @@ ActiveRecord::Schema.define(version: 20180304204842) do
add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree
add_index "web_hooks", ["type"], name: "index_web_hooks_on_type", using: :btree
+ add_foreign_key "badges", "namespaces", column: "group_id", on_delete: :cascade
+ add_foreign_key "badges", "projects", on_delete: :cascade
add_foreign_key "boards", "projects", name: "fk_f15266b5f9", on_delete: :cascade
add_foreign_key "chat_teams", "namespaces", on_delete: :cascade
add_foreign_key "ci_build_trace_section_names", "projects", on_delete: :cascade