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
ba2f8a6c
Commit
ba2f8a6c
authored
Mar 01, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make project#namespace_id not null
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
71545ca6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
...te/20180301084653_change_project_namespace_id_not_null.rb
+29
-0
No files found.
db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
0 → 100644
View file @
ba2f8a6c
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
ChangeProjectNamespaceIdNotNull
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
class
Project
<
ActiveRecord
::
Base
self
.
table_name
=
'projects'
include
EachBatch
end
BATCH_SIZE
=
1000
DOWNTIME
=
false
disable_ddl_transaction!
def
up
Project
.
where
(
namespace_id:
nil
).
each_batch
(
of:
BATCH_SIZE
)
do
|
batch
|
batch
.
delete_all
end
change_column_null
:projects
,
:namespace_id
,
false
end
def
down
change_column_null
:projects
,
:namespace_id
,
true
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