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
0ca479d1
Commit
0ca479d1
authored
Jun 05, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds project mirror data table
parent
27a8cc7b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
db/migrate/20170509153720_create_project_mirror_data.rb
db/migrate/20170509153720_create_project_mirror_data.rb
+40
-0
db/schema.rb
db/schema.rb
+13
-0
No files found.
db/migrate/20170509153720_create_project_mirror_data.rb
0 → 100644
View file @
0ca479d1
class
CreateProjectMirrorData
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
execute
<<-
SQL
CREATE TABLE project_mirror_data
AS (
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
);
SQL
add_column
:project_mirror_data
,
:id
,
:primary_key
change_column_default
:project_mirror_data
,
:retry_count
,
0
change_column_null
:project_mirror_data
,
:retry_count
,
false
add_concurrent_foreign_key
:project_mirror_data
,
:projects
,
column: :project_id
add_concurrent_index
:project_mirror_data
,
[
:project_id
],
unique:
true
end
def
down
drop_table
:project_mirror_data
if
table_exists?
(
:project_mirror_data
)
end
def
timestamp
return
'TIMESTAMP'
if
Gitlab
::
Database
.
postgresql?
'DATETIME'
end
end
db/schema.rb
View file @
0ca479d1
...
@@ -1079,6 +1079,18 @@ ActiveRecord::Schema.define(version: 20170602003304) do
...
@@ -1079,6 +1079,18 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_index
"project_import_data"
,
[
"project_id"
],
name:
"index_project_import_data_on_project_id"
,
using: :btree
add_index
"project_import_data"
,
[
"project_id"
],
name:
"index_project_import_data_on_project_id"
,
using: :btree
create_table
"project_mirror_data"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
integer
"retry_count"
,
default:
0
,
null:
false
t
.
datetime
"last_update_started_at"
t
.
datetime
"last_update_scheduled_at"
t
.
datetime
"next_execution_timestamp"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
add_index
"project_mirror_data"
,
[
"project_id"
],
name:
"index_project_mirror_data_on_project_id"
,
unique:
true
,
using: :btree
create_table
"project_statistics"
,
force: :cascade
do
|
t
|
create_table
"project_statistics"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
integer
"namespace_id"
,
null:
false
t
.
integer
"namespace_id"
,
null:
false
...
@@ -1673,6 +1685,7 @@ ActiveRecord::Schema.define(version: 20170602003304) do
...
@@ -1673,6 +1685,7 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_foreign_key
"personal_access_tokens"
,
"users"
add_foreign_key
"personal_access_tokens"
,
"users"
add_foreign_key
"project_authorizations"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_authorizations"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_authorizations"
,
"users"
,
on_delete: :cascade
add_foreign_key
"project_authorizations"
,
"users"
,
on_delete: :cascade
add_foreign_key
"project_mirror_data"
,
"projects"
,
name:
"fk_d1aad367d7"
,
on_delete: :cascade
add_foreign_key
"project_statistics"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_statistics"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"protected_branch_merge_access_levels"
,
"namespaces"
,
column:
"group_id"
add_foreign_key
"protected_branch_merge_access_levels"
,
"namespaces"
,
column:
"group_id"
add_foreign_key
"protected_branch_merge_access_levels"
,
"protected_branches"
add_foreign_key
"protected_branch_merge_access_levels"
,
"protected_branches"
...
...
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