Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
bb1a964c
Commit
bb1a964c
authored
Jun 19, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multiple entries of base migration in history for MongoDB
parent
5f852465
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
MigrateController.php
extensions/mongodb/console/controllers/MigrateController.php
+23
-3
No files found.
extensions/mongodb/console/controllers/MigrateController.php
View file @
bb1a964c
...
...
@@ -122,6 +122,8 @@ class MigrateController extends BaseMigrateController
*/
protected
function
getMigrationHistory
(
$limit
)
{
$this
->
ensureBaseMigrationHistory
();
$query
=
new
Query
;
$rows
=
$query
->
select
([
'version'
,
'apply_time'
])
->
from
(
$this
->
migrationCollection
)
...
...
@@ -129,15 +131,33 @@ class MigrateController extends BaseMigrateController
->
limit
(
$limit
)
->
all
(
$this
->
db
);
$history
=
ArrayHelper
::
map
(
$rows
,
'version'
,
'apply_time'
);
if
(
empty
(
$history
))
{
$this
->
addMigrationHistory
(
self
::
BASE_MIGRATION
);
}
unset
(
$history
[
self
::
BASE_MIGRATION
]);
return
$history
;
}
/**
* Ensures migration history contains at least base migration entry.
*/
protected
function
ensureBaseMigrationHistory
()
{
static
$ensured
=
false
;
if
(
!
$ensured
)
{
$query
=
new
Query
;
$row
=
$query
->
select
([
'version'
])
->
from
(
$this
->
migrationCollection
)
->
andWhere
([
'version'
=>
self
::
BASE_MIGRATION
])
->
limit
(
1
)
->
one
(
$this
->
db
);
if
(
empty
(
$row
))
{
$this
->
addMigrationHistory
(
self
::
BASE_MIGRATION
);
}
$ensured
=
true
;
}
}
/**
* @inheritdoc
*/
protected
function
addMigrationHistory
(
$version
)
...
...
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