summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-12 16:46:44 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-12 16:46:44 -0800
commitdc95ddbea2840de800f5bd2e93de993a335db476 (patch)
tree7c0317df5e9980b1485b90ab0a30b8a5a2c41f04 /db
parentc8ada3322b211d13fb26adb2ceac054aced5ee6f (diff)
downloadgitlab-ci-dc95ddbea2840de800f5bd2e93de993a335db476.tar.gz
Add tags to jobs and runners
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150113001832_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb31
-rw-r--r--db/migrate/20150113001833_add_missing_unique_indices.acts_as_taggable_on_engine.rb20
-rw-r--r--db/migrate/20150113001834_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb15
-rw-r--r--db/migrate/20150113001835_add_missing_taggable_index.acts_as_taggable_on_engine.rb10
-rw-r--r--db/schema.rb22
5 files changed, 97 insertions, 1 deletions
diff --git a/db/migrate/20150113001832_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150113001832_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
new file mode 100644
index 0000000..6bbd559
--- /dev/null
+++ b/db/migrate/20150113001832_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
@@ -0,0 +1,31 @@
+# This migration comes from acts_as_taggable_on_engine (originally 1)
+class ActsAsTaggableOnMigration < ActiveRecord::Migration
+ def self.up
+ create_table :tags do |t|
+ t.string :name
+ end
+
+ create_table :taggings do |t|
+ t.references :tag
+
+ # You should make sure that the column created is
+ # long enough to store the required class names.
+ t.references :taggable, polymorphic: true
+ t.references :tagger, polymorphic: true
+
+ # Limit is created to prevent MySQL error on index
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
+ t.string :context, limit: 128
+
+ t.datetime :created_at
+ end
+
+ add_index :taggings, :tag_id
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
+ end
+
+ def self.down
+ drop_table :taggings
+ drop_table :tags
+ end
+end
diff --git a/db/migrate/20150113001833_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150113001833_add_missing_unique_indices.acts_as_taggable_on_engine.rb
new file mode 100644
index 0000000..4ca676f
--- /dev/null
+++ b/db/migrate/20150113001833_add_missing_unique_indices.acts_as_taggable_on_engine.rb
@@ -0,0 +1,20 @@
+# This migration comes from acts_as_taggable_on_engine (originally 2)
+class AddMissingUniqueIndices < ActiveRecord::Migration
+ def self.up
+ add_index :tags, :name, unique: true
+
+ remove_index :taggings, :tag_id
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
+ add_index :taggings,
+ [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
+ unique: true, name: 'taggings_idx'
+ end
+
+ def self.down
+ remove_index :tags, :name
+
+ remove_index :taggings, name: 'taggings_idx'
+ add_index :taggings, :tag_id
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
+ end
+end
diff --git a/db/migrate/20150113001834_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150113001834_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
new file mode 100644
index 0000000..8edb508
--- /dev/null
+++ b/db/migrate/20150113001834_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
@@ -0,0 +1,15 @@
+# This migration comes from acts_as_taggable_on_engine (originally 3)
+class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
+ def self.up
+ add_column :tags, :taggings_count, :integer, default: 0
+
+ ActsAsTaggableOn::Tag.reset_column_information
+ ActsAsTaggableOn::Tag.find_each do |tag|
+ ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
+ end
+ end
+
+ def self.down
+ remove_column :tags, :taggings_count
+ end
+end
diff --git a/db/migrate/20150113001835_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150113001835_add_missing_taggable_index.acts_as_taggable_on_engine.rb
new file mode 100644
index 0000000..71f2d7f
--- /dev/null
+++ b/db/migrate/20150113001835_add_missing_taggable_index.acts_as_taggable_on_engine.rb
@@ -0,0 +1,10 @@
+# This migration comes from acts_as_taggable_on_engine (originally 4)
+class AddMissingTaggableIndex < ActiveRecord::Migration
+ def self.up
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
+ end
+
+ def self.down
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3a95481..6193199 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: 20150111062026) do
+ActiveRecord::Schema.define(version: 20150113001835) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -118,6 +118,26 @@ ActiveRecord::Schema.define(version: 20150111062026) do
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
+ create_table "taggings", force: true do |t|
+ t.integer "tag_id"
+ t.integer "taggable_id"
+ t.string "taggable_type"
+ t.integer "tagger_id"
+ t.string "tagger_type"
+ t.string "context", limit: 128
+ t.datetime "created_at"
+ end
+
+ add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
+
+ create_table "tags", force: true do |t|
+ t.string "name"
+ t.integer "taggings_count", default: 0
+ end
+
+ add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
+
create_table "web_hooks", force: true do |t|
t.string "url", null: false
t.integer "project_id", null: false