DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

add a module to page using sql

Sort:
You are not authorized to post a reply.





Growing Member





    Hi is it possible to add a module to a page via sql.  for e.g. I need to replace a deprecated module that has many hundreds of records on 300 + pages over several portals with a replacement module.

    My thinking is!

    1. Use a select query to get each tabid where a module currently exists (I have a query which will do that)
    2. Use this list of tab id's to add a replacement module to each page (ideally in the same pane etc).
    3. Insert query to copy data from the original module table and insert into the new modules table (passing the new moduleid).
    4. Delete old modules when successful

    I have successfully tested step 1 to return IDs, 
    I have manually added a replacement module to a single test page and successfully migrated data across as in step 3. The hard bit, of course, is whether I can add modules this way.  

    Hope this makes some sense






    Veteran Member





      Stuart,

      I did this once with a lot of testing, trial & error, etc. etc. - but it worked finally. I converted Nuntio Content to HTML modules this way. If you want to look at the scripts, you can find them in a thread in the German Usergroup forum, in the third post on page 2: http://www.dnn-usergroup..../topic/Default.aspx.

      I did not add the new modules to the pages (and I did not delete them after the process), but replaced the ModuleDefId in the Modules table. Therefore I did not touch the TabModules table.

      Note:

      • Do it in a testing environment before you run the SQL scripts on the production site.
      • Make backups (early and often, always before you try a new step)
      • Think about converting the content and the module settings.
      • Restart the application pool after changing something in the database, otherwise you see cached data and your changes are not reflected (immediately) on the site.

      Happy DNNing!
      Michael

      Michael Tobisch
      DNN★MVP

      dnnWerk Austria
      DNN Connect





      Growing Member





        Cheers Michael, I will look at your scripts and will definitely be testing on our dev server first.

        Stuart






        Veteran Member





          Posted By Stuart on 27 Feb 2020 03:37 AM

          Cheers Michael, I will look at your scripts and will definitely be testing on our dev server first.

          Stuart

          Could post your solution in here please? That could be helpful for people that will try the same in the future :-)

           

           

          You are not authorized to post a reply.

          These Forums are dedicated to the discussion of DNN Platform.

          For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

          1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
          2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
          3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
          4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
          5. No Flaming or Trolling.
          6. No Profanity, Racism, or Prejudice.
          7. Site Moderators have the final word on approving / removing a thread or post or comment.
          8. English language posting only, please.

          Would you like to help us?

          Awesome! Simply post in the forums using the link below and we'll get you started.

          Get Involved