* Add lint/format checks to the Gitea release workflow and Makefile (targets: vet, fmt, fmt-check, staticcheck, govulncheck, check) * Switch .golangci.json formatter from gofmt to gofumpt (extra.group-params) * Bump golang.org/x/text 0.37.0 -> 0.39.0 for GO-2026-5970; re-vendor * Fix staticcheck S1011 in pkg/diff; drop unused pgsql writer helpers * Fix gocritic unnamedResult (pkg/diff) and rangeValCopy (pkg/pgsql) * Apply gofumpt + goimports formatting across the tree
MSSQL Reader
Reads database schema from Microsoft SQL Server databases using a live connection.
Features
- Live Connection: Connects to MSSQL databases using the Microsoft ODBC driver
- Multi-Schema Support: Reads multiple schemas with full support for user-defined schemas
- Comprehensive Metadata: Reads tables, columns, constraints, indexes, and extended properties
- Type Mapping: Converts MSSQL types to canonical types for cross-database compatibility
- Extended Properties: Extracts table and column descriptions from MS_Description
- Identity Columns: Maps IDENTITY columns to AutoIncrement
- Relationships: Derives relationships from foreign key constraints
Connection String Format
sqlserver://[user[:password]@][host][:port][?query]
Examples:
sqlserver://sa:password@localhost/dbname
sqlserver://user:pass@192.168.1.100:1433/production
sqlserver://localhost/testdb?encrypt=disable
Supported Constraints
- Primary Keys
- Foreign Keys (with ON DELETE and ON UPDATE actions)
- Unique Constraints
- Check Constraints
Type Mappings
| MSSQL Type | Canonical Type |
|---|---|
| INT | int |
| BIGINT | int64 |
| SMALLINT | int16 |
| TINYINT | int8 |
| BIT | bool |
| REAL | float32 |
| FLOAT | float64 |
| NUMERIC, DECIMAL | decimal |
| NVARCHAR, VARCHAR | string |
| DATETIME2 | timestamp |
| DATETIMEOFFSET | timestamptz |
| UNIQUEIDENTIFIER | uuid |
| VARBINARY | bytea |
| DATE | date |
| TIME | time |
Usage
import "git.warky.dev/wdevs/relspecgo/pkg/readers/mssql"
import "git.warky.dev/wdevs/relspecgo/pkg/readers"
reader := mssql.NewReader(&readers.ReaderOptions{
ConnectionString: "sqlserver://sa:password@localhost/mydb",
})
db, err := reader.ReadDatabase()
if err != nil {
panic(err)
}
// Process schema...
for _, schema := range db.Schemas {
fmt.Printf("Schema: %s\n", schema.Name)
for _, table := range schema.Tables {
fmt.Printf(" Table: %s\n", table.Name)
}
}
Testing
Run tests with:
go test ./pkg/readers/mssql/...
For integration testing with a live MSSQL database:
docker-compose up -d mssql
go test -tags=integration ./pkg/readers/mssql/...
docker-compose down