Skip to content

Commit 99b2b6d

Browse files
committed
docs rebuilt by sitegen v0.1.1
1 parent 11b90a0 commit 99b2b6d

5 files changed

Lines changed: 36 additions & 36 deletions

File tree

‎docs/index.html‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ <h1 id="migrate">migrate</h1>
3333
<code>migrate.go</code> is the specification, and the site at
3434
<a href="https://deufel.github.io/migrate/">https://deufel.github.io/migrate/</a> is built from it and the tested examples
3535
by <a href="https://github.com/Deufel/sitegen">sitegen</a> (<code>go run github.com/Deufel/sitegen/cmd/sitegen -root . -out docs -title migrate</code>).</p>
36-
<pre><code>go test ./... # the module on its own
36+
<div class="column" style="--gap: 0;"><pre><code>go test ./... # the module on its own
3737
go run ./cmd/migrate -db x.db -dir migrations status
3838
go run ./cmd/migrate -db x.db -dir migrations up -backup backups/before-0004.db
3939
go run ./cmd/migrate -db x.db -dir migrations baseline 1
4040
go run ./cmd/migrate -dir migrations new add-visit-table
41-
</code></pre>
41+
</code></pre></div>
4242
<p>A structure change is a rebuild written as SQL in the file:</p>
43-
<pre><code class="language-sql">CREATE TABLE thing_new (…the new declaration…);
43+
<div class="column" style="--gap: 0;"><pre><code class="language-sql">CREATE TABLE thing_new (…the new declaration…);
4444
INSERT INTO thing_new (…) SELECT … FROM thing;
4545
DROP TABLE thing;
4646
ALTER TABLE thing_new RENAME TO thing;
4747
CREATE INDEX … ;
48-
</code></pre>
48+
</code></pre></div>
4949
<p>Foreign keys are off while the file runs and checked before commit, so a
5050
rebuild that strands a child row is refused whole.</p>
5151

‎docs/pkg/cmd-migrate.html‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
66
<meta name="color-scheme" content="dark light"/>
7-
<title>github.com/Deufel/migrate/cmd/migrate — migrate</title>
7+
<title>migrate — migrate</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/system.css"/>
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/highlight.css"/>
1010
<style>@layer project { :where(.pg-aside) > :where(.toc) { position: sticky; inset-block-start: 0; } }</style>
@@ -20,21 +20,21 @@
2020
</nav>
2121
<header class="pg-main-header column">
2222
<nav class="crumbs" aria-label="Breadcrumb"><a href="../index.html">migrate</a><a href="../pkg/migrate.html">Packages</a></nav>
23-
<div class="spread"><h1>github.com/Deufel/migrate/cmd/migrate</h1></div>
23+
<div class="spread"><h1>migrate</h1></div>
2424
</header>
25-
<nav class="pg-toolbar spread-column tablet desktop" aria-label="Packages"><div class="column" style="--gap: 0.1lh;"><small class="rail-head medium large">Packages</small><a class="nav-item" href="../pkg/migrate.html"><span class="medium large">github.com/Deufel/migrate</span></a><a class="nav-item" href="../pkg/cmd-migrate.html" aria-current="page"><span class="medium large">github.com/Deufel/migrate/cmd/migrate</span></a></div></nav>
25+
<nav class="pg-toolbar spread-column tablet desktop" aria-label="Packages"><div class="column" style="--gap: 0.1lh;"><small class="rail-head medium large">Packages</small><a class="nav-item" href="../pkg/migrate.html"><span class="medium large">migrate</span></a><a class="nav-item" href="../pkg/cmd-migrate.html" aria-current="page"><span class="medium large">migrate</span></a></div></nav>
2626
<main class="pg-main column owns-scroll">
2727
<section class="column measure" style="--measure: 3; --gap: 1lh;">
2828
<p><code>import "github.com/Deufel/migrate/cmd/migrate"</code></p><h2 id="overview">Overview</h2><p>Command migrate — the runner at the shell:
29-
<pre>migrate -db app.db -dir migrations status
29+
<div class="column" style="--gap: 0;"><pre>migrate -db app.db -dir migrations status
3030
migrate -db app.db -dir migrations up [-backup path]
3131
migrate -db app.db -dir migrations baseline 1
3232
migrate -dir migrations new add-visit-table
33-
</pre>
33+
</pre></div>
3434

