Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
is there a way to remove data from a database table, when user uninstalls a package?
My problem is, that i am adding a macrotype to cmsMacroPropertyType table at install, but can´t figure out what event is triggered at uninstall.
Btw, is there an article that describes best-practice of install/uninstall packages?
Are you using a Package action for it? If so implement the undo method and make sure that your package xml file doesn't contain a undo="true/false" option. This is currently a bug in the installer.
no i´m not using package actions. I read this http://umbraco.org/documentation/books/package-actions-reference and didn´t think i could add data to tables with it.
Thanks,RenéPS: Thanks for the help yesterday, you rock!
Thanks :D.. I'm the coordinator on the Package Action Contrib project which has some extra actions. Check out the Execute SQL action. To Uninstall you need to create a seperate action xml (runat="uninstall") which deletes the records from the database.
I´ll try that out.
i tried your solution, and it works fine when installing, but it does not remove the date when uninstalling the package. Here is the Package Actions:
<Action runat="install" undo="false" alias="ExecuteSql"><![CDATA[INSERT INTO cmsMacroPropertyType (macroPropertyTypeAlias, macroPropertyTypeRenderAssembly, macroPropertyTypeRenderType, macroPropertyTypeBaseType) VALUES('IssuuDocuments', 'Skybrud.IssuuImporter4Umbraco', 'IssuuDocuments', 'String');]]></Action>
<Action runat="uninstall" undo="false" alias="ExecuteSql"><![CDATA[DELETE FROM cmsMacroPropertyType WHERE macroPropertyTypeRenderAssembly = 'Skybrud.IssuuImporter4Umbraco';]]></Action>
Can you see whats wrong?
I guess you need to remover the undo attribute, not sure
No such luck i´m affraid. Anyone else have a solution to this?And thanks a lot for the help Richard, i appreciate it alot.RegardsRené
Pull the project's source code off codeplex, and put it in debug. That's probably the fastest solution.
Is that an answer for this thread?
If you're using the Package Action Contrib package, you can get the source code off codeplex. That would probably be the best way of pin-pointing the problem, as it would show you exactly why your undo action isn't being run, or maybe that it is actually being run, but fails, etc etc.
That is, if you have Visual Studio installed.
Is there any soltion for this available?
I was playing with the install/uninstall stuff. I found that, If we create individual action tags for each and every procedure then it may work.
<Action runat="install" undo="false" alias="ExecuteSql"><![CDATA[ CREATE PROC [uTasklist_DelTasklist] @task_id [int] AS SET NOCOUNT ON DELETE FROM [uTasklist_Task] WHERE [task_id] = @task_id ]]></Action><Action runat="install" undo="true" alias="ExecuteSql"><![CDATA[ CREATE PROC [uTasklist_EditTasklist] @task_id [int], @task_details [NTEXT] AS SET NOCOUNT ON UPDATE [uTasklist_Task] SET [task_details] = @task_details WHERE [task_id] = @task_id ]]></Action>
But incase of uninstall, if we execute just 1 delete Sql procedure statement in 1 action tag its working i.e
<Action runat="uninstall" alias="ExecuteSql"> <![CDATA[DROP PROCEDURE [uTasklist_EditTasklist]]]> </Action>
As it is deleting only 1 procedure, if we try to delete all the procedures in 1 single uninstall action it will not work.
Or try deleting all the procedures using individual unistall actions it is not working....
I tried all the combinations using undo="false",undo="true".
Waiting for a solution....!!!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted