summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-08-24 20:17:48 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-08-26 16:27:37 +0530
commit516c838a1846d049814765afa85c28a3c14a5b9f (patch)
treea9228fa421e8b03f7a0e6a7486375baa2d369f4d /db/migrate
parent1bf2fe276ff084d3b2e0860710ec115a317dd9fc (diff)
downloadgitlab-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/migrate')
-rw-r--r--db/migrate/20160824124900_add_table_issue_metrics.rb36
1 files changed, 36 insertions, 0 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