diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-01-26 17:06:52 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-01-26 23:14:37 +0100 |
commit | 89ea6a9931bb232bd391ff4dace6e13deb6dee0c (patch) | |
tree | 1f64818d116b724ec654df69cac7b13afd47031d | |
parent | 4376be84ce18cde22febc50356ad254b507eef1b (diff) | |
download | gitlab-ce-89ea6a9931bb232bd391ff4dace6e13deb6dee0c.tar.gz |
Add Callout model
-rw-r--r-- | app/models/callout.rb | 3 | ||||
-rw-r--r-- | app/models/user.rb | 1 | ||||
-rw-r--r-- | db/migrate/20180125214301_create_callouts.rb | 19 |
3 files changed, 23 insertions, 0 deletions
diff --git a/app/models/callout.rb b/app/models/callout.rb new file mode 100644 index 00000000000..b8131beb518 --- /dev/null +++ b/app/models/callout.rb @@ -0,0 +1,3 @@ +class Callout < ActiveRecord::Base + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb index 9403da98268..b54d44fe80a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -137,6 +137,7 @@ class User < ActiveRecord::Base has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest" # rubocop:disable Cop/ActiveRecordDependent has_many :custom_attributes, class_name: 'UserCustomAttribute' + has_many :callouts # # Validations diff --git a/db/migrate/20180125214301_create_callouts.rb b/db/migrate/20180125214301_create_callouts.rb new file mode 100644 index 00000000000..5dc9638a845 --- /dev/null +++ b/db/migrate/20180125214301_create_callouts.rb @@ -0,0 +1,19 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CreateCallouts < ActiveRecord::Migration + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + create_table :callouts do |t| + t.string :feature_name, null: false + t.boolean :dismissed_state, null: false + t.references :user, index: true, foreign_key: { on_delete: :cascade }, null: false + + t.timestamps_with_timezone null: false + end + + add_index :callouts, :feature_name, unique: true + end +end |