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
258792a0
Commit
258792a0
authored
Aug 07, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '36052-reset-only-migration-models-ee' into 'master'
Reset only migration models See merge request !2611
parents
a58edda3
af1f9165
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
spec/spec_helper.rb
spec/spec_helper.rb
+2
-2
spec/support/migrations_helpers.rb
spec/support/migrations_helpers.rb
+10
-0
No files found.
spec/spec_helper.rb
View file @
258792a0
...
...
@@ -146,13 +146,13 @@ RSpec.configure do |config|
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
,
previous_migration
.
version
)
ActiveRecord
::
Base
.
descendants
.
each
(
&
:reset_column_information
)
reset_column_in_migration_models
end
config
.
after
(
:example
,
:migration
)
do
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
)
ActiveRecord
::
Base
.
descendants
.
each
(
&
:reset_column_information
)
reset_column_in_migration_models
end
config
.
around
(
:each
,
:nested_groups
)
do
|
example
|
...
...
spec/support/migrations_helpers.rb
View file @
258792a0
...
...
@@ -15,6 +15,16 @@ module MigrationsHelpers
ActiveRecord
::
Migrator
.
migrations
(
migrations_paths
)
end
def
reset_column_in_migration_models
described_class
.
constants
.
sort
.
each
do
|
name
|
const
=
described_class
.
const_get
(
name
)
if
const
.
is_a?
(
Class
)
&&
const
<
ActiveRecord
::
Base
const
.
reset_column_information
end
end
end
def
previous_migration
migrations
.
each_cons
(
2
)
do
|
previous
,
migration
|
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