A simple tool to squash sql files into single files based on type.
go install github.com/conneroisu/sqlcquash@latest{inputs={nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable";sqlcquash.url="github:conneroisu/sqlcquash";flake-utils.url="github:numtide/flake-utils";}outputs={self,sqlcquash}:
flake-utils.lib.eachDefaultSystem(system:
letpkgs=importnixpkgs{inheritsystem;overlays=[sqlcquash.overlays.default];};in{devShells.deffault=pkgs.mkShell{packages=withpkgs;[sqlcquash];};});}sqlcaush combine -c config.yaml//go:generate github.com/conneroisu/sqlcquas@latest combineThe configuration file is sqlcquash.yaml and should be placed in the same directory as the executable.
---
version: 1dbs:
- schemas: ./schemas/*.sqlqueries: ./queries/*.sqlseeds: ./seeds/*.sqlschema: ./combined/schema.sqlquery: ./combined/queries.sqlseed: ./combined/seeds.sqlfmt: sleek -i 4fmt-contains: queriesThe schemas field is a glob pattern that matches the files to be combined into a single file.
The queries field is a glob pattern that matches the files to be combined into a single file.
The seeds field is a glob pattern that matches the files to be combined into a single file.
The schema field is the path to the file where the combined schema will be written.
The query field is the path to the file where the combined query will be written.