3535
</section>
3636
</main>
37-
<footer class="pg-main-footer spread" style="--type: -1;"><span><a href="../pkg/migrate.html">← github.com/Deufel/migrate</a></span><span></span></footer>
37+
<footer class="pg-main-footer spread" style="--type: -1;"><span><a href="../pkg/migrate.html">← migrate</a></span><span></span></footer>
3838
</div>
3939
<script src="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/highlight.js"></script>
4040
</body>

‎docs/pkg/migrate.html‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
66
<meta name="color-scheme" content="dark light"/>
7-
<title>github.com/Deufel/migrate — migrate</title>
7+
<title>migrate — migrate</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/system.css"/>
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/highlight.css"/>
1010
<style>@layer project { :where(.pg-aside) > :where(.toc) { position: sticky; inset-block-start: 0; } }</style>
@@ -20,9 +20,9 @@
2020
</nav>
2121
<header class="pg-main-header column">
2222
<nav class="crumbs" aria-label="Breadcrumb"><a href="../index.html">migrate</a><a href="../pkg/migrate.html">Packages</a></nav>
23-
<div class="spread"><h1>github.com/Deufel/migrate</h1></div>
23+
<div class="spread"><h1>migrate</h1></div>
2424
</header>
25-
<nav class="pg-toolbar spread-column tablet desktop" aria-label="Packages"><div class="column" style="--gap: 0.1lh;"><small class="rail-head medium large">Packages</small><a class="nav-item" href="../pkg/migrate.html" aria-current="page"><span class="medium large">github.com/Deufel/migrate</span></a><a class="nav-item" href="../pkg/cmd-migrate.html"><span class="medium large">github.com/Deufel/migrate/cmd/migrate</span></a></div></nav>
25+
<nav class="pg-toolbar spread-column tablet desktop" aria-label="Packages"><div class="column" style="--gap: 0.1lh;"><small class="rail-head medium large">Packages</small><a class="nav-item" href="../pkg/migrate.html" aria-current="page"><span class="medium large">migrate</span></a><a class="nav-item" href="../pkg/cmd-migrate.html"><span class="medium large">migrate</span></a></div></nav>
2626
<main class="pg-main column owns-scroll">
2727
<section class="column measure" style="--measure: 3; --gap: 1lh;">
2828
<p><code>import "github.com/Deufel/migrate"</code></p><h2 id="overview">Overview</h2><p>Package migrate runs numbered SQL migrations against a SQLite database —
@@ -32,8 +32,8 @@
3232
<p>A migration is a file named NNNN-description.sql (a four-digit version,
3333
a kebab description). Files run in version order; each is applied at
3434
most once; the record lives in one table (sys_migration by default):
35-
<pre>version · name · sha256 · applied_at
36-
</pre>
35+
<div class="column" style="--gap: 0;"><pre>version · name · sha256 · applied_at
36+
</pre></div>
3737
<p>Rules, in the order the runner checks them:
3838
<ol>
3939
<li>every applied version must still have its file, byte-identical
@@ -52,31 +52,31 @@
5252
<p>A structure change is written as SQL: create the new table, INSERT …
5353
SELECT, drop the old, rename, recreate the indexes. The declaration
5454
changes and the data follows in the same file.
55-
<h2 id="functions">Functions</h2><h3 id="baseline">Baseline</h3><pre><code class="go">func Baseline(ctx context.Context, db *sql.DB, o Options, version int) error</code></pre><p>Baseline stamps every file up to and including version as applied
55+
<h2 id="functions">Functions</h2><h3 id="baseline">Baseline</h3><div class="column" style="--gap: 0;"><pre><code class="go">func Baseline(ctx context.Context, db *sql.DB, o Options, version int) error</code></pre></div><p>Baseline stamps every file up to and including version as applied
5656
WITHOUT running it — for a database that already carries the schema
5757
the baseline file describes. Refused when anything is recorded already.
58-
<h3 id="next">Next</h3><pre><code class="go">func Next(fsys fs.FS, description string) (string, error)</code></pre><p>Next answers the file name a new migration should take.
59-
<h2 id="types">Types</h2><h3 id="options">Options</h3><pre><code class="go">type Options struct {
58+
<h3 id="next">Next</h3><div class="column" style="--gap: 0;"><pre><code class="go">func Next(fsys fs.FS, description string) (string, error)</code></pre></div><p>Next answers the file name a new migration should take.
59+
<h2 id="types">Types</h2><h3 id="options">Options</h3><div class="column" style="--gap: 0;"><pre><code class="go">type Options struct {
6060
FS fs.FS // the directory of NNNN-name.sql files (its root)
6161
Table string // the record table; &#34;&#34; = sys_migration
6262
Backup string // a path for VACUUM INTO before the first pending step; &#34;&#34; = none
6363
Log func(format string, args ...any)
64-
}</code></pre><p>Options configure a run.
65-
<h3 id="step">Step</h3><pre><code class="go">type Step struct {
64+
}</code></pre></div><p>Options configure a run.
65+
<h3 id="step">Step</h3><div class="column" style="--gap: 0;"><pre><code class="go">type Step struct {
6666
Version int
6767
Name string // the description part of the file name
6868
File string
6969
SHA string // sha256 of the file&#39;s bytes
7070
AppliedAt string // RFC3339, &#34;&#34; when pending
71-
}</code></pre><p>Step is one migration file, applied or pending.
72-
<h3 id="load">Load</h3><pre><code class="go">func Load(fsys fs.FS) ([]Step, error)</code></pre><p>Load reads and orders the files. A name off the pattern, a duplicate
71+
}</code></pre></div><p>Step is one migration file, applied or pending.
72+
<h3 id="load">Load</h3><div class="column" style="--gap: 0;"><pre><code class="go">func Load(fsys fs.FS) ([]Step, error)</code></pre></div><p>Load reads and orders the files. A name off the pattern, a duplicate
7373
version or an empty file is an error.
74-
<h3 id="run">Run</h3><pre><code class="go">func Run(ctx context.Context, db *sql.DB, o Options) ([]Step, error)</code></pre><p>Run applies every pending file in order and answers the ones applied.
74+
<h3 id="run">Run</h3><div class="column" style="--gap: 0;"><pre><code class="go">func Run(ctx context.Context, db *sql.DB, o Options) ([]Step, error)</code></pre></div><p>Run applies every pending file in order and answers the ones applied.
7575
The first error stops the run with the failed file rolled back.
76-
<h3 id="status">Status</h3><pre><code class="go">func Status(ctx context.Context, db *sql.DB, o Options) (applied, pending []Step, err error)</code></pre><p>Status answers what is applied and what is pending, after verifying
76+
<h3 id="status">Status</h3><div class="column" style="--gap: 0;"><pre><code class="go">func Status(ctx context.Context, db *sql.DB, o Options) (applied, pending []Step, err error)</code></pre></div><p>Status answers what is applied and what is pending, after verifying
7777
rules 1 and 2. The applied steps carry the file&apos;s name and hash from
7878
the record; the pending ones from the file.
79-
<h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code class="go">package main
79+
<h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><div class="column" style="--gap: 0;"><pre><code class="go">package main
8080

