Skip to content

Commit 908ac47

Browse files
committed
Initial commit
0 parents  commit 908ac47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5755
-0
lines changed

.gitignore

Lines changed: 402 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
![GitHub](https://img.shields.io/github/license/openpotato/sqldocs)
2+
3+
# SQLDocs
4+
5+
## Introduction
6+
7+
SQLDocs is a cross-platform console application build with [.NET 7](https://dotnet.microsoft.com/) to create nice looking [MkDocs](https://www.mkdocs.org/) schema documentations for relational databases. Currently the following database systems are supported:
8+
9+
+ [Firebird](https://firebirdsql.org/)
10+
+ [PostgreSQL](https://www.postgresql.org/)
11+
12+
SQLDocs first extracts the metadata of the desired database and stores it in a normalised JSON file. This JSON file can be manually extended with additional information (descriptions, valid data values, etc.).
13+
14+
In a second step, the information from the JSON file is used to create or update a MkDocs project (with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) as theme).
15+
16+
Both the JSON file and the MkDocs project can be versioned in a Git repository.
17+
18+
## Examples
19+
20+
If you would like to see what documentation created with SQLDocs looks like:
21+
22+
+ [Sample documentation for a Firebird database](https://openpotato.github.io/sqldocs.sample/firebird)
23+
+ [Sample documentation for a PostgreSQL database](https://openpotato.github.io/sqldocs.sample/postgres)
24+
25+
## Documentation
26+
27+
Documentation is available in the [GitHub wiki](https://github.com/openpotato/sqldocs/wiki).
28+
29+
## To-do list
30+
31+
+ Support for additional DBMS (e.g. MySQL or MS SQL Server)
32+
+ Support for additional table types (e.g. external tables, temporary tables)
33+
+ Support for domains and custom types
34+
+ Support for generators/sequences
35+
+ Support for triggers
36+
+ Support for stored procedures
37+
+ (Maybe) support for alternative static-site generators (e.g. [Docusaurus](https://docusaurus.io/))
38+
39+
## Can I help?
40+
41+
Yes, that would be much appreciated. The best way to help is to post a response via the Issue Tracker and/or submit a Pull Request.

SqlDocs.sln

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33516.290
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlDocs.App", "src\SqlDocs.App.csproj", "{09080314-F527-44FF-8F41-664AFE9D76AF}"
7+
EndProject
8+
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "SqlDocs.Setup", "setup\SqlDocs.Setup.wixproj", "{3F276369-D5AB-4935-969A-926AF748FE37}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|ARM64 = Debug|ARM64
14+
Debug|x64 = Debug|x64
15+
Debug|x86 = Debug|x86
16+
Release|Any CPU = Release|Any CPU
17+
Release|ARM64 = Release|ARM64
18+
Release|x64 = Release|x64
19+
Release|x86 = Release|x86
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
25+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|ARM64.Build.0 = Debug|Any CPU
26+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|x64.ActiveCfg = Debug|Any CPU
27+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|x64.Build.0 = Debug|Any CPU
28+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|x86.ActiveCfg = Debug|Any CPU
29+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Debug|x86.Build.0 = Debug|Any CPU
30+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|ARM64.ActiveCfg = Release|Any CPU
33+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|ARM64.Build.0 = Release|Any CPU
34+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|x64.ActiveCfg = Release|Any CPU
35+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|x64.Build.0 = Release|Any CPU
36+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|x86.ActiveCfg = Release|Any CPU
37+
{09080314-F527-44FF-8F41-664AFE9D76AF}.Release|x86.Build.0 = Release|Any CPU
38+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|Any CPU.ActiveCfg = Debug|x64
39+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|Any CPU.Build.0 = Debug|x64
40+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|ARM64.ActiveCfg = Debug|ARM64
41+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|ARM64.Build.0 = Debug|ARM64
42+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|x64.ActiveCfg = Debug|x64
43+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|x64.Build.0 = Debug|x64
44+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|x86.ActiveCfg = Debug|x86
45+
{3F276369-D5AB-4935-969A-926AF748FE37}.Debug|x86.Build.0 = Debug|x86
46+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|Any CPU.ActiveCfg = Release|x64
47+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|Any CPU.Build.0 = Release|x64
48+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|ARM64.ActiveCfg = Release|ARM64
49+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|ARM64.Build.0 = Release|ARM64
50+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|x64.ActiveCfg = Release|x64
51+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|x64.Build.0 = Release|x64
52+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|x86.ActiveCfg = Release|x86
53+
{3F276369-D5AB-4935-969A-926AF748FE37}.Release|x86.Build.0 = Release|x86
54+
EndGlobalSection
55+
GlobalSection(SolutionProperties) = preSolution
56+
HideSolutionNode = FALSE
57+
EndGlobalSection
58+
GlobalSection(ExtensibilityGlobals) = postSolution
59+
RESX_NeutralResourcesLanguage = en-GB
60+
SolutionGuid = {B146D1D5-6426-4AA3-A11B-144ACD4C0740}
61+
EndGlobalSection
62+
EndGlobal

azure-gitversion.ps1

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#
2+
# Generates a version number from Git tags and/or branch names following GitVersion/GitFlow approach
3+
#
4+
5+
# Init global consts
6+
$TagPrefix = "v-"
7+
$DevelopSuffix = "develop"
8+
$ReleaseSuffix = "preview"
9+
$HotfixSuffix = "hotfix"
10+
11+
# Init global variables
12+
$MajorVersion = 0
13+
$MinorVersion = 0
14+
$PatchVersion = 1
15+
$VersionSuffix = ""
16+
$NumberOfCommits = 0
17+
18+
# RegEx patterns
19+
$GitDescribePattern = "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(\-(?<commits>0|[1-9]\d*))?"
20+
$GitBranchNamePattern = "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)"
21+
22+
# Get the current git branch from Azure DevOps
23+
$CurrentBranch = $Env:BUILD_SOURCEBRANCH
24+
$CurrentBranchName = $Env:BUILD_SOURCEBRANCHNAME
25+
26+
# Try to extract version info from Git tag
27+
$Tag = git describe --tags --match "$TagPrefix[0-9]*"
28+
if ($Tag)
29+
{
30+
if ($Tag -match $GitDescribePattern)
31+
{
32+
$MajorVersion = [int]$Matches.major
33+
$MinorVersion = [int]$Matches.minor
34+
$PatchVersion = [int]$Matches.patch
35+
$NumberOfCommits = [int]$Matches.commits
36+
}
37+
else
38+
{
39+
throw "Could not extract version info from Git tag " + $Tag
40+
}
41+
}
42+
else
43+
{
44+
# Git git rev-list --count head
45+
$NumberOfCommits = git rev-list --count head
46+
}
47+
48+
# Try to calculate semantic version based on GitFlow branching
49+
if ($CurrentBranch -match "main")
50+
{
51+
$SemVersion = [string]$MajorVersion + "." + [string]$MinorVersion + "." + [string]$PatchVersion
52+
}
53+
elseif ($CurrentBranch -match "develop")
54+
{
55+
$PatchVersion = $PatchVersion + 1
56+
$VersionSuffix = if ($NumberOfCommits -eq 0) { "-" + $DevelopSuffix } else { "-" + $DevelopSuffix + "." + [string]$NumberOfCommits }
57+
$SemVersion = [string]$MajorVersion + "." + [string]$MinorVersion + "." + [string]$PatchVersion + $VersionSuffix
58+
}
59+
elseif ($CurrentBranch -match "hotfix")
60+
{
61+
if ($CurrentBranchName -match $GitBranchNamePattern)
62+
{
63+
$MajorVersion = [int]$Matches.major
64+
$MinorVersion = [int]$Matches.minor
65+
$PatchVersion = [int]$Matches.patch
66+
$VersionSuffix = if ($NumberOfCommits -eq 0) { "-" + $HotfixSuffix } else { "-" + $HotfixSuffix + "." + [string]$NumberOfCommits }
67+
$SemVersion = [string]$MajorVersion + "." + [string]$MinorVersion + "." + [string]$PatchVersion + $VersionSuffix
68+
}
69+
else
70+
{
71+
throw "Could not extract version info from Git branch name " + $CurrentBranchName
72+
}
73+
}
74+
elseif ($CurrentBranch -match "release")
75+
{
76+
if ($CurrentBranchName -match $GitBranchNamePattern)
77+
{
78+
$MajorVersion = [int]$Matches.major
79+
$MinorVersion = [int]$Matches.minor
80+
$PatchVersion = [int]$Matches.patch
81+
$VersionSuffix = if ($NumberOfCommits -eq 0) { "-" + $ReleaseSuffix } else { "-" + $ReleaseSuffix + "." + [string]$NumberOfCommits }
82+
$SemVersion = [string]$MajorVersion + "." + [string]$MinorVersion + "." + [string]$PatchVersion + $VersionSuffix
83+
}
84+
else
85+
{
86+
throw "Could not extract version info from Git branch name " + $CurrentBranchName
87+
}
88+
}
89+
elseif ($CurrentBranch -match "features")
90+
{
91+
$VersionSuffix = if ($NumberOfCommits -eq 0) { "-" + $CurrentBranchName } else { "-" + $CurrentBranchName + "." + [string]$NumberOfCommits }
92+
$SemVersion = [string]$MajorVersion + "." + [string]$MinorVersion + "." + [string]$PatchVersion + $VersionSuffix
93+
}
94+
95+
# Log output
96+
Write-Host "Branch: $CurrentBranch"
97+
Write-Host "Branch name: $CurrentBranchName"
98+
Write-Host "Git describe: $Tag"
99+
Write-Host "Number of commits: $NumberOfCommits"
100+
Write-Host "Major version: $MajorVersion"
101+
Write-Host "Minor version: $MinorVersion"
102+
Write-Host "Patch version: $PatchVersion"
103+
Write-Host "Version Suffix: $VersionSuffix"
104+
Write-Host "Sem version: $SemVersion"
105+
106+
# Set Azure DevOps variables
107+
Write-Host "##vso[task.setvariable variable=MajorVersion]$MajorVersion"
108+
Write-Host "##vso[task.setvariable variable=MinorVersion]$MinorVersion"
109+
Write-Host "##vso[task.setvariable variable=PatchVersion]$PatchVersion"
110+
Write-Host "##vso[task.setvariable variable=VersionSuffix]$VersionSuffix"
111+
Write-Host "##vso[task.setvariable variable=SemVersion]$SemVersion"

azure-pipelines.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
pool:
2+
vmImage: 'windows-2022'
3+
4+
variables:
5+
- group: 'dotnet-config'
6+
- group: 'github-config'
7+
8+
steps:
9+
- checkout: self
10+
persistCredentials: true
11+
- task: SSMClientToolsSetup@1
12+
displayName: 'Setup DigiCert Tools'
13+
inputs:
14+
APIKey: '$(SM_API_KEY)'
15+
- task: DownloadSecureFile@1
16+
displayName: 'Download Client Authentication Certificate'
17+
name: SM_CLIENT_CERT_FILE
18+
inputs:
19+
secureFile: ClientCert.p12
20+
- task: PowerShell@2
21+
displayName: 'Prepare Code Signing'
22+
inputs:
23+
targetType: 'inline'
24+
script: |
25+
$env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools'
26+
$env:SM_LOG_OUTPUT = 'console'
27+
smctl credentials save $(SM_API_KEY) $(SM_CLIENT_CERT_PASSWORD)
28+
smksp_cert_sync.exe
29+
failOnStderr: true
30+
pwsh: true
31+
- task: PowerShell@2
32+
displayName: 'Get Version Number'
33+
inputs:
34+
filePath: 'azure-gitversion.ps1'
35+
failOnStderr: true
36+
pwsh: true
37+
- task: Assembly-Info-NetCore@2
38+
displayName: 'Apply Assembly Infos'
39+
inputs:
40+
Path: '$(Build.SourcesDirectory)'
41+
FileNames: '**/*.csproj'
42+
InsertAttributes: true
43+
FileEncoding: 'auto'
44+
WriteBOM: false
45+
VersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)'
46+
FileVersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)'
47+
InformationalVersion: '$(SemVersion)'
48+
LogLevel: 'verbose'
49+
FailOnWarning: false
50+
- task: DotNetCoreCLI@2
51+
displayName: 'Restore'
52+
inputs:
53+
command: 'restore'
54+
projects: '*.sln'
55+
feedsToUse: 'select'
56+
vstsFeed: '340e7a34-33ea-4418-8b72-d55dcb74efa7/dd1a6c3c-4e29-44c2-a80d-9d6c7004ac57'
57+
- task: DotNetCoreCLI@2
58+
displayName: 'Publish x64'
59+
inputs:
60+
command: 'publish'
61+
publishWebProjects: false
62+
projects: 'src/SqlDocs.App.csproj'
63+
arguments: '-c $(BuildConfiguration) -a x64 -o src/bin/Publish/win-x64 /p:Version=$(SemVersion)'
64+
zipAfterPublish: false
65+
modifyOutputPath: false
66+
- task: DotNetCoreCLI@2
67+
displayName: 'Publish x86'
68+
inputs:
69+
command: 'publish'
70+
publishWebProjects: false
71+
projects: 'src/SqlDocs.App.csproj'
72+
arguments: '-c $(BuildConfiguration) -a x86 -o src/bin/Publish/win-x86 /p:Version=$(SemVersion)'
73+
zipAfterPublish: false
74+
modifyOutputPath: false
75+
- task: DotNetCoreCLI@2
76+
displayName: 'Publish portable'
77+
inputs:
78+
command: 'publish'
79+
publishWebProjects: false
80+
projects: 'src/SqlDocs.App.csproj'
81+
arguments: '-c $(BuildConfiguration) -a x86 -o src/bin/Publish/portable /p:Version=$(SemVersion)'
82+
zipAfterPublish: false
83+
modifyOutputPath: false
84+
- task: PowerShell@2
85+
displayName: 'Sign EXE files'
86+
inputs:
87+
targetType: 'inline'
88+
script: |
89+
$env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools'
90+
$env:SM_HOST = '$(SM_HOST)'
91+
$env:SM_CLIENT_CERT_FILE = '$(SM_CLIENT_CERT_FILE.secureFilePath)'
92+
$env:SM_LOG_OUTPUT = 'console'
93+
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/win-x64/SqlDocs.exe
94+
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/win-x86/SqlDocs.exe
95+
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/portable/SqlDocs.exe
96+
failOnStderr: true
97+
pwsh: true
98+
- task: DotNetCoreCLI@2
99+
displayName: 'Build MSI Setup x64'
100+
inputs:
101+
command: 'build'
102+
projects: 'setup/SqlDocs.Setup.wixproj'
103+
arguments: '-c $(BuildConfiguration) -p:Platform=x64 -o $(Build.ArtifactStagingDirectory)'
104+
- task: DotNetCoreCLI@2
105+
displayName: 'Build MSI Setup x86'
106+
inputs:
107+
command: 'build'
108+
projects: 'setup/SqlDocs.Setup.wixproj'
109+
arguments: '-c $(BuildConfiguration) -p:Platform=x86 -o $(Build.ArtifactStagingDirectory)'
110+
- task: ArchiveFiles@2
111+
displayName: 'Create Zip for portable'
112+
inputs:
113+
rootFolderOrFile: '$(Build.SourcesDirectory)/src/bin/Publish/portable/'
114+
includeRootFolder: false
115+
archiveType: 'zip'
116+
archiveFile: '$(Build.ArtifactStagingDirectory)/sqldocs-portable.zip'
117+
replaceExistingArchive: true
118+
- task: PowerShell@2
119+
displayName: 'Sign MSI files'
120+
inputs:
121+
targetType: 'inline'
122+
script: |
123+
$env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools'
124+
$env:SM_HOST = '$(SM_HOST)'
125+
$env:SM_CLIENT_CERT_FILE = '$(SM_CLIENT_CERT_FILE.secureFilePath)'
126+
$env:SM_LOG_OUTPUT = 'console'
127+
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.ArtifactStagingDirectory)/sqldocs-x64.msi
128+
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.ArtifactStagingDirectory)/sqldocs-x86.msi
129+
failOnStderr: true
130+
pwsh: true
131+
- task: PowerShell@2
132+
displayName: 'Push code to GitHub'
133+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
134+
inputs:
135+
targetType: 'inline'
136+
script: |
137+
git remote add github https://$(PAT)@github.com/openpotato/sqldocs.git
138+
git fetch github
139+
git checkout .
140+
git push github HEAD:main
141+
git push --tags github HEAD:main
142+
pwsh: true
143+
- task: GitHubRelease@1
144+
displayName: 'Create GitHub Release'
145+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
146+
inputs:
147+
gitHubConnection: 'stuebersystems'
148+
repositoryName: 'openpotato/sqldocs'
149+
action: 'create'
150+
target: '$(Build.SourceVersion)'
151+
tagSource: 'gitTag'
152+
title: '$(SemVersion) Release of SqlDocs'
153+
addChangeLog: false

setup/Package.en-us.wxl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
This file contains the declaration of all the localizable strings.
3+
-->
4+
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
5+
6+
<String Id="AppName" Value="SQLDocs" />
7+
<String Id="AppDescription" Value="Building nice looking documention of relational database schemata" />
8+
<String Id="AppFolder" Value="SqlDocs" />
9+
<String Id="Manufacturer" Value="STÜBER SYSTEMS GmbH" />
10+
<String Id="ProjectFolder" Value="OpenPotato" />
11+
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
12+
13+
<String Id="FeaturesCompleteTitle" Value="Complete installation" />
14+
<String Id="FeaturesCompleteDescription" Value="Complete installation of all available features." />
15+
<String Id="FeatureCoreTitle" Value="Core components" />
16+
<String Id="FeatureCoreDescription" Value="Installation of the core components." />
17+
18+
<String Id="WelcomeDlgDescription" Value="The Setup Wizard will install [ProductName] version [ProductVersion] on your computer. Click Next to continue or Cancel to exit the Setup Wizard." />
19+
20+
</WixLocalization>

0 commit comments

Comments
 (0)