Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 09:54
    René Pjengaard
    0

    Remove data from database table att uninstall

    Hi there,

    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?

     

    Regards
    René

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Sep 23, 2010 @ 10:02
    Richard Soeteman
    0

    HI,

    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.

    Cheers,

    Richard

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 10:42
    René Pjengaard
    0

    Hi Richard,

    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!

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Sep 23, 2010 @ 10:55
    Richard Soeteman
    1

    Hi,

    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.

    Cheers,

    Richard

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 10:59
    René Pjengaard
    0

    Cheers,

    I´ll try that out. 

    Regards,
    René

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 11:48
    René Pjengaard
    0

    Hi again,

    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?

     

    Cheers
    René

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Sep 23, 2010 @ 11:52
    Richard Soeteman
    0

    I guess you need to remover the undo attribute, not sure

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 12:02
    René Pjengaard
    0

    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.

    Regards
    René

  • Steen Tøttrup 191 posts 291 karma points c-trib
    Sep 23, 2010 @ 13:15
    Steen Tøttrup
    0

    Pull the project's source code off codeplex, and put it in debug. That's probably the fastest solution.

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 23, 2010 @ 13:26
    René Pjengaard
    0

    Is that an answer for this thread?

  • Steen Tøttrup 191 posts 291 karma points c-trib
    Sep 23, 2010 @ 13:37
    Steen Tøttrup
    0

    Yes.

    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.

  • sibabrata 4 posts 24 karma points
    Aug 09, 2012 @ 12:05
    sibabrata
    0

    Is there any soltion for this available?

  • Amit 6 posts 26 karma points
    Aug 13, 2012 @ 15:34
    Amit
    0

    Hi All,

    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....!!!

Please Sign in or register to post replies

Write your reply to:

Draft