Skip to content

Commit

Permalink
remove sqlc
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Dec 13, 2024
1 parent 8fca2e8 commit 5baad99
Show file tree
Hide file tree
Showing 55 changed files with 4 additions and 1,330 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,6 @@ jobs:
run: just build-language-plugins
- name: Test README
run: just test-readme
test-scripts:
name: Test Scripts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- name: Test Scripts
run: just test-scripts
sql:
name: SQL
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Cache
uses: ./.github/actions/build-cache
- name: Init Hermit
uses: cashapp/[email protected]
- name: Docker Compose
run: just compose-up
- name: Initialise database
run: just init-db
- name: Vet SQL
run: sqlc vet
ensure-frozen-migrations:
name: Ensure Frozen Migrations
# if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-ensure-frozen-migrations') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- name: Freeze Migrations
run: just ensure-frozen-migrations
lint:
name: Lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -189,8 +148,6 @@ jobs:
uses: cashapp/[email protected]
- name: Docker Compose
run: just compose-up
- name: Init DB
run: just init-db
- name: Rebuild All
run: just build-all
- name: Check No SCM Changes
Expand Down Expand Up @@ -304,8 +261,6 @@ jobs:
uses: cashapp/[email protected]
- name: Docker Compose
run: just compose-up
- name: Create DB
run: just init-db
- name: Download Go Modules
run: go mod download
- name: Build Language Plugins
Expand Down
20 changes: 4 additions & 16 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set positional-arguments
set shell := ["bash", "-c"]

WATCHEXEC_ARGS := "-d 1s -e proto -e go -e sql -f sqlc.yaml --ignore **/types.ftl.go"
WATCHEXEC_ARGS := "-d 1s -e proto -e go -e sql --ignore **/types.ftl.go"
RELEASE := "build/release"
VERSION := `git describe --tags --always | sed -e 's/^v//'`
TIMESTAMP := `date +%s`
Expand Down Expand Up @@ -76,14 +76,14 @@ clean:

# Live rebuild the ftl binary whenever source changes.
live-rebuild:
watchexec {{WATCHEXEC_ARGS}} -- "just build-sqlc && just build ftl"
watchexec {{WATCHEXEC_ARGS}} -- "just build ftl"

# Run "ftl dev" with live-reloading whenever source changes.
dev *args:
watchexec -r {{WATCHEXEC_ARGS}} -- "just build-sqlc && ftl dev --plain {{args}}"
watchexec -r {{WATCHEXEC_ARGS}} -- "ftl dev --plain {{args}}"

# Build everything
build-all: build-protos-unconditionally build-backend build-frontend build-backend-tests build-generate build-sqlc build-zips lsp-generate build-jvm build-language-plugins build-go2proto-testdata
build-all: build-protos-unconditionally build-backend build-frontend build-backend-tests build-generate build-zips lsp-generate build-jvm build-language-plugins build-go2proto-testdata

# Run "go generate" on all packages
build-generate:
Expand Down Expand Up @@ -152,18 +152,6 @@ build-go-binary dir binary="": build-zips build-protos

export DATABASE_URL := "postgres://postgres:secret@localhost:15432/ftl?sslmode=disable"

# Explicitly initialise the database
init-db:
dbmate drop || true
dbmate create
dbmate --no-dump-schema --migrations-dir backend/controller/sql/schema up

# Regenerate SQLC code (requires init-db to be run first)
build-sqlc:
@mk $(eval echo $(yq '.sql[].gen.go.out + "/{db.go,models.go,querier.go,queries.sql.go}"' sqlc.yaml)) \
: sqlc.yaml $(yq '.sql[].queries[]' sqlc.yaml) backend/controller/sql/schema \
-- "just init-db && sqlc generate"

# Build the ZIP files that are embedded in the FTL release binaries
build-zips:
@for dir in {{ZIP_DIRS}}; do (cd $dir && mk ../$(basename ${dir}).zip : . -- "rm -f $(basename ${dir}.zip) && zip -q --symlinks -r ../$(basename ${dir}).zip ."); done
Expand Down
6 changes: 0 additions & 6 deletions backend/controller/sql/databasetesting/devel.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

_ "github.com/jackc/pgx/v5/stdlib" // pgx driver

"github.com/TBD54566975/ftl/backend/controller/sql"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/observability"
)
Expand Down Expand Up @@ -68,11 +67,6 @@ func CreateForDevel(ctx context.Context, dsn string, recreate bool) (*stdsql.DB,

_, _ = conn.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE %q", dbName)) //nolint:errcheck // PG doesn't support "IF NOT EXISTS" so instead we just ignore any error.

err = sql.Migrate(ctx, dsn, log.Debug)
if err != nil {
return nil, err
}

realConn, err := observability.OpenDBAndInstrument(dsn)
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)
Expand Down
42 changes: 0 additions & 42 deletions backend/controller/sql/migrate.go

This file was deleted.

Loading

0 comments on commit 5baad99

Please sign in to comment.