How do i remove a database table when uninstalling a package
I have made a package witch create a table in the Umbraco Database, I am creating the table with a usercontrol that execute when my package is installed. My problem is how to remove that table when the package is uninstalled?
you should create a package action that's only triggered when uninstalling a package, and that package action should just fire a sql statement to delete the table... you can find more on package actions on the wiki.
Btw, you could use the same approach when installing the package, just create a package action that fires when installing the package and execute a sql script that creates the table in the database. -> this package action should do fine.
Did you include the PackageActionContrib DLL in you package? and I think you need to delete undo="false" Was a bug in previous versions, maybe it still is?
If you're unsure whether your action is not functioning properly, you may install the package action tester available here, which lets you check if your action is fired.
And as Richard points out, there used to be/is an issue with the undo attribute.
How do i remove a database table when uninstalling a package
I have made a package witch create a table in the Umbraco Database, I am creating the table with a usercontrol that execute when my package is installed. My problem is how to remove that table when the package is uninstalled?
Thanks in advance!
you should create a package action that's only triggered when uninstalling a package, and that package action should just fire a sql statement to delete the table... you can find more on package actions on the wiki.
Btw, you could use the same approach when installing the package, just create a package action that fires when installing the package and execute a sql script that creates the table in the database. -> this package action should do fine.
Cheers,
/Dirk
Hi
If you use PackageActions and the ExecuteSQL Action from the PackageActionsContrib project you can specify sql to execute during install and uninstall
Cheers,
Richard
Thanks for your replies!
I have tried to use the package action, but it isn't creating my table. What can be wrong?
Tried this:
<Action runat="install" undo="false" alias="ExecuteSql"> <![CDATA[CREATE TABLE tmp ( [ClientCategoryId] [int] IDENTITY(1,1) NOT NULL)]]></Action>
Did you include the PackageActionContrib DLL in you package? and I think you need to delete undo="false" Was a bug in previous versions, maybe it still is?
Cheers,
Richard
If you're unsure whether your action is not functioning properly, you may install the package action tester available here, which lets you check if your action is fired.
And as Richard points out, there used to be/is an issue with the undo attribute.
Hope this helps.
/Dirk
Sorry i missed that i should include the packageActionContrib.dll, that very much!!
is working on a reply...