Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ jobs:
- name: Generate sql models
run: make sqlc-check

sql-lint:
name: Sqlc lint
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v4

- name: Run sql lint
run: make sql-lint-ci

rpc-check:
name: RPC check
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[sqlfluff]
dialect = sqlite
templater = raw

processes = -1

exclude_rules = AM04, AM05, AL05, ST06

warnings = RF04

large_file_skip_byte_limit = 50000

[sqlfluff:indentation]
tab_space_size = 4
indented_joins = False
indented_on_contents = True
allow_implicit_indents = False
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ DOCKER_TOOLS = docker run \
-v $(shell bash -c "mkdir -p /tmp/go-lint-cache; echo /tmp/go-lint-cache"):/root/.cache/golangci-lint \
-v $$(pwd):/build taproot-assets-tools

DOCKER_SQLFLUFF = docker run --rm --user "$$UID:$$(id -g)" -e UID=$$UID \
-v $(shell pwd):/sql sqlfluff-builder

GO_VERSION = 1.23.9

GREEN := "\\033[0;32m"
Expand Down Expand Up @@ -149,6 +152,10 @@ docker-tools:
@$(call print, "Building tools docker image.")
docker build -q -t taproot-assets-tools $(TOOLS_DIR)

docker-sqlfluff:
@$(call print, "Building sqlfluff docker image.")
docker build -q -t sqlfluff-builder tools/sqlfluff

scratch: build

# ===================
Expand Down Expand Up @@ -268,6 +275,15 @@ sqlc-check: sqlc
exit 1; \
fi

sql-lint: docker-sqlfluff
$(DOCKER_SQLFLUFF) lint tapdb/sqlc/migrations/* tapdb/sqlc/queries/*

sql-lint-ci: docker-sqlfluff
$(DOCKER_SQLFLUFF) lint --format github-annotation-native tapdb/sqlc/migrations/* tapdb/sqlc/queries/*

sql-fix: docker-sqlfluff
$(DOCKER_SQLFLUFF) fix tapdb/sqlc/migrations/* tapdb/sqlc/queries/*

rpc:
@$(call print, "Compiling protos.")
cd ./taprpc; ./gen_protos_docker.sh
Expand Down
4 changes: 3 additions & 1 deletion tapdb/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ var (
"BLOB": "BYTEA",
"INTEGER PRIMARY KEY": "BIGSERIAL PRIMARY KEY",
"TIMESTAMP": "TIMESTAMP WITHOUT TIME ZONE",
"UNHEX": "DECODE",
// The SQLFluff linter will force us to use lowercase function
// names consistently, so this needs to be lowercase.
"unhex": "decode",
}
)

Expand Down
Loading
Loading