Comments (8)
How are you getting that? I'm only getting that if I'm already at the bottom of the migrations Where there are no more migrations to go down to. here are some examples :
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:migrate
Started: 2013-02-14 3:00pm CST
[db:migrate]:
Migrating UP:
========= InsertUsersTable2 ======== (0.02)
========= InsertUsersTable5 ======== (0.01)
========= InsertUsersTable6 ======== (0.01)
========= InsertUsersTable7 ======== (0.01)
========= IsertItemsTable ======== (0.02)
========= IsertItemsTable2 ======== (0.01)
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:status
Started: 2013-02-14 3:00pm CST
[db:status]:
===================== APPLIED =======================
InsertUsersTable [ 20130210112135 ]
InsertUsersTable2 [ 20130210112918 ]
InsertUsersTable5 [ 20130210114207 ]
InsertUsersTable6 [ 20130210114343 ]
InsertUsersTable7 [ 20130210115011 ]
IsertItemsTable [ 20130211011752 ]
IsertItemsTable2 [ 20130212054011 ]
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:migrate version=-1
Started: 2013-02-14 3:00pm CST
[db:migrate]:
Migrating DOWN to: 20130211011752
========= IsertItemsTable2 ======== (0.05)
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:status
Started: 2013-02-14 3:00pm CST
[db:status]:
===================== APPLIED =======================
InsertUsersTable [ 20130210112135 ]
InsertUsersTable2 [ 20130210112918 ]
InsertUsersTable5 [ 20130210114207 ]
InsertUsersTable6 [ 20130210114343 ]
InsertUsersTable7 [ 20130210115011 ]
IsertItemsTable [ 20130211011752 ]
===================== NOT APPLIED =======================
IsertItemsTable2 [ 20130212054011 ]
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:migrate version=20130210112135
Started: 2013-02-14 3:00pm CST
[db:migrate]:
Migrating DOWN to: 20130210112135
========= IsertItemsTable ======== (0.03)
========= InsertUsersTable7 ======== (0.01)
========= InsertUsersTable6 ======== (0.01)
========= InsertUsersTable5 ======== (0.01)
========= InsertUsersTable2 ======== (0.03)
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:status
Started: 2013-02-14 3:00pm CST
[db:status]:
===================== APPLIED =======================
InsertUsersTable [ 20130210112135 ]
===================== NOT APPLIED =======================
InsertUsersTable2 [ 20130210112918 ]
InsertUsersTable5 [ 20130210114207 ]
InsertUsersTable6 [ 20130210114343 ]
InsertUsersTable7 [ 20130210115011 ]
IsertItemsTable [ 20130211011752 ]
IsertItemsTable2 [ 20130212054011 ]
Finished: 2013-02-14 3:00pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡ php ruckus.php db:migrate version=-1
Started: 2013-02-14 3:01pm CST
[db:migrate]:
Cannot migrate DOWN via offset "-1": not enough migrations exist to execute.
You asked for (1) but only available are (0):
Finished: 2013-02-14 3:01pm CST
salimane at salimane-zenbook in ~/htdocs/myproject
⚡
from ruckusing-migrations.
Its easy to reproduce, just start a new project, add one migration and execute it and then attempt to roll it back.
# new project, no existing migrations
[codyc:ruckusing-migrations (master)]$ php ruckus.php db:generate create_a
Created migration: 20130214164050_CreateA.php
[codyc:ruckusing-migrations (master)]$ php ruckus.php db:migrate
Started: 2013-02-14 8:40am PST
[db:migrate]:
Migrating UP:
========= CreateA ======== (0.00)
Finished: 2013-02-14 8:40am PST
[codyc:ruckusing-migrations (master)]$ php ruckus.php db:migrate version=-1
Started: 2013-02-14 8:41am PST
[db:migrate]:
Cannot migrate DOWN via offset "-1": not enough migrations exist to execute.
You asked for (1) but only available are (0):
Finished: 2013-02-14 8:41am PST
[codyc:ruckusing-migrations (master)]$
from ruckusing-migrations.
is it not feature? I mean rollback for the only applied migration.
In any case, there is placed this code lib/Task/Db/Migrate.php: 182.
// If we are not at the bottom then adjust our index (to satisfy array_slice)
if ($current_index == -1) {
$current_index = 0;
} else {
$current_index += 1;
}
----- NEED TO BE ------
// If we are not at the bottom then adjust our index (to satisfy array_slice)
if ($current_index == -1) {
$current_index = 0;
}
Sorry, can't fix it myself - have some problem with environment.
from ruckusing-migrations.
The issue is happening right here:
https://github.com/ruckus/ruckusing-migrations/blob/master/lib/Ruckusing/Util/Migrator.php#L137
The array_pop
is removing it. I'm still digging into this.
from ruckusing-migrations.
So yes, removing that array_pop
solves the problem. But at the change of behavior when specifying a VERSION
to go with a timestamp. That is rolling back with db:migrate VERSION=-1
works as expected but if you specify it like db:migration VERSION=20130214164050
then prior behavior would stop at the "tail" of that migration (that is it does not run the down()
of that one) but it now runs thru it and does execute down()
.
So maybe the solution is to pass in more information to the get_runnable_migrations
method which provides more context about the scenario being used so we can act accordingly
from ruckusing-migrations.
yeah, my bad in solution pretending.
from ruckusing-migrations.
Please could you check the branch issue_86
. I think this branch fixes the issue.
The issue were :
- when migrating
down
the current index should be increased by offset length number not by1
in the case of migratingup
- taking into account the previous statement, it means we could have empty
$available
migrations. When that's the case, it means go all the way to bottom or up according to the direction. Don't give error, and run whatever has to be run to get to that state. Providing a null$destination
toprepare_to_migrate
can achieve that.
Thanks
from ruckusing-migrations.
Wow @salimane you rock - yep issue_86
looks like it works. You are the man!
from ruckusing-migrations.
Related Issues (20)
- Run migration through code HOT 1
- db:migrate throws exception if migrations dir is not writable HOT 3
- migrate_from_offset issue HOT 1
- Unable to execute query for trigger HOT 10
- DB connection issue when trying to setup Ruckusing Migrations - Abstract.php No Such File Or Directory HOT 4
- Error during migrations and rollbacks. "Reason: Commands out of sync; you can't run this command now" HOT 3
- Is it possible to execute the ruckusing-migration through http request HOT 4
- Is there any plan to have more details in schema_migrations table? HOT 1
- MySQL timestamp needs a NULL attribute when null == true
- how can i add auto_increment column to work with mysql and postgres databases? HOT 5
- FOREIGN KEY Constraint HOT 1
- Exception not properly thrown HOT 1
- Documentation for config file HOT 1
- CREATE INDEX CONCURRENTLY cannot run inside a transaction block
- Fatal error: Class 'mysqli' not found in /web/vendor/ruckusing/ruckusing-migrations/lib/Ruckusing/Adapter/MySQL/Base.php on line 1259 HOT 3
- Error:I dont know what column type of 'longtext' maps to for MySQL
- Roadmap: Integrate Percona Toolkit? HOT 1
- Use PSR LoggerInterface instead of Ruckusing_Util_Logger.
- Unable to connect via TLS for MySQL connections
- too many connections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruckusing-migrations.