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
e30c8414
Commit
e30c8414
authored
Nov 07, 2018
by
Toon Claes
Committed by
Douglas Barbosa Alexandre
Nov 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo adding foreign key on geo_event_log.hashed_storage_attachments_event_id
parent
dcffe1f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
16 deletions
+37
-16
db/schema.rb
db/schema.rb
+0
-1
ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb
...igrate/20181017131623_add_missing_geo_even_log_indexes.rb
+0
-15
ee/spec/migrations/add_missing_geo_even_log_indexes_spec.rb
ee/spec/migrations/add_missing_geo_even_log_indexes_spec.rb
+37
-0
No files found.
db/schema.rb
View file @
e30c8414
...
...
@@ -3283,7 +3283,6 @@ ActiveRecord::Schema.define(version: 20181105201455) do
add_foreign_key
"fork_networks"
,
"projects"
,
column:
"root_project_id"
,
name:
"fk_e7b436b2b5"
,
on_delete: :nullify
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_cache_invalidation_events"
,
column:
"cache_invalidation_event_id"
,
name:
"fk_42c3b54bed"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_hashed_storage_attachments_events"
,
column:
"hashed_storage_attachments_event_id"
,
name:
"fk_304067fc30"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_hashed_storage_migrated_events"
,
column:
"hashed_storage_migrated_event_id"
,
name:
"fk_27548c6db3"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_job_artifact_deleted_events"
,
column:
"job_artifact_deleted_event_id"
,
name:
"fk_176d3fbb5d"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_lfs_object_deleted_events"
,
column:
"lfs_object_deleted_event_id"
,
name:
"fk_d5af95fcd9"
,
on_delete: :cascade
...
...
ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb
View file @
e30c8414
...
...
@@ -18,8 +18,6 @@ class AddMissingGeoEvenLogIndexes < ActiveRecord::Migration
job_artifact_deleted_event_id
upload_deleted_event_id]
MISSING_FK_COLUMNS
=
%i[hashed_storage_attachments_event_id]
disable_ddl_transaction!
def
up
...
...
@@ -35,22 +33,9 @@ class AddMissingGeoEvenLogIndexes < ActiveRecord::Migration
NON_INDEXED_COLUMNS
.
each
do
|
col
|
add_concurrent_index_not_null
(
:geo_event_log
,
col
)
end
# Add missing foreign keys
MISSING_FK_COLUMNS
.
each
do
|
col
|
add_concurrent_foreign_key
(
:geo_event_log
,
foreign_table_name
(
col
),
column:
col
,
on_delete: :cascade
)
end
end
def
down
# Remove missing foreign keys again
MISSING_FK_COLUMNS
.
each
do
|
col
|
remove_foreign_key
(
:geo_event_log
,
column:
col
)
end
# Drop indexes that didn't exist before
NON_INDEXED_COLUMNS
.
each
do
|
col
|
without_foreign_key
(
:geo_event_log
,
col
)
do
...
...
ee/spec/migrations/add_missing_geo_even_log_indexes_spec.rb
0 → 100644
View file @
e30c8414
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'ee'
,
'db'
,
'migrate'
,
'20181017131623_add_missing_geo_even_log_indexes.rb'
)
describe
AddMissingGeoEvenLogIndexes
,
:migration
do
let
(
:namespace
)
{
table
(
:namespaces
).
create
(
path:
'ns'
,
name:
'Namespace'
)
}
let
(
:project
)
{
table
(
:projects
).
create
(
namespace_id:
namespace
.
id
,
path:
'pj'
)
}
let
(
:geo_event_log
)
{
table
(
:geo_event_log
)
}
let
(
:updated_event
)
do
table
(
:geo_repository_updated_events
).
create
(
project_id:
project
.
id
,
source:
0
,
branches_affected:
0
,
tags_affected:
0
)
end
let
(
:hashed_attachment_event
)
do
table
(
:geo_hashed_storage_attachments_events
).
create
(
project_id:
project
.
id
,
old_attachments_path:
'/tmp/foo/bar'
,
new_attachments_path:
'/tmp/foo/baz'
)
end
describe
'#up'
do
it
'adds indexes'
do
schema_migrate_up!
end
end
describe
'#down'
do
it
'rolls back indexes'
do
schema_migrate_down!
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