Migrate tables, views, indexes, and triggers from your Val Town account-based (global) database to a val-scoped database.
Import migrate from this val and call it with your configuration:
import migrate from "https://esm.town/v/nbbaier/migrate-sqlite/migrate.ts";
await migrate({
tables: ["users", "posts"],
views: ["active_users"], // optional
});
tables)AUTOINCREMENTviews (optional, defaults to [])IF NOT EXISTS for tables/views/indexes and
DROP + CREATE for triggersINSERT OR IGNORE to skip duplicates on re-runsWhen running and testing your migration, the SQLite Explorer val (for global db) and built-in SQLite admin panel (for val db) are helpful.