(ctx context.Context, db *sql.DB)
| 76 | } |
| 77 | |
| 78 | func mustCreateTables(ctx context.Context, db *sql.DB) { |
| 79 | query := `CREATE TABLE IF NOT EXISTS "events" ( |
| 80 | "id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), |
| 81 | "created_at" timestamp(6) DEFAULT now(), |
| 82 | "name" text COLLATE "pg_catalog"."default", |
| 83 | "data" jsonb |
| 84 | );` |
| 85 | |
| 86 | _, err := db.ExecContext(ctx, query) |
| 87 | if err != nil { |
| 88 | panic(err) |
| 89 | } |
| 90 | |
| 91 | sqlx.Register("events", Event{}) |
| 92 | } |
| 93 | |
| 94 | type Event struct { |
| 95 | ID string `json:"id"` |