Files
runner-images/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1
T

62 lines
1.8 KiB
PowerShell
Raw Normal View History

function Get-PostgreSqlVersion {
2020-09-14 10:09:05 +03:00
$postgreSQLVersion = psql --version | Take-OutputPart -Part 2
return $postgreSQLVersion
}
function Get-MongoDbVersion {
2020-09-14 10:09:05 +03:00
$mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
return $mongoDBVersion
}
function Get-SqliteVersion {
2020-09-14 10:09:05 +03:00
$sqliteVersion = sqlite3 --version | Take-OutputPart -Part 0
return $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
return $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 $sqlcmdVersion
2020-11-17 10:18:27 +03:00
}
2021-07-12 00:59:56 -07:00
function Get-SqlPackageVersion {
$sqlPackageVersion = sqlpackage /version
return $sqlPackageVersion
2021-07-12 00:59:56 -07:00
}
function Build-PostgreSqlSection {
$node = [HeaderNode]::new("PostgreSQL")
$node.AddToolVersion("PostgreSQL", $(Get-PostgreSqlVersion))
$node.AddNote(@(
"User: postgres",
"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'"
) -join "`n")
return $node
}
2020-09-14 10:09:05 +03:00
function Build-MySQLSection {
$node = [HeaderNode]::new("MySQL")
$node.AddToolVersion("MySQL", $(Get-MySQLVersion))
$node.AddNote(@(
"User: root",
"Password: root",
"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'"
) -join "`n")
2020-09-14 10:09:05 +03:00
return $node
2020-11-17 10:18:27 +03:00
}
function Build-MSSQLToolsSection {
$node = [HeaderNode]::new("MS SQL")
$node.AddToolVersion("sqlcmd", $(Get-SQLCmdVersion))
$node.AddToolVersion("SqlPackage", $(Get-SqlPackageVersion))
return $node
2021-08-19 12:54:18 +02:00
}