Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
33e49146
Commit
33e49146
authored
Feb 17, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
random cleanup.
parent
3507d153
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
migrator.php
laravel/cli/tasks/migrate/migrator.php
+8
-11
No files found.
laravel/cli/tasks/migrate/migrator.php
View file @
33e49146
...
@@ -75,10 +75,9 @@ class Migrator extends Task {
...
@@ -75,10 +75,9 @@ class Migrator extends Task {
return
;
return
;
}
}
// We need to grab the latest batch ID and increment it
// We need to grab the latest batch ID and increment it by one.
// by one. This allows us to group the migrations such
// This allows us to group the migrations so we can easily
// that we can easily determine which migrations need
// determine which migrations need to roll back.
// to roll back for the command.
$batch
=
$this
->
database
->
batch
()
+
1
;
$batch
=
$this
->
database
->
batch
()
+
1
;
foreach
(
$migrations
as
$migration
)
foreach
(
$migrations
as
$migration
)
...
@@ -87,9 +86,9 @@ class Migrator extends Task {
...
@@ -87,9 +86,9 @@ class Migrator extends Task {
echo
'Migrated: '
.
$this
->
display
(
$migration
)
.
PHP_EOL
;
echo
'Migrated: '
.
$this
->
display
(
$migration
)
.
PHP_EOL
;
// After running a migration, we log its execution in the
// After running a migration, we log its execution in the
migration
//
migration table so that we can easily determine which
//
table so that we can easily determine which migrations we'll
//
migrations we'll reverse on a
rollback.
//
reverse in the event of a migration
rollback.
$this
->
database
->
log
(
$migration
[
'bundle'
],
$migration
[
'name'
],
$batch
);
$this
->
database
->
log
(
$migration
[
'bundle'
],
$migration
[
'name'
],
$batch
);
}
}
}
}
...
@@ -113,8 +112,7 @@ class Migrator extends Task {
...
@@ -113,8 +112,7 @@ class Migrator extends Task {
// The "last" method on the resolver returns an array of migrations,
// The "last" method on the resolver returns an array of migrations,
// along with their bundles and names. We will iterate through each
// along with their bundles and names. We will iterate through each
// migration and run the "down" method, removing them from the
// migration and run the "down" method.
// database as we go.
foreach
(
array_reverse
(
$migrations
)
as
$migration
)
foreach
(
array_reverse
(
$migrations
)
as
$migration
)
{
{
$migration
[
'migration'
]
->
down
();
$migration
[
'migration'
]
->
down
();
...
@@ -123,8 +121,7 @@ class Migrator extends Task {
...
@@ -123,8 +121,7 @@ class Migrator extends Task {
// By only removing the migration after it has successfully rolled back,
// By only removing the migration after it has successfully rolled back,
// we can re-run the rollback command in the event of any errors with
// we can re-run the rollback command in the event of any errors with
// the migration. When we re-run, only the migrations that have not
// the migration and pick up where we left off.
// been rolled back will still be in the database.
$this
->
database
->
delete
(
$migration
[
'bundle'
],
$migration
[
'name'
]);
$this
->
database
->
delete
(
$migration
[
'bundle'
],
$migration
[
'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