locked
Recreate DB from Lightswitch RRS feed

  • Question

  • I've inherited a LS app that used to connect to sql server - but did not inherit the sql server db. Is there a way that I can tell LS to connect to a specific sql server instance and build the tables needed based on all the entity and relationship info that it maintains ? 
    Saturday, February 9, 2013 6:42 PM

Answers

  • In the Publish Wizard, you have the option to talk directly to the database, or write it to a script. Then you can save the script anywhere you want, then take it to any server & run it.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Marked as answer by etechpartner Thursday, February 14, 2013 1:03 AM
    Monday, February 11, 2013 2:32 PM
    Moderator

All replies

  • Not without access to the original database, no. Or a SQL script written by LS in the Publish Wizard.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Sunday, February 10, 2013 1:54 PM
    Moderator
  • Yann - can you tell me how I can get access to the SQL Script written by the Publish Wizard? 

    I was under the impression that the app couldnt be published because its DataConnection still points to the SQL DB that it used to run against. 

    Sunday, February 10, 2013 3:58 PM
  • Here is a little more info:

    If the database was built using the LightSwitch entity designer (not an attached external database), you should be able to just publish the application and get a new (empty) database.

    Try this:

    1) Look in the publish wizard and check the server and database name of the target database.

    2) If necessary, change the server and/or name to what you want it to be.

    3) Run the publish wizard.

    You should now have an empty database.

    I have done something similar several times.

    Mark

    Sunday, February 10, 2013 4:32 PM
  • In the Publish Wizard, you have the option to talk directly to the database, or write it to a script. Then you can save the script anywhere you want, then take it to any server & run it.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Marked as answer by etechpartner Thursday, February 14, 2013 1:03 AM
    Monday, February 11, 2013 2:32 PM
    Moderator