added migration command

This commit is contained in:
anthdm 2024-06-07 09:23:06 +02:00
parent 5bf665cb51
commit b8311d3abf
6 changed files with 35 additions and 3 deletions

View file

@ -11,7 +11,7 @@ DB_DRIVER = sqlite3
DB_USER =
DB_HOST =
DB_PASSWORD =
DB_NAME = app_db
DB_NAME = app_db
MIGRATION_DIR = app/db/migrations

View file

@ -11,7 +11,7 @@ DB_DRIVER = sqlite3
DB_USER =
DB_HOST =
DB_PASSWORD =
DB_NAME = app_db
DB_NAME = app_db
MIGRATION_DIR = app/db/migrations

View file

@ -21,7 +21,7 @@ live/server:
# run tailwindcss to generate the styles.css bundle in watch mode.
live/tailwind:
tailwindcss -i assets/app.css -o ./public/styles.css --watch
tailwindcss -i app/assets/app.css -o ./public/styles.css --watch
# run esbuild to generate the index.js bundle in watch mode.
live/esbuild:
@ -50,5 +50,8 @@ db-reset:
db-up:
@GOOSE_DRIVER=$(DB_DRIVER) GOOSE_DBSTRING=$(DB_NAME) goose -dir=$(MIGRATION_DIR) up
db-mig:
@GOOSE_DRIVER=$(DB_DRIVER) GOOSE_DBSTRING=$(DB_NAME) goose -dir=$(MIGRATION_DIR) create $(filter-out $@,$(MAKECMDGOALS)) sql
db-seed:
@go run cmd/scripts/seed/main.go

View file

@ -0,0 +1,7 @@
package events
import "context"
func HandleFooEvent(ctx context.Context, event any) {
}

View file

@ -2,8 +2,26 @@ module AABBCCDD
go 1.22.0
require (
github.com/mattn/go-sqlite3 v1.14.22
github.com/uptrace/bun v1.2.1
)
require (
github.com/fatih/color v1.16.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
)
require (
github.com/a-h/templ v0.2.707 // indirect
github.com/anthdm/gothkit v0.0.0-20240606141535-31a222db1a4a // indirect
github.com/go-chi/chi/v5 v5.0.12 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/uptrace/bun/dialect/sqlitedialect v1.2.1
github.com/uptrace/bun/extra/bundebug v1.2.1
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
golang.org/x/sys v0.19.0 // indirect
)

View file

@ -12,6 +12,10 @@ type event struct {
message any
}
type CreateUserEvent struct{}
func HandleCreateUserEvent(ctx context.Context, event CreateUserEvent) {}
// Handler is the function being called when receiving an event.
type Handler func(context.Context, any)