8181
import (
8282
&#34;context&#34;
@@ -117,7 +117,7 @@ <h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code
117117
_ = migrate.Baseline(context.Background(), db, o, 1)
118118
applied, _ := migrate.Run(context.Background(), db, o)
119119
fmt.Println(len(applied), &#34;applied:&#34;, applied[0].File)
120-
}</code></pre><small>Output</small><pre><code>1 applied: 0002-add-name.sql</code></pre><h3 id="exampleload">Load</h3><pre><code class="go">package main
120+
}</code></pre></div><small>Output</small><div class="column" style="--gap: 0;"><pre><code>1 applied: 0002-add-name.sql</code></pre></div><h3 id="exampleload">Load</h3><div class="column" style="--gap: 0;"><pre><code class="go">package main
121121

122122
import (
123123
&#34;fmt&#34;
@@ -145,8 +145,8 @@ <h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code
145145
for _, s := range steps {
146146
fmt.Println(s.Version, s.Name)
147147
}
148-
}</code></pre><small>Output</small><pre><code>1 baseline
149-
2 add-name</code></pre><h3 id="examplenext">Next</h3><pre><code class="go">package main
148+
}</code></pre></div><small>Output</small><div class="column" style="--gap: 0;"><pre><code>1 baseline
149+
2 add-name</code></pre></div><h3 id="examplenext">Next</h3><div class="column" style="--gap: 0;"><pre><code class="go">package main
150150

