This might be helpful: http://code.dblock.org/ShowPost.aspx?id=100. We use 
another set of extensions, the one described in my post handles your scenario 
properly, and we keep our schema incremental, so it figures out which version 
of the database it's looking at and generates an upgrade script from there.

-dB.

dB. @ dblock.org 
Moscow|Geneva|Seattle|New York


-----Original Message-----
From: Thomas Due [mailto:t...@scanvaegt.dk] 
Sent: Thursday, October 21, 2010 2:40 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] A couple of questions regarding sql server and wix 
installer

I am maintaining the installer for our software, and so far I have a pretty 
simple installer which copies the files, registrers the windows services and 
creates a couple of shortcuts. No big deal. 

Now I am beginning to get to the more complex stuff though, like maintaining a 
database. 
I have experimented a bit with this, and found a way to create the database and 
run a script. 
However, the way I understand it, this script will actually create the database 
(through a sql user login with permissions to create a database): 

<Component Id="CreateDB" Guid="*" DiskId="1" KeyPath="yes">
    <Condition><![CDATA[(NOT Installed) AND (DATABASEAUTH=0)]]></Condition>
    <Util:User Id="DBUser" Name="[DATABASEUSER]" Password="[DATABASEPWD]"/>

    <!-- Create the database -->
    <Sql:SqlDatabase Id="CreateDatabase"
                     Server="[DATABASESERVER]"
                     Database="[DATABASENAME]"
                     User="DBUser"
                     CreateOnInstall="yes"
                     ConfirmOverwrite="no">

        <!-- Run the script to create tables -->
        <Sql:SqlScript Id="CreateDB" 
                       ExecuteOnInstall="yes" 
                       BinaryKey="CreateDBScript"     
                       Sequence="3" 
                       ContinueOnError="no"/>

        <!-- Run any updates -->
        <Sql:SqlScript Id="UpdateDB"     
                       ExecuteOnInstall="yes" 
                       BinaryKey="UpdateDBScript"   
                       Sequence="4" 
                       ContinueOnError="no"/>

        <!-- Insert static data -->
        <Sql:SqlScript Id="InsertData"     
                       ExecuteOnInstall="yes" 
                       BinaryKey="InsertDataScript"   
                       Sequence="4" 
                       ContinueOnError="no"/>
    </Sql:SqlDatabase>
</Component>

However, how would I formulate this if the database already exists? Can I only 
handle that sort of thing in the actual script, or does the SqlWixExtension 
give me any tools to work with? 
 
Thanks, 

Thomas Due


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest 
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing 
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to