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
74853239
Commit
74853239
authored
Oct 22, 2020
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not check EE migration folders on FOSS for `require_migration!`
parent
1aac1232
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb
...ations/20190924152703_migrate_issue_trackers_data_spec.rb
+1
-1
spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb
...equests_require_code_owner_approval_from_projects_spec.rb
+1
-1
spec/support/helpers/require_migration.rb
spec/support/helpers/require_migration.rb
+21
-2
No files found.
spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb
View file @
74853239
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20190924152703_migrate_issue_trackers_data.rb
'
)
require
_migration!
(
'migrate_issue_trackers_data
'
)
RSpec
.
describe
MigrateIssueTrackersData
do
let
(
:services
)
{
table
(
:services
)
}
...
...
spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb
View file @
74853239
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191015154408_drop_merge_requests_require_code_owner_approval_from_projects.rb
'
)
require
_migration!
(
'drop_merge_requests_require_code_owner_approval_from_projects
'
)
RSpec
.
describe
DropMergeRequestsRequireCodeOwnerApprovalFromProjects
do
let
(
:projects_table
)
{
table
(
:projects
)
}
...
...
spec/support/helpers/require_migration.rb
View file @
74853239
...
...
@@ -3,23 +3,42 @@
require
'find'
class
RequireMigration
MIGRATION_FOLDERS
=
%w(db/migrate db/post_migrate ee/db/geo/migrate ee/db/geo/post_migrate)
.
freeze
class
AutoLoadError
<
RuntimeError
MESSAGE
=
"Can not find any migration file for `%{file_name}`!
\n
"
\
"You can try to provide the migration file name manually."
def
initialize
(
file_name
)
message
=
format
(
MESSAGE
,
file_name:
file_name
)
super
(
message
)
end
end
FOSS_MIGRATION_FOLDERS
=
%w(db/migrate db/post_migrate)
.
freeze
ALL_MIGRATION_FOLDERS
=
(
FOSS_MIGRATION_FOLDERS
+
%w(ee/db/geo/migrate ee/db/geo/post_migrate)
).
freeze
SPEC_FILE_PATTERN
=
/.+\/(?<file_name>.+)_spec\.rb/
.
freeze
class
<<
self
def
require_migration!
(
file_name
)
file_paths
=
search_migration_file
(
file_name
)
raise
AutoLoadError
.
new
(
file_name
)
unless
file_paths
.
first
require
file_paths
.
first
end
def
search_migration_file
(
file_name
)
MIGRATION_FOLDERS
.
flat_map
do
|
path
|
migration_folders
.
flat_map
do
|
path
|
migration_path
=
Rails
.
root
.
join
(
path
).
to_s
Find
.
find
(
migration_path
).
grep
(
/\d+_
#{
file_name
}
\.rb/
)
end
end
private
def
migration_folders
Gitlab
.
ee?
?
ALL_MIGRATION_FOLDERS
:
FOSS_MIGRATION_FOLDERS
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