jamiepollock / Umbraco-MigrationsViewer

An Umbraco plugin that allows backoffice users to see what Migrations are installed on an Umbraco instance.
Apache License 2.0
1 stars 2 forks source link

Feature request : show sql statements #2

Open dawoe opened 8 years ago

dawoe commented 8 years ago

Would be super awesome if you could click on a migration and see which SQL statements have run as part of the migration.

jamiepollock commented 8 years ago

I'm not sure we have that information to hand. Currently all I believe we have to go on is the umbracoMigration table. Anything else in managed in MigrationBase classes.

Any thoughts on how we'd achieve this? :)

dawoe commented 8 years ago

I think this would be good starting points to see how the core handles it: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs

https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs

Are you going to codegarden ? We can discuss it there ?

Dave

jamiepollock commented 8 years ago

@dawoe afraid I'm not. I'm using MigrationBase & MigrationRunner but we'd have to add additional code to a MigrationBase class in order to log what SQL was executed per version?

dawoe commented 8 years ago

Will try to hack something together after codegarden

dawoe commented 8 years ago

Strange that you had to hack something to see what is executed. Our sql statements get logged just out of the box.

jamiepollock commented 8 years ago

Okay, sounds like a plan. I was running against a v7.3.0 site so maybe something changed? I wasn't aware the data was being logged anywhere, where should I be looking?

Would be interesting to see what you come back with.

dawoe commented 8 years ago

We are running 7.3.8 now and everytime we run a migration the sql statements are logged in the Umbraco log files as DEBUG line.

Maybe you have set your log4net to INFO and that's why you don't see them. Or it is added in a version after 7.3.0

jamiepollock commented 8 years ago

@dawoe I've started with a fresh database and ran our first run of Migrations with log4net set to DEBUG and I see what you mean about migrations logging.

I've only had a short look over the log data and I couldn't see anything that specifically ties the Migration version with the log data. I can see the migration class name but not a version at this point.