reboot alterflixhub
This commit is contained in:
commit
1e84023a44
188 files changed
+31629
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# Data layer — start here
|
||||
|
||||
This file plus `drizzle/crud-action-example.ts` is all you need to add a table
|
||||
and wire CRUD. You do **not** need the `storing-data`, `actions`, or
|
||||
`agent-native-docs` skills for standard CRUD, and you do **not** need to search
|
||||
`node_modules` or read any `dist/*.d.ts` to discover the API — the pattern is
|
||||
already stubbed in the files below.
|
||||
|
||||
## The files are already here
|
||||
|
||||
| What | Path | State |
|
||||
| ------------ | -------------------------------------- | ----------------------------- |
|
||||
| App tables | `drizzle/schema.ts` | Stub — add tables here |
|
||||
| DB client | `server/db.ts` → `getDb()`, `schema` | Stub — uncomment to enable |
|
||||
| CRUD pattern | `drizzle/crud-action-example.ts` | Copy into `actions/<name>.ts` |
|
||||
| Migrate | `pnpm db:generate` → `pnpm db:migrate` | `drizzle.config.ts` ships |
|
||||
| Actions | `actions/<name>.ts` | You create these |
|
||||
|
||||
Open `server/db.ts` and `drizzle/schema.ts` and edit them in place. Do **not**
|
||||
`find` / `cat` over `node_modules/@agent-native` or `drizzle-orm`, and do **not**
|
||||
read `dist/*.d.ts` — everything you need is in the two stub files.
|
||||
|
||||
## Enable the data layer (once)
|
||||
|
||||
`drizzle-orm`, `drizzle-kit`, `drizzle.config.ts`, and the `pnpm db:generate` /
|
||||
`pnpm db:migrate` scripts already ship — do not re-add them.
|
||||
|
||||
1. Add a table to `drizzle/schema.ts` (an example is commented in the file).
|
||||
2. Uncomment the wiring in `server/db.ts`.
|
||||
3. Run `pnpm db:generate` to create the migration, then `pnpm db:migrate` to
|
||||
apply it.
|
||||
4. Copy the CRUD pattern from `drizzle/crud-action-example.ts` into
|
||||
`actions/<name>.ts`. **One action per file, default-exported** — the four
|
||||
`export const ...Example` blocks in that reference each become their own
|
||||
`actions/<name>.ts` (e.g. `listNotesExample` → `actions/list-notes.ts` with
|
||||
`export default`); the kebab-case filename is the action name. Don't paste
|
||||
them into one file as named exports.
|
||||
|
||||
## After a batch of schema/action edits
|
||||
|
||||
One smoke path (create + list), then one `pnpm typecheck`. See Verification
|
||||
in `DEVELOPING.md`.
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"entries": []
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// App tables live here, defined with Drizzle's PostgreSQL builders. Local dev
|
||||
// runs them on PGlite and hosted deploys on Postgres.
|
||||
//
|
||||
// After editing this file, run `pnpm db:generate` and restart the dev server
|
||||
// (see `drizzle/START_HERE.md`). Example table, private to its creator unless
|
||||
// shared (see the `sharing` skill) — uncomment and adapt:
|
||||
//
|
||||
// import { sql } from "drizzle-orm";
|
||||
// import { boolean, pgTable, text } from "drizzle-orm/pg-core";
|
||||
// import {
|
||||
// createSharesTable,
|
||||
// ownableColumns,
|
||||
// } from "@agent-native/core/db/schema";
|
||||
//
|
||||
// export const notes = pgTable("notes", {
|
||||
// id: text("id").primaryKey(),
|
||||
// title: text("title").notNull(),
|
||||
// body: text("body").notNull().default(""),
|
||||
// archived: boolean("archived").notNull().default(false),
|
||||
// createdAt: text("created_at").notNull().default(sql`now()`),
|
||||
// updatedAt: text("updated_at").notNull().default(sql`now()`),
|
||||
// ...ownableColumns(),
|
||||
// });
|
||||
//
|
||||
// export const noteShares = createSharesTable("note_shares");
|
||||
|
||||
export {};
|
||||
Reference in new issue
Block a user