diff options
| author | Timothy Andrew <mail@timothyandrew.net> | 2016-08-24 20:17:48 +0530 |
|---|---|---|
| committer | Timothy Andrew <mail@timothyandrew.net> | 2016-08-26 16:27:37 +0530 |
| commit | 516c838a1846d049814765afa85c28a3c14a5b9f (patch) | |
| tree | a9228fa421e8b03f7a0e6a7486375baa2d369f4d /db | |
| parent | 1bf2fe276ff084d3b2e0860710ec115a317dd9fc (diff) | |
| download | gitlab-ce-516c838a1846d049814765afa85c28a3c14a5b9f.tar.gz | |
Add an `Issue::Metrics` model.
- And store the `first_associated_with_milestone_at` and
`first_added_to_board_at` times, when an issue is saved.
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20160824124900_add_table_issue_metrics.rb | 36 | ||||
| -rw-r--r-- | db/schema.rb | 13 |
2 files changed, 48 insertions, 1 deletions
diff --git a/db/migrate/20160824124900_add_table_issue_metrics.rb b/db/migrate/20160824124900_add_table_issue_metrics.rb new file mode 100644 index 00000000000..256c1b7c15c --- /dev/null +++ b/db/migrate/20160824124900_add_table_issue_metrics.rb @@ -0,0 +1,36 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddTableIssueMetrics < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + + # When using the methods "add_concurrent_index" or "add_column_with_default" + # you must disable the use of transactions as these methods can not run in an + # existing transaction. When using "add_concurrent_index" make sure that this + # method is the _only_ method called in the migration, any other changes + # should go in a separate migration. This ensures that upon failure _only_ the + # index creation fails and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + # disable_ddl_transaction! + + def change + create_table :issue_metrics do |t| + t.references :issue, index: { name: "index_issue_metrics" }, foreign_key: true, null: false + + t.datetime 'first_associated_with_milestone_at' + t.datetime 'first_added_to_board_at' + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 5a105a91ad1..2c580a164bd 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: 20160823081327) do +ActiveRecord::Schema.define(version: 20160824124900) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -453,6 +453,16 @@ ActiveRecord::Schema.define(version: 20160823081327) do add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree + create_table "issue_metrics", force: :cascade do |t| + t.integer "issue_id", null: false + t.datetime "first_associated_with_milestone_at" + t.datetime "first_added_to_board_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "issue_metrics", ["issue_id"], name: "index_issue_metrics", using: :btree + create_table "issues", force: :cascade do |t| t.string "title" t.integer "assignee_id" @@ -1150,6 +1160,7 @@ ActiveRecord::Schema.define(version: 20160823081327) do add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree add_foreign_key "boards", "projects" + add_foreign_key "issue_metrics", "issues" add_foreign_key "lists", "boards" add_foreign_key "lists", "labels" add_foreign_key "personal_access_tokens", "users" |
