Skip to content

Database Migrations

Skriva uses a versioned migration system with automatic application on startup.

How it works

  • Migrations are embedded in the Go binary
  • A schema_migrations table tracks which versions have been applied
  • On startup, any unapplied migrations run automatically
  • Each migration has Up (apply) and Down (rollback) SQL

CLI Commands

bash
# Show current migration status
blog migrate status

# Rollback the last applied migration
blog migrate rollback

Current Migrations

VersionNameDescription
1initial_schemaComments, page views, reactions
2comment_moderationApproval column
3passkeysWebAuthn passkey storage
4unique_viewsDeduplicated page view tracking
5subscribersNewsletter subscriber table
6newslettersNewsletter drafts and scheduling
7post_revisionsRevision history
8newsletter_analyticsOpen/click event tracking
9newsletter_ab_testingA/B subject line variants
10draft_sharesDraft preview tokens
11webmentionsWebmention storage
12activitypub_followersAP follower tracking
13webhooksWebhook registration
14api_tokensAPI token storage
15newsletter_sendsPer-subscriber send tracking
16audit_logPersistent admin audit trail

Released under the MIT License.