2020-09-11 14:59:17 +03:00
function Get-PostgreSqlVersion {
2020-09-14 10:09:05 +03:00
$postgreSQLVersion = psql - -version | Take-OutputPart -Part 2
2021-04-07 13:57:35 +03:00
$aptSourceRepo = Get-AptSourceRepository -PackageName "postgresql"
2021-08-19 12:54:18 +02:00
return "PostgreSQL $postgreSQLVersion (apt source repository: $aptSourceRepo )"
2020-09-11 14:59:17 +03:00
}
function Get-MongoDbVersion {
2020-09-14 10:09:05 +03:00
$mongoDBVersion = mongod - -version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
2021-04-07 13:57:35 +03:00
$aptSourceRepo = Get-AptSourceRepository -PackageName "mongodb"
return "MongoDB $mongoDBVersion (apt source repository: $aptSourceRepo )"
2020-09-11 14:59:17 +03:00
}
function Get-SqliteVersion {
2020-09-14 10:09:05 +03:00
$sqliteVersion = sqlite3 - -version | Take-OutputPart -Part 0
2020-09-11 14:59:17 +03:00
return "sqlite3 $sqliteVersion "
}
2020-09-14 11:31:41 +03:00
function Get-MySQLVersion {
2021-12-07 23:38:14 +03:00
$mySQLVersion = mysqld - -version | Take-OutputPart -Part 2
2022-05-02 10:46:10 +02:00
if ( Test-IsUbuntu18 ) {
2021-12-10 10:27:18 +03:00
$mySQLVersion = $mySQLVersion | Take-OutputPart -Part 0 -Delimiter "-"
}
2020-09-14 16:27:20 +03:00
return "MySQL $mySQLVersion "
2020-09-14 10:09:05 +03:00
}
2020-11-17 10:18:27 +03:00
function Get-SQLCmdVersion {
$sqlcmdVersion = sqlcmd -? | Select-String -Pattern "Version" | Take-OutputPart -Part 1
return "sqlcmd $sqlcmdVersion "
}
2021-07-12 00:59:56 -07:00
function Get-SqlPackageVersion {
$sqlPackageVersion = sqlpackage / version
return "SqlPackage $sqlPackageVersion "
}
2022-02-16 08:55:13 +01:00
function Build-PostgreSqlSection {
$output = ""
$output += New-MDHeader "PostgreSQL" -Level 4
$output += New-MDList -Style Unordered -Lines @ (
( Get-PostgreSqlVersion ),
"PostgreSQL Server (user:postgres)"
)
$output += New-MDCode -Lines @ (
"PostgreSQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start postgresql.service'"
)
return $output
}
2020-09-14 10:09:05 +03:00
function Build-MySQLSection {
$output = ""
$output += New-MDHeader "MySQL" -Level 4
$output += New-MDList -Style Unordered -Lines @ (
2020-09-14 11:31:41 +03:00
( Get-MySQLVersion ),
2020-11-17 10:18:27 +03:00
"MySQL Server (user:root password:root)"
2020-09-14 10:09:05 +03:00
)
$output += New-MDCode -Lines @ (
"MySQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'"
)
2020-11-17 10:18:27 +03:00
return $output
}
function Build-MSSQLToolsSection {
$output = ""
$output += New-MDHeader "MS SQL Server Client Tools" -Level 4
$output += New-MDList -Style Unordered -Lines @ (
2021-07-12 00:59:56 -07:00
( Get-SQLCmdVersion ),
( Get-SqlPackageVersion )
2020-11-17 10:18:27 +03:00
)
2020-09-14 10:09:05 +03:00
return $output
2021-08-19 12:54:18 +02:00
}