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
cb4e5c8c
Commit
cb4e5c8c
authored
Aug 28, 2019
by
Adam Hegyi
Committed by
Andreas Brandl
Aug 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding NOT NULL constraint to private_profile
This change sets NOT NULL constraint to users.private profile.
parent
b1c34d2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
changelogs/unreleased/57538-not-null-constraint-on-users-private-profile.yml
...ed/57538-not-null-constraint-on-users-private-profile.yml
+5
-0
db/post_migrate/20190725080128_set_not_null_on_users_private_profile.rb
...e/20190725080128_set_not_null_on_users_private_profile.rb
+26
-0
db/schema.rb
db/schema.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
No files found.
changelogs/unreleased/57538-not-null-constraint-on-users-private-profile.yml
0 → 100644
View file @
cb4e5c8c
---
title
:
Setting NOT NULL constraint to users.private_profile column
merge_request
:
14838
author
:
type
:
other
db/post_migrate/20190725080128_set_not_null_on_users_private_profile.rb
0 → 100644
View file @
cb4e5c8c
# frozen_string_literal: true
class
SetNotNullOnUsersPrivateProfile
<
ActiveRecord
::
Migration
[
5.1
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
Gitlab
::
BackgroundMigration
.
steal
(
'MigrateNullPrivateProfileToFalse'
)
# rubocop:disable Migration/UpdateLargeTable
# rubocop:disable Migration/UpdateColumnInBatches
# Data has been migrated previously, count should be close to 0
update_column_in_batches
(
:users
,
:private_profile
,
false
)
do
|
table
,
query
|
query
.
where
(
table
[
:private_profile
].
eq
(
nil
))
end
change_column_null
:users
,
:private_profile
,
false
end
def
down
change_column_null
:users
,
:private_profile
,
true
end
end
db/schema.rb
View file @
cb4e5c8c
...
...
@@ -3517,7 +3517,7 @@ ActiveRecord::Schema.define(version: 2019_08_22_181528) do
t
.
integer
"theme_id"
,
limit:
2
t
.
integer
"accepted_term_id"
t
.
string
"feed_token"
t
.
boolean
"private_profile"
,
default:
false
t
.
boolean
"private_profile"
,
default:
false
,
null:
false
t
.
integer
"roadmap_layout"
,
limit:
2
t
.
boolean
"include_private_contributions"
t
.
string
"commit_email"
...
...
spec/models/user_spec.rb
View file @
cb4e5c8c
...
...
@@ -1176,7 +1176,7 @@ describe User do
expect
(
user
.
can_create_group
).
to
eq
(
Gitlab
.
config
.
gitlab
.
default_can_create_group
)
expect
(
user
.
theme_id
).
to
eq
(
Gitlab
.
config
.
gitlab
.
default_theme
)
expect
(
user
.
external
).
to
be_falsey
expect
(
user
.
private_profile
).
to
eq
false
expect
(
user
.
private_profile
).
to
eq
(
false
)
end
end
...
...
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