BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
927c40ca
Commit
927c40ca
authored
Dec 14, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Ci::Project migration not migrating columns that cannot be NULL [ci skip]
parent
208f99ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
20151210125930_migrate_ci_to_project.rb
db/migrate/20151210125930_migrate_ci_to_project.rb
+3
-3
No files found.
db/migrate/20151210125930_migrate_ci_to_project.rb
View file @
927c40ca
...
@@ -27,11 +27,11 @@ class MigrateCiToProject < ActiveRecord::Migration
...
@@ -27,11 +27,11 @@ class MigrateCiToProject < ActiveRecord::Migration
def
migrate_project_column
(
column
,
new_column
=
nil
)
def
migrate_project_column
(
column
,
new_column
=
nil
)
new_column
||=
column
new_column
||=
column
subquery
=
"SELECT ci_projects.
#{
column
}
FROM ci_projects WHERE projects.id = ci_projects.gitlab_id"
subquery
=
"SELECT ci_projects.
#{
column
}
FROM ci_projects WHERE projects.id = ci_projects.gitlab_id"
execute
(
"UPDATE projects SET
#{
new_column
}
=(
#{
subquery
}
) WHERE
#{
new_column
}
IS NULL AND
(
#{
subquery
}
) IS NOT NULL"
)
execute
(
"UPDATE projects SET
#{
new_column
}
=(
#{
subquery
}
) WHERE (
#{
subquery
}
) IS NOT NULL"
)
end
end
def
migrate_ci_service
def
migrate_ci_service
subquery
=
"SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService'"
subquery
=
"SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService'
LIMIT 1
"
execute
(
"UPDATE projects SET builds_enabled=(
#{
subquery
}
) WHERE
builds_enabled IS NULL AND
(
#{
subquery
}
) IS NOT NULL"
)
execute
(
"UPDATE projects SET builds_enabled=(
#{
subquery
}
) WHERE (
#{
subquery
}
) IS NOT NULL"
)
end
end
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