Every time I update the production website, I need to run 5 commands, who only differ by a name.
I'd like to automatize this (in the future, it could be I have to run these commands 100 times for example).
What I do is:
Update-Database -ConfigurationTypeName "SlaveConfiguration" -StartupProjectName "FacturatieMVCv2.Data" -Verbose -ConnectionString "Server=PC-1\SQLEXPRESS;Persist Security Info=True;Initial Catalog=Database1;uid=prog;password=ndp103@50;" -ConnectionProviderName "System.Data.SqlClient"
Update-Database -ConfigurationTypeName "SlaveConfiguration" -StartupProjectName "FacturatieMVCv2.Data" -Verbose -ConnectionString "Server=PC-1\SQLEXPRESS;Persist Security Info=True;Initial Catalog=Database2;uid=prog;password=ndp103@50;" -ConnectionProviderName "System.Data.SqlClient"
Update-Database -ConfigurationTypeName "SlaveConfiguration" -StartupProjectName "FacturatieMVCv2.Data" -Verbose -ConnectionString "Server=PC-1\SQLEXPRESS;Persist Security Info=True;Initial Catalog=Database3;uid=prog;password=ndp103@50;" -ConnectionProviderName "System.Data.SqlClient"
Update-Database -ConfigurationTypeName "SlaveConfiguration" -StartupProjectName "FacturatieMVCv2.Data" -Verbose -ConnectionString "Server=PC-1\SQLEXPRESS;Persist Security Info=True;Initial Catalog=Database4;uid=prog;password=ndp103@50;" -ConnectionProviderName "System.Data.SqlClient"
Update-Database -ConfigurationTypeName "SlaveConfiguration" -StartupProjectName "FacturatieMVCv2.Data" -Verbose -ConnectionString "Server=PC-1\SQLEXPRESS;Persist Security Info=True;Initial Catalog=Database5;uid=prog;password=ndp103@50;" -ConnectionProviderName "System.Data.SqlClient"
How could I write i script, so that, when I type in the console manager:
Update-Database -type Production -version latest
It runs all the commands above, without any interference. (All connectionstrings are located in an .XML file like:
<databases>
<type>Production
<database>Database1</database>
<database>Database2</database>
<database>Database3</database>
<database>Database4</database>
<database>Database5</database>
</type>
</databases>