Closed balistof closed 12 years ago
So, what you currently have is the method Migrator.IsUpToDate(). We use it exactly for this purpose. To give the user feedback that migrations are pending. The exact timestamp(s) that are missing should be transparent to the user in my opinion.
What the Migrator.IsUpToDate() method does not tell me if the database is on a newer version than the application itself.
In my project we have to deal with both cases. One is the older database then required by the application. So there the IsUpToDate() method is fine. But the second case is when the required database version is lower than the actual one.
On Tue, Aug 30, 2011 at 8:08 PM, dradovic < reply@reply.github.com>wrote:
So, what you currently have is the method Migrator.IsUpToDate(). We use it exactly for this purpose. To give the user feedback that migrations are pending. The exact timestamp(s) that are missing should be transparent to the user in my opinion.
Reply to this email directly or view it on GitHub: https://github.com/dradovic/MigSharp/issues/25#issuecomment-1946427
I see. You are right. There are four possible states we could be at:
Yes, I could live with that! As a user I would like to see what is going on with back-end data.
Why did you close the issue? We haven't programmed it yet... :)
Ups, was not my intention.... I guess to early in the morning ;)
So, my suggestion is as follows:
Is this something you could live with for now?
Yes, that sounds good to me!
Thanks, Chris
On Wed, Sep 7, 2011 at 7:21 AM, dradovic < reply@reply.github.com>wrote:
So, my suggestion is as follows:
- Let's mark the IsUpToDate method as obsolete. People should use the new technique to get that information. IsUpToDate tells you only half of the truth and therefore is dangerous.
- To prevent more than one round-trip to the database, the FetchMigrations and FetchMigrationsTo methods should already return the complete information about pending and unknown migrations (by "unknown", I mean migrations that are in the database but are not found in the application). A nice design would dictate, that these methods would return something else than IMigrationBatch - some interface that tells you the state (UpToDate/PendingMigrations/UnknownMigrations) and also gives you the possibility to execute the pending migrations (in the form of an IMigrationBatch). But this would mean that the API would not stay backward compatible and therefore we can only do it in v2. In the meantime, for v1.x, I suggest to extend the IMigrationBatch interface with a boolean flag (yay) that tells if there were any unknown migrations, something like UnknownMigrationsDetected. This flag would tell you if your application is out-dated and it will be removed again in v2.
Is this something you could live with for now?
Reply to this email directly or view it on GitHub: https://github.com/dradovic/MigSharp/issues/25#issuecomment-2025710
I've just committed a first draft of this feature. It will be contained in v2.0. Please have a look if the new API satisfies your needs.
Just released in 2.0.0.
For our application we need to inform the user about the current version of his database schema and ask him if he wants to upgrade or not. I know that the version is on a per module basis and that it leaves out potential gaps in the migrations (not all migrations applied). But that is of a different story since some migrations are based on prior executed migrations. Would that be a feature to include?