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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
77c1d87f
Commit
77c1d87f
authored
Feb 08, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make resetting column information overridable in EE
parent
6f7702bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
spec/support/migrations_helpers.rb
spec/support/migrations_helpers.rb
+7
-2
No files found.
spec/support/migrations_helpers.rb
View file @
77c1d87f
...
@@ -25,14 +25,19 @@ module MigrationsHelpers
...
@@ -25,14 +25,19 @@ module MigrationsHelpers
clear_schema_cache!
clear_schema_cache!
# Reset column information for the most offending classes **after** we
# Reset column information for the most offending classes **after** we
# migrated the schema up, otherwise, column information could be outdated
# migrated the schema up, otherwise, column information could be
ActiveRecord
::
Base
.
descendants
.
each
{
|
klass
|
klass
.
reset_column_information
}
# outdated. We have a separate method for this so we can override it in EE.
ActiveRecord
::
Base
.
descendants
.
each
(
&
method
(
:reset_column_information
))
# Without that, we get errors because of missing attributes, e.g.
# Without that, we get errors because of missing attributes, e.g.
# super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8>
# super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8>
ApplicationSetting
.
define_attribute_methods
ApplicationSetting
.
define_attribute_methods
end
end
def
reset_column_information
(
klass
)
klass
.
reset_column_information
end
def
previous_migration
def
previous_migration
migrations
.
each_cons
(
2
)
do
|
previous
,
migration
|
migrations
.
each_cons
(
2
)
do
|
previous
,
migration
|
break
previous
if
migration
.
name
==
described_class
.
name
break
previous
if
migration
.
name
==
described_class
.
name
...
...
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