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
3d87229e
Commit
3d87229e
authored
Jun 05, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure project mirror data with post migration
parent
0ca479d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
db/post_migrate/20170530111134_ensure_project_mirror_data.rb
db/post_migrate/20170530111134_ensure_project_mirror_data.rb
+30
-0
No files found.
db/post_migrate/20170530111134_ensure_project_mirror_data.rb
0 → 100644
View file @
3d87229e
class
EnsureProjectMirrorData
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
return
unless
Gitlab
::
Database
.
postgresql?
execute
<<-
SQL
INSERT INTO project_mirror_data
SELECT id AS project_id,
0 AS retry_count,
CAST(NULL AS TIMESTAMP) AS last_update_started_at,
CAST(NULL AS TIMESTAMP) AS last_update_scheduled_at,
NOW() AS next_execution_timestamp,
NOW() AS created_at,
NOW() as updated_at
FROM projects
WHERE mirror IS TRUE
AND NOT EXISTS (
SELECT true
FROM project_mirror_data
WHERE project_mirror_data.project_id = projects.id
);
SQL
end
def
down
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