I'm trying to add a functionality of upgrading my SQL database using one single upgradeScripts.sql file in which I need to hardcode the previous build version and before running the upgrade scripts I need to check If the upgradeScripts.previous build number matches the LocalDB.build number. If don’t match then don’t execute the upgrade scripts.
So how can I hardcode the previous build number in WIX itself?
I prefer to create a table in the database itself and use that. It's all too easy to backup/restore a database and install/uninstall/reinstall/upgrade who knows what version for the MSI version to matter. What's important is that the current MSI being installed can create a net new database and migrate a previous schema to the current version. I do this for simple databases that need to be installed on clients silently.
Alternatively, for servers/more complex database, I like to move this out of the installer and into the application. For example Azure DevOps server does this with an Admin Tool. This way your developers have all of their favortite tools available to them without struggling with WiX and MSI.
Not sure you can do it via wix, but you can store build number in registry and use custom actions to check it:
Add custom action
In that custom action try to read value from registry
If there's some, run your script with values. you can do it from custom action too, or modify script and run it via sql script
After successful installation add new version to registry. You can do it via CA with OnExit="success" - it will run only on successful installation. Here's example with cancel, just change it to success. Or just add custom action after your scrit run. It's easier.
Related
I have a PowerShell script to automatically install sql server, and I added functionality to install updates along with the base installation. Right now I'm just putting the download link for the update into the WebClient.DownloadFile() method, but I know of a way to programatically find the download links for specific updates. I'd prefer to not hardcode download links into the script in case they change on the download site, but right now I have to.
Is there a more concrete/standard way of downloading SQL Server updates, or just consistently finding the downloads?
I want to use database project for script deployment in Azure SQL Server, I don't want to import full database. I just want to use database project for delta script. I added a project and included one script file with none as build action that contains create table statement , I am publishing the project, It's completing successfully but create statement is not executing. What is wrong here? Is there any other way to do this?
TLDR: Set your build action to "Post Deployment Script".
Longer:
What happens in SSDT is that all the files that have a build action of "Build" are built into a model of what the database should look like. When the deploy happens that model is compared to the target database and if there are any changes, a change script it generated and then optionally deployed.
If you have any file marked pre or post deployment script then they are either prepended or appended to the change script and will be run as part of the deployment.
If you have any files with a build action of "None" then SSDT ignores them, you could put anything in there, even an ascii picture of a donkey and the project will still build and deploy (obviously your ascii donkey won't get deployed anywhere).
If you just want to use SSDT to do your deployments you can just set the build action to pre or post deploy and it will be included. This is pretty odd though, either don't use SSDT or use SSDT and put the model of your entire database in there.
Personally, I would use SSDT properly and live the dream.
Ed
I'm starting to configure Keycloak to run on production environment and I need to use a database in order to run more than one instance with a single configuration repository. I'm using Oracle as SGBD.
But I didn't find the scripts to create the database in the Keycloak's git.
Does anyone knows where can I find them?
You don't need to specifically run a separate set of SQL files. Keycloak will run it for you on first startup.
A bit of advice as it's not really obvious at first - you'll either need to remove and install the default Keycloak data source (KeycloakDS) or manually modify the standalone.xml to point to the setup you want. It took me a little bit to figure out the order that I needed to do things.
Suppose I have a dialog box for giving an instance name and I want to see what are the other instances available in the local machine or the server and what if the user has both SQL Server 2005 and SQL Server 2008 installed in his system and I want to choose the instance name to deploy the database into. How do I achieve this using a Setup project created using Visual Studio 2010?
Please guide me as I'm new to Setup project.
Thanks
The problems are that VS setups don't let you build your own customized dialogs to show at the start, and don't let you run code to populate them or validate the contents. That means you're not really using the setup project because you'll end up writing your own code to do all this. Although you might be tempted to run this code as custom action, it will run with the system account (in an Everyone install) and the dialogs won't work properly because you'll not be running in a Windowing STA context. So you could integrate all this into the setup if you used another tool (such as WiX) and designed your own dialog to show during the standard install dialogs. The general design pattern is that you collect the info and stoer it into properties that are used with cusom actions in the execute sequence to make the changes. This happens to enabled silent install, specifying the property values on the msiexec command line or group policy delivery.
With VS you'd be better off having the user run your code to configure all this after the install at first run of the app.
I have a client version of a software called KRONOS and i need to update this via a batch file that will run a MSI. First I need to check to see if the application is installed. If it is, I need to see what version it is to see if I need to uninstall prior to installing the new version. I was thinking of using something to check the Registry DisplayVersion but not sure how todo the compare within the BAT file.
The version that is installed is 3.64 but I need to upgrade to 3.611.
I was hoping to do this upon logon based on a certain date and certain users since not all users have this software BUT if a user logs on to a pc, the software gets installed, I still want it to get installed on another pc if the same user goes there.
Does anybody have something like this
Thanks in advance
You can make an MSI that will do the upgrade for you by uninstall the product if it is installed, this way you will basically only need to run the MSI and it will take care for everything.
You need to specify how you create the MSI in order to configure it to support upgrades.