3

I have defined a process that consists of 2 steps:

  1. Deploy an IIS WebSite
  2. Execute a script file

The first step in the process executes without any issues. I am able to upload a nuget package to Octopus Server's built-in package repository and deploy this to my IIS Web Site.

For the second step in the process, where I am asked to specify a script file to run, I am unable to upload a sql file either using the built-in package repository or using a external package repository since Octopus will not allow me to upload a .sql file type.

What is the best way of specifying the SQL Script File to be run?

Should I package it along with my nuget package and then specify the script source to 'Script file inside a package' or is it possible to upload a SQL file to a repository (external or built-in) and specify that file as the SQL script file to execute?

Is there a best practice for this?

Thanks,

Sean

Seán
  • 523
  • 2
  • 10
  • 17
  • 1
    Is that sql file logically part of the website? Could it not be packaged as part of the same NuGet package as the website? – Alex M May 16 '17 at 11:27

1 Answers1

1

By "Script file" or "Script file inside a package" Octopus means a Powershell script or Bash script. If you want to execute a SQL script as part of your deployment you have two options:

  1. Install an existing task from the Octopus Community Library (https://library.octopusdeploy.com/listing) that executes SQL. Here are two of them:

  2. Create a Powershell or Bash script to execute your SQL script.

Ben Richards
  • 3,437
  • 1
  • 14
  • 18
  • Can you provide more information about #2? Code would be nice. – Kyle McClellan May 23 '19 at 17:06
  • 1
    Here are a couple of examples. https://stackoverflow.com/questions/8423541/how-do-you-run-a-sql-server-query-from-powershell and https://cmatskas.com/execute-sql-query-with-powershell/. – Ben Richards May 24 '19 at 13:00