DB Migrations

D1 database migration patterns for WordPress MCP Use when this capability is needed.

tomevault-io cde6c9d 2 files · 1.9 KB Updated

File contents

D1 Migrations Reference

Commands

# Run locally
npx wrangler d1 execute wordpress-mcp-db --local --file=./migrations/001_initial.sql

# Run on production
npx wrangler d1 execute wordpress-mcp-db --remote --file=./migrations/001_initial.sql

# Query
npx wrangler d1 execute wordpress-mcp-db --remote --command "SELECT * FROM users LIMIT 5"

WordPress Connection Schema

CREATE TABLE wordpress_connections (
  id TEXT PRIMARY KEY,
  user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  name TEXT NOT NULL,
  wordpress_url TEXT NOT NULL,
  username TEXT NOT NULL,
  app_password_encrypted TEXT NOT NULL,  -- AES-256-GCM encrypted
  created_at TEXT DEFAULT (datetime('now'))
);
CREATE INDEX idx_wp_conn_user ON wordpress_connections(user_id);

Important Notes

  1. Application Password must be encrypted — Never store plaintext
  2. Spaces must be removed before encryption
  3. Use ON DELETE CASCADE for child tables

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/kaewz-manga--wordpress-nodeflow-mcp--db-migrations commit cde6c9d25c

Frequently asked questions

npx skillmds@latest add tomevault-io/db-migrations