dradovic / MigSharp

Mig# (MigSharp) is a .NET framework for database migrations and versioning
Other
106 stars 34 forks source link

When MigSharp fails it does not show which migration has caused the failure #49

Closed regisbsb closed 10 years ago

regisbsb commented 10 years ago

For example if you have a invalid migration on Migration_2 but Migration_1 has runned already if hard to tell were is the mistake if you have Migration_3 4 etc...

dradovic commented 10 years ago

What do you mean by "having an invalid migration"? Are you talking about validation errors or exceptions thrown while executing against a database? In the latter case, you could for example get the pending migrations which would list you Migration_2 and Migration_3 etc. if you had a problem in Migration_2. The migrations are transactional - either they have been executed or rolled back.

regisbsb commented 10 years ago

Yeah but it would be much easier to say "Migration_2 has failed", then inner exception the Sql error.

dradovic commented 10 years ago

Yes, you're right. I shall have a look at this.

regisbsb commented 10 years ago

Cheers

dradovic commented 10 years ago

I've looked at the code and I've noticed that the error is logged. Unfortunately, without saying which Migration it was thrown it. Do you see this message? Would it be enough, to add the information there? I'm a bit hesitant to invent a new kind of exception to wrap DbException (and potentially other exceptions) because that would be breaking change to the API.

regisbsb commented 10 years ago

Entity framework does that. Maybe a configuration? So it does not break the api, to throw wrapped exceptions, must enable that option.


Regis Benedito dos Santos Bittencourt contact@regis.ws regisbsbittencourt (skype) On 24 Apr 2014 17:23, "dradovic" notifications@github.com wrote:

I've looked at the code and I've noticed that the error is logged. Unfortunately, without saying which Migration it was thrown it. Do you see this message? Would it be enough, to add the information there? I'm a bit hesitant to invent a new kind of exception to wrap DbException (and potentially other exceptions) because that would be breaking change to the API.

— Reply to this email directly or view it on GitHubhttps://github.com/dradovic/MigSharp/issues/49#issuecomment-41300725 .

dradovic commented 10 years ago

I'm not a fan of configurable breaking changes. I think that if this information is included in the error log that this is enough.

regisbsb commented 10 years ago

Fair enough.

dradovic commented 10 years ago

I've committed the change to the master. It will be contained in the next release.

dradovic commented 10 years ago

Released in 2.3.