appflare-schema

Define Appflare schema tables, columns, and relations and generate D1 migrations.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Imtiajrex/appflare-skills --skill appflare-schema-imtiajrex
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: appflare-schema
Source: https://github.com/Imtiajrex/appflare-skills/tree/main/skills/appflare-schema
Command: npx skills add https://github.com/Imtiajrex/appflare-skills --skill appflare-schema-imtiajrex

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires appflare, and includes references (resource) components.

What problem does it solve? Designing and evolving a database schema in an Appflare project requires knowing the schema DSL, relation helpers, and migration workflow; this Skill guides an AI agent through defining tables, columns, and relations correctly and applying D1 migrations without compile errors. ## Core Features & Use Cases - Schema DSL authoring: Define tables with column builders (v.int, v.string, v.boolean, v.date, v.uuid, v.enum, v.array, v.object), modifiers (notNull, unique, default, defaultNow), composite indexes, and CHECK constraints. - Relation modeling: Configure v.one, v.many, and v.manyToMany relations with foreign key naming, relationName pairing, junction tables, and nullable or cascading FK options. - Migration workflow: Run appflare migrate and migrate:custom to generate SQL files, add triggers, views, and backfills. - Use Case: Add a projects table with an owner relation to users, a many-to-many labels relation, and a balance CHECK constraint, then generate and review the migration SQL. ## Quick Start Ask the agent to add a new table with columns and relations to the Appflare schema and run the local migration.

Frequently Asked Questions about appflare-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new table in an Appflare schema?▼

Add a table inside the exported schema({...}) in your schema entry file using table({...}) with v.* column builders. Then run bun appflare dev to compile and bun appflare migrate --local to generate the SQL migration in drizzle/.

How do I define one-to-many and many-to-many relations in Appflare?▼

Use v.one("target") on the owning side to create a foreign key column and v.many("target") on the inverse side. For many-to-many, declare v.manyToMany on both tables with identical options and a junction table is synthesized automatically.

Does Appflare schema support float or decimal column types?▼

No. v.number() is an alias of v.int() and creates an INTEGER column; there is no float column type. Dates are stored as epoch milliseconds in integer columns.

Why does my Appflare relation fail generation with multiple relations to the same table?▼

A v.many whose target has more than one matching v.one fails unless both sides share a relationName. Add relationName to each v.one and the corresponding v.many so the named v.many reuses the v.one's foreign key.

How do I add triggers or backfills to an Appflare migration?▼

Create an empty custom migration with bun appflare migrate:custom --name your_name and write the trigger, view, or backfill SQL there. Always run bun appflare dev first because migrate reads the compiled schema.