MCPcopy Create free account
hub / github.com/Chatterino/api / init

Function init

internal/migration/2_cache_http_status_code.go:11–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9)
10
11func init() {
12 // The version of this migration
13 const migrationVersion = 2
14
15 Register(
16 migrationVersion,
17 func(ctx context.Context, tx pgx.Tx) error {
18 // The Up action of this migration
19 // Delete all cached entries
20 _, err := tx.Exec(ctx, `TRUNCATE cache;`)
21 if err != nil {
22 return err
23 }
24
25 _, err = tx.Exec(ctx, `
26ALTER TABLE cache
27 ADD http_status_code SMALLINT NOT NULL,
28 ADD http_content_type TEXT NOT NULL
29;`)
30
31 return err
32 },
33 func(ctx context.Context, tx pgx.Tx) error {
34 // The Down action of this migration
35 _, err := tx.Exec(ctx, `
36ALTER TABLE cache
37 DROP http_status_code,
38 DROP http_content_type
39;`)
40
41 return err
42 },
43 )
44}

Callers

nothing calls this directly

Calls 2

RegisterFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected