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
2a087ad3
Commit
2a087ad3
authored
Feb 21, 2020
by
Lee Tickett
Committed by
Andreas Brandl
Feb 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop forked_project_links table
parent
3765eb1d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
11 deletions
+57
-11
changelogs/unreleased/drop_forked_project_links_table.yml
changelogs/unreleased/drop_forked_project_links_table.yml
+5
-0
db/migrate/20200215222507_drop_forked_project_links_fk.rb
db/migrate/20200215222507_drop_forked_project_links_fk.rb
+27
-0
db/migrate/20200215225103_drop_forked_project_links_table.rb
db/migrate/20200215225103_drop_forked_project_links_table.rb
+17
-0
db/schema.rb
db/schema.rb
+0
-9
lib/gitlab/database/migration_helpers.rb
lib/gitlab/database/migration_helpers.rb
+8
-2
No files found.
changelogs/unreleased/drop_forked_project_links_table.yml
0 → 100644
View file @
2a087ad3
---
title
:
Drop forked_project_links table
merge_request
:
20771
author
:
Lee Tickett
type
:
other
db/migrate/20200215222507_drop_forked_project_links_fk.rb
0 → 100644
View file @
2a087ad3
# frozen_string_literal: true
class
DropForkedProjectLinksFk
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
with_lock_retries
do
remove_foreign_key_if_exists
:forked_project_links
,
column: :forked_to_project_id
end
end
def
down
unless
foreign_key_exists?
(
:forked_project_links
,
:projects
,
column: :forked_to_project_id
)
with_lock_retries
do
# rubocop: disable Migration/AddConcurrentForeignKey
add_foreign_key
:forked_project_links
,
:projects
,
column: :forked_to_project_id
,
on_delete: :cascade
,
validate:
false
end
end
fk_name
=
concurrent_foreign_key_name
(
:forked_project_links
,
:forked_to_project_id
,
prefix:
'fk_rails_'
)
validate_foreign_key
(
:forked_project_links
,
:forked_to_project_id
,
name:
fk_name
)
end
end
db/migrate/20200215225103_drop_forked_project_links_table.rb
0 → 100644
View file @
2a087ad3
# frozen_string_literal: true
class
DropForkedProjectLinksTable
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
drop_table
"forked_project_links"
,
id: :serial
do
|
t
|
t
.
integer
"forked_to_project_id"
,
null:
false
t
.
integer
"forked_from_project_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
index
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
end
end
end
db/schema.rb
View file @
2a087ad3
...
@@ -1654,14 +1654,6 @@ ActiveRecord::Schema.define(version: 2020_02_20_180944) do
...
@@ -1654,14 +1654,6 @@ ActiveRecord::Schema.define(version: 2020_02_20_180944) do
t
.
index
[
"root_project_id"
],
name:
"index_fork_networks_on_root_project_id"
,
unique:
true
t
.
index
[
"root_project_id"
],
name:
"index_fork_networks_on_root_project_id"
,
unique:
true
end
end
create_table
"forked_project_links"
,
id: :serial
,
force: :cascade
do
|
t
|
t
.
integer
"forked_to_project_id"
,
null:
false
t
.
integer
"forked_from_project_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
index
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
end
create_table
"geo_cache_invalidation_events"
,
force: :cascade
do
|
t
|
create_table
"geo_cache_invalidation_events"
,
force: :cascade
do
|
t
|
t
.
string
"key"
,
null:
false
t
.
string
"key"
,
null:
false
end
end
...
@@ -4747,7 +4739,6 @@ ActiveRecord::Schema.define(version: 2020_02_20_180944) do
...
@@ -4747,7 +4739,6 @@ ActiveRecord::Schema.define(version: 2020_02_20_180944) do
add_foreign_key
"fork_network_members"
,
"projects"
,
column:
"forked_from_project_id"
,
name:
"fk_b01280dae4"
,
on_delete: :nullify
add_foreign_key
"fork_network_members"
,
"projects"
,
column:
"forked_from_project_id"
,
name:
"fk_b01280dae4"
,
on_delete: :nullify
add_foreign_key
"fork_network_members"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"fork_network_members"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"fork_networks"
,
"projects"
,
column:
"root_project_id"
,
name:
"fk_e7b436b2b5"
,
on_delete: :nullify
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_container_repository_updated_events"
,
"container_repositories"
,
name:
"fk_212c89c706"
,
on_delete: :cascade
add_foreign_key
"geo_container_repository_updated_events"
,
"container_repositories"
,
name:
"fk_212c89c706"
,
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_cache_invalidation_events"
,
column:
"cache_invalidation_event_id"
,
name:
"fk_42c3b54bed"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_container_repository_updated_events"
,
column:
"container_repository_updated_event_id"
,
name:
"fk_6ada82d42a"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_container_repository_updated_events"
,
column:
"container_repository_updated_event_id"
,
name:
"fk_6ada82d42a"
,
on_delete: :cascade
...
...
lib/gitlab/database/migration_helpers.rb
View file @
2a087ad3
...
@@ -235,11 +235,17 @@ module Gitlab
...
@@ -235,11 +235,17 @@ module Gitlab
# PostgreSQL constraint names have a limit of 63 bytes. The logic used
# PostgreSQL constraint names have a limit of 63 bytes. The logic used
# here is based on Rails' foreign_key_name() method, which unfortunately
# here is based on Rails' foreign_key_name() method, which unfortunately
# is private so we can't rely on it directly.
# is private so we can't rely on it directly.
def
concurrent_foreign_key_name
(
table
,
column
)
#
# prefix:
# - The default prefix is `fk_` for backward compatibility with the existing
# concurrent foreign key helpers.
# - For standard rails foreign keys the prefix is `fk_rails_`
#
def
concurrent_foreign_key_name
(
table
,
column
,
prefix:
'fk_'
)
identifier
=
"
#{
table
}
_
#{
column
}
_fk"
identifier
=
"
#{
table
}
_
#{
column
}
_fk"
hashed_identifier
=
Digest
::
SHA256
.
hexdigest
(
identifier
).
first
(
10
)
hashed_identifier
=
Digest
::
SHA256
.
hexdigest
(
identifier
).
first
(
10
)
"
fk_
#{
hashed_identifier
}
"
"
#{
prefix
}
#{
hashed_identifier
}
"
end
end
# Long-running migrations may take more than the timeout allowed by
# Long-running migrations may take more than the timeout allowed by
...
...
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