BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
33bcfbf8
Commit
33bcfbf8
authored
Aug 07, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '36052-reset-only-migration-models' into 'master'
Reset only migration models Closes #36052 See merge request !13336
parents
bfac6ce6
4d7c072d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
spec_helper.rb
spec/spec_helper.rb
+2
-2
migrations_helpers.rb
spec/support/migrations_helpers.rb
+10
-0
No files found.
spec/spec_helper.rb
View file @
33bcfbf8
...
...
@@ -134,13 +134,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 @
33bcfbf8
...
...
@@ -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