Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for powershell script files #19

Open
cquillen opened this issue Oct 26, 2016 · 6 comments
Open

Support for powershell script files #19

cquillen opened this issue Oct 26, 2016 · 6 comments

Comments

@cquillen
Copy link

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.

@ericdc1
Copy link
Contributor

ericdc1 commented Oct 26, 2016

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

@ericdc1
Copy link
Contributor

ericdc1 commented Oct 26, 2016

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

@cquillen
Copy link
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.

@cquillen
Copy link
Author

cquillen commented Nov 1, 2016

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.)

@cquillen
Copy link
Author

cquillen commented Nov 3, 2016

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.

@nvrnight
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants