bitemyapp / bitemyapp/blackwater

Log DDL as well

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
57
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Having implemented a script/bootstrap setup for project that creates a database, migrates through various migrations, inserting a few rows here and there, black.water shines very well on the SQL output. However, it would be great if it also output DDL transformations. This is particularly nice for boxen (but also production) setups where any failure automatically opens a ticket on github with the output. Some example code where it would be nice:

```
(ns example.migrations.v0
(:require [clojure.java.jdbc :as j]
[clojure.java.jdbc.sql :as sql]
[clojure.java.jdbc.ddl :as ddl]
[example.db :as db]))

(defn create-metadata-table! [db-conn]
(j/db-do-commands db-conn
(ddl/create-table
:metadata
[:schema_version "integer"]))
(j/insert! db-conn :metadata {:schema_version 0}))

(defn migrate! [db-conn]
(create-metadata-table! db-conn))
```

The only black.water output from the above will be: `INSERT INTO metadata ( schema_version ) VALUES ( ? ) | 0| took:11ms`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing black.water's existing SQL output around the example's j/db-do-commands call and INSERT logging path. Identify the entry point that observes JDBC commands, then verify that DDL statements are emitted alongside INSERT output without changing migration behavior; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, sql
Domain
databases, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.