151151
import (
152152
&#34;fmt&#34;
@@ -171,7 +171,7 @@ <h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code
171171
&#34;0001-baseline.sql&#34;: &#34;CREATE TABLE thing (id INTEGER PRIMARY KEY);&#34;,
172172
})), &#34;add-name&#34;)
173173
fmt.Println(name)
174-
}</code></pre><small>Output</small><pre><code>0002-add-name.sql</code></pre><h3 id="examplerun">Run</h3><pre><code class="go">package main
174+
}</code></pre></div><small>Output</small><div class="column" style="--gap: 0;"><pre><code>0002-add-name.sql</code></pre></div><h3 id="examplerun">Run</h3><div class="column" style="--gap: 0;"><pre><code class="go">package main
175175

176176
import (
177177
&#34;context&#34;
@@ -210,8 +210,8 @@ <h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code
210210
fmt.Println(len(applied), &#34;applied&#34;)
211211
again, _ := migrate.Run(context.Background(), db, o)
212212
fmt.Println(len(again), &#34;applied the second time&#34;)
213-
}</code></pre><small>Output</small><pre><code>2 applied
214-
0 applied the second time</code></pre><h3 id="examplestatus">Status</h3><pre><code class="go">package main
213+
}</code></pre></div><small>Output</small><div class="column" style="--gap: 0;"><pre><code>2 applied
214+
0 applied the second time</code></pre></div><h3 id="examplestatus">Status</h3><div class="column" style="--gap: 0;"><pre><code class="go">package main
215215

216216
import (
217217
&#34;context&#34;
@@ -251,10 +251,10 @@ <h2 id="examples">Examples</h2><h3 id="examplebaseline">Baseline</h3><pre><code
251251
}))})
252252
applied, pending, _ := migrate.Status(context.Background(), db, o)
253253
fmt.Println(len(applied), &#34;applied,&#34;, len(pending), &#34;pending:&#34;, pending[0].File)
254-
}</code></pre><small>Output</small><pre><code>1 applied, 1 pending: 0002-add-name.sql</code></pre>
254+
}</code></pre></div><small>Output</small><div class="column" style="--gap: 0;"><pre><code>1 applied, 1 pending: 0002-add-name.sql</code></pre></div>
255255
</section>
256256
</main>
257-
<aside class="pg-aside desktop"><nav class="toc column" aria-label="On this page" style="--gap: 0; --type: -1;"><small class="rail-head">On this page</small><a href="#overview">Overview</a><a href="#functions">Functions</a><a href="#types">Types</a><a href="#examples">Examples</a></nav></aside><footer class="pg-main-footer spread" style="--type: -1;"><span></span><span><a href="../pkg/cmd-migrate.html">github.com/Deufel/migrate/cmd/migrate →</a></span></footer>
257+
<aside class="pg-aside desktop"><nav class="toc column" aria-label="On this page" style="--gap: 0; --type: -1;"><small class="rail-head">On this page</small><a href="#overview">Overview</a><a href="#functions">Functions</a><a href="#types">Types</a><a href="#examples">Examples</a></nav></aside><footer class="pg-main-footer spread" style="--type: -1;"><span></span><span><a href="../pkg/cmd-migrate.html">migrate →</a></span></footer>
258258
</div>
259259
<script src="https://cdn.jsdelivr.net/gh/Deufel/system-css@v0.6.0/static/highlight.js"></script>
260260
</body>

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/Deufel/migrate
33
go 1.25
44

55
require (
6-
github.com/Deufel/sitegen v0.1.0
6+
github.com/Deufel/sitegen v0.1.1
77
modernc.org/sqlite v1.34.1
88
)
99

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/Deufel/sitegen v0.1.0 h1:tY4DDzoEF1KLCSgE4lZwZE7EqCDmUh88jLxeNb4VSOc=
2-
github.com/Deufel/sitegen v0.1.0/go.mod h1:QHfjlkq5k5jAkzNWgJg/eET4jO5anr6IJ1z6I5tdNqE=
1+
github.com/Deufel/sitegen v0.1.1 h1:QTuBNB1FfQzMhW+VQVNHMRljCq/qmBkPQyn5n5mOKlQ=
2+
github.com/Deufel/sitegen v0.1.1/go.mod h1:QHfjlkq5k5jAkzNWgJg/eET4jO5anr6IJ1z6I5tdNqE=
33
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
44
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
55
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=

0 commit comments

Comments
 (0)