Skip to content

Support for powershell script files #19

Open

Description

@cquillen

Sometimes you need to do migration tasks that are really hard to do in SQL.

I started out thinking I would write a totally new tool that would work like AliaSQL, but uses powershell scripts instead of SQL. But then I decided that would be silly and I should just add powershell support to the existing tool instead.

End result is the folders would contain a mixture of both .sql and .ps1 files

For my particular use case of this is I need to make a lot of Active Directory queries to populate some newly added db columns. I know you can technically do AD stuff with pure SQL, but it's not the friendliest. I don't have permissions to get the linked servers and other configuration stuff to make it work regardless. And Corp isn't keen on giving it to us either.

So I wrote up my migration as a console app, but now I have to manually execute it after AliaSQL. This totally messes with my one click deploy zen. Plus I have to write instructions to IT to perform the new step, etc. It'd be super handy if AliaSQL would just execute it for me like any other migration.

Would you guys accept such a pull request? Assuming the quality it there of course. I'm asking about the idea in general.

Activity

  1. ericdc1 commented on Oct 26, 2016

    @ericdc1
    Contributor

    I have a similar issue that I solved with this. https://github.com/ericdc1/DTMF/blob/master/README.md

    Octopus deploy would also do this quite well.

    If you would like to talk about it on the phone email me at eric [at] coffman [dot] net

  2. ericdc1 commented on Oct 26, 2016

    @ericdc1
    Contributor

    This project also has some good stuff for chaining deployments to include compile, test, do scripts, powershell, etc https://github.com/ericdc1/AliaSQL-Demo/blob/master/README.md

    Here is the psake script https://github.com/ericdc1/AliaSQL-Demo/blob/master/default.ps1

    Psake is Powershell Make. Super powerful

  3. cquillen commented on Oct 27, 2016

    @cquillen
    Author

    I already have a completely automated CI and deploy system. It's based on psake and some custom powershell scripts with AliaSQL handling the db. Switching to a totally new deployment system like Octopus isn't feasible.

    I have been totally happy with AliaSQL. Works great. I've just hit a data migration that's much easier to do with .net code than it is in SQL.

  4. cquillen commented on Nov 1, 2016

    @cquillen
    Author

    I think you guys might be assuming the ps1 script is doing more than it is. It's just a database migration. I want the script to be ran exactly once, in the correct order, if it's not already been ran on that particular database yet. Exactly what AliaSQL already does.

    0010_AddColumnFoo.sql
    0011_PopulateColumnFoo.ps1
    0012_SetColumnFooNotNullable.sql

    I don't see how DTMF or Octopus would help me with this. I don't want to modify my psake script every time I need such a migration. (You don't modify your deploy scripts for every SQL migration file either.)

  5. cquillen commented on Nov 3, 2016

    @cquillen
    Author

    After studying the source, I don't think I actually need to modify your code. I can make my own version of the console runner, use the core nuget, and use structuremap to replace a few services with my own independent versions.

  6. nvrnight commented on Feb 23, 2017

    @nvrnight

    This would actually be very useful, it would've prevented me from doing some similar workarounds I've had to do in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions