-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f19ee2
commit ab6dd48
Showing
25 changed files
with
322 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function Get-CurentEnvironment { | ||
param () | ||
|
||
# github actions environment | ||
if ($env:GITHUB_ACTIONS -eq 'true') { | ||
'github' | ||
} | ||
else { | ||
'local' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Get-ChildItem -Path $PSScriptRoot -Filter *.ps1 | Where-Object { $_.Name -ne 'Import-All.ps1' } | ForEach-Object { . $_.FullName } | ||
|
||
$currentEnv = Get-CurentEnvironment | ||
Get-ChildItem -Path (Join-Path $PSScriptRoot $currentEnv) -Filter *.ps1 | ForEach-Object { . $_.FullName } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function Start-Mssql { | ||
param () | ||
|
||
exec { sqllocaldb.exe s MSSQLLocalDB } | ||
|
||
$dataSource = '(localdb)\MSSQLLocalDB' | ||
$database = 'SqlDatabaseTest' | ||
|
||
$databases = exec { sqlcmd.exe -S $dataSource -l 15 -Q 'select Name from sys.databases' } | ||
$databaseExists = $databases | Where-Object { $_.Trim() -eq $database } | ||
if (-not $databaseExists) { | ||
$file = Join-Path $PSScriptRoot '..\..\..\Sources\Docker\mssql.create-database.sql' | ||
$file = [System.IO.Path]::GetFullPath($file) | ||
Set-Content -Path $file -Value (Get-Content -Path $file -Raw) | ||
|
||
exec { sqlcmd.exe -S $dataSource -i $file } | ||
} | ||
|
||
@{ | ||
containerId = '' | ||
connectionString = "Data Source=$dataSource;Initial Catalog=$database;Integrated Security=true;Connect Timeout=5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function Start-Mysql { | ||
param () | ||
|
||
$port = 3306 | ||
|
||
if (-not (Test-Connection -TargetName localhost -TcpPort $port -ErrorAction Continue)) { | ||
exec { mysqld.exe --console --initialize } | ||
|
||
$file = Join-Path $PSScriptRoot mysql.init.sql | ||
exec { mysqld.exe --console --init-file=$file & } | ||
|
||
for ($i = 0; $i -lt 3; $i++) { | ||
if (Test-Connection -TargetName localhost -TcpPort $port -ErrorAction Continue) { | ||
break | ||
} | ||
|
||
Start-Sleep 2 | ||
} | ||
|
||
$file = Join-Path $PSScriptRoot '..\..\..\Sources\Docker\mysql.create-database.sql' | ||
$file = [System.IO.Path]::GetFullPath($file) | ||
Set-Content -Path $file -Value (Get-Content -Path $file -Raw) | ||
|
||
exec { mysql.exe -uroot -proot -e "source $file" } | ||
} | ||
|
||
return @{ | ||
containerId = '' | ||
connectionString = "Server=localhost;Port=$port;Database=sqldatabasetest;User ID=root;Password=root;Connection Timeout=5;" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function Start-Pgsql { | ||
param () | ||
|
||
$port = 5432 | ||
|
||
if (-not (Test-Connection -TargetName localhost -TcpPort $port -ErrorAction Continue)) { | ||
Set-Service 'postgresql-x64-14' -StartupType Manual | ||
Start-Service 'postgresql-x64-14' | ||
|
||
for ($i = 0; $i -lt 3; $i++) { | ||
if (Test-Connection -TargetName localhost -TcpPort $port -ErrorAction Continue) { | ||
break | ||
} | ||
|
||
Start-Sleep 2 | ||
} | ||
|
||
$file = Join-Path $PSScriptRoot '..\..\..\Sources\Docker\pgsql.create-database.sql' | ||
$file = [System.IO.Path]::GetFullPath($file) | ||
Set-Content -Path $file -Value (Get-Content -Path $file -Raw) | ||
|
||
$env:PGPASSWORD = 'root' | ||
|
||
$psql = Join-Path $env:PGBIN 'psql.exe' | ||
exec { & $psql -U postgres -a -f $file } | ||
} | ||
|
||
@{ | ||
containerId = '' | ||
connectionString = "Host=localhost;Port=$port;Database=sqldatabasetest;Username=postgres;Password=root;Timeout=5;" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function Start-Mysql { | ||
param () | ||
|
||
$container = Start-Container -Image sqldatabase/mysql:8.0.25 -ContainerPort 3306 | ||
|
||
$builder = New-Object -TypeName System.Data.Common.DbConnectionStringBuilder | ||
$builder['Database'] = 'sqldatabasetest' | ||
$builder['User ID'] = 'root' | ||
$builder['Password'] = 'qwerty' | ||
$builder['Connection Timeout'] = 5 | ||
|
||
$builder['Server'] = 'localhost' | ||
$builder['Port'] = $container.port | ||
$connectionString = $builder.ToString() | ||
|
||
$builder['Server'] = $container.ip | ||
$builder['Port'] = 3306 | ||
$remoteConnectionString = $builder.ToString() | ||
|
||
@{ | ||
containerId = $container.containerId | ||
connectionString = $connectionString | ||
remoteConnectionString = $remoteConnectionString | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function Start-Pgsql { | ||
param () | ||
|
||
$container = Start-Container -Image sqldatabase/postgres:13.3 -ContainerPort 5432 | ||
|
||
$builder = New-Object -TypeName System.Data.Common.DbConnectionStringBuilder | ||
$builder['Database'] = 'sqldatabasetest' | ||
$builder['Username'] = 'postgres' | ||
$builder['Password'] = 'qwerty' | ||
$builder['Timeout'] = 5 | ||
|
||
$builder['Host'] = 'localhost' | ||
$builder['Port'] = $container.port | ||
$connectionString = $builder.ToString() | ||
|
||
$builder['Host'] = $container.ip | ||
$builder['Port'] = 5432 | ||
$remoteConnectionString = $builder.ToString() | ||
|
||
@{ | ||
containerId = $container.containerId | ||
connectionString = $connectionString | ||
remoteConnectionString = $remoteConnectionString | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.