Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
da74e97c
Commit
da74e97c
authored
Mar 24, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use default_value_for to set notified_of_own_activity instead of using a DB migration
parent
e1bb8c99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
21 deletions
+2
-21
app/models/user.rb
app/models/user.rb
+1
-0
db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb
...te/20170317131326_add_notified_of_own_activity_default.rb
+0
-20
db/schema.rb
db/schema.rb
+1
-1
No files found.
app/models/user.rb
View file @
da74e97c
...
@@ -22,6 +22,7 @@ class User < ActiveRecord::Base
...
@@ -22,6 +22,7 @@ class User < ActiveRecord::Base
default_value_for
:hide_no_ssh_key
,
false
default_value_for
:hide_no_ssh_key
,
false
default_value_for
:hide_no_password
,
false
default_value_for
:hide_no_password
,
false
default_value_for
:project_view
,
:files
default_value_for
:project_view
,
:files
default_value_for
:notified_of_own_activity
,
false
attr_encrypted
:otp_secret
,
attr_encrypted
:otp_secret
,
key:
Gitlab
::
Application
.
secrets
.
otp_key_base
,
key:
Gitlab
::
Application
.
secrets
.
otp_key_base
,
...
...
db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb
deleted
100644 → 0
View file @
e1bb8c99
class
AddNotifiedOfOwnActivityDefault
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
def
up
begin
update_column_in_batches
(
:users
,
:notified_of_own_activity
,
false
)
do
|
table
,
query
|
query
.
where
(
table
[
:notified_of_own_activity
].
eq
(
nil
))
end
change_column
:users
,
:notified_of_own_activity
,
:boolean
,
default:
false
,
null:
false
end
end
def
down
change_column_default
:users
,
:notified_of_own_activity
,
nil
end
end
db/schema.rb
View file @
da74e97c
...
@@ -1236,7 +1236,7 @@ ActiveRecord::Schema.define(version: 20170317203554) do
...
@@ -1236,7 +1236,7 @@ ActiveRecord::Schema.define(version: 20170317203554) do
t
.
string
"organization"
t
.
string
"organization"
t
.
boolean
"authorized_projects_populated"
t
.
boolean
"authorized_projects_populated"
t
.
boolean
"ghost"
t
.
boolean
"ghost"
t
.
boolean
"notified_of_own_activity"
,
default:
false
,
null:
false
t
.
boolean
"notified_of_own_activity"
end
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment