Narinder Verma
Narinder Verma

Reputation: 173

How to make a chocolatey package that uses version

I have three different chocolatey package for mssql 2012, 2014, 2016

What do i need to do so that i can pass a command like:

choco install mssqlserver --version 2012

and that should install 2012 mssql server.

Thanks.

Upvotes: 2

Views: 5153

Answers (2)

ferventcoder
ferventcoder

Reputation: 12561

Versioned Installation

So far you are good to go with how you would specify a version. What you've posted is exactly right:

choco install mssqlserver --version 2012

You just need to tell Chocolatey where to get those packages from, whether it be an explicitly passed --source or in your default sources. See https://chocolatey.org/docs/commands-source for more information on setting default sources for your packages.

Recommendation for SQL Server

Every piece of software is different. In this case you don't typically upgrade from 2012 to 2016, you bring up a 2016 and migrate the data. So you wouldn't follow a normal package upgrade in this instance. You may also wish to leave 2012 on 2012 for a longer period of time and take minor updates.

So in a case like this, where SQL Server 2012, 2014, and 2016 might have small updates, you would want 2012 to likely stay on 2012. We'd recommend separating those out into differently named packages.

Thus mssqlserver-2012, mssqlserver-2014, and mssqlserver-2016.

If you leave it as mssqlserver, when you push all versions of mssqlserver up and specify a particular version to install (like 2012), you would also need to pin to that version otherwise the next choco upgrade all would attempt to upgrade mssqlserver to 2016.

Upvotes: 6

Joseph K.
Joseph K.

Reputation: 1223

Typically you can:

For example:

choco install ruby --version 1.9.3.55100 -my

However, I wasn't able to find the package called mssqlserver. So you'll have to start by finding the proper package first, and then look for those versions that you want to install.

Upvotes: 1

Related Questions