@edgebasejs/schema
v0.1.11
Published
EdgeBase schema definition DSL
Readme
@edgebasejs/schema
Schema builder helpers for EdgeBase. Use this to define entities and fields with a clean DSL.
Install
pnpm add @edgebasejs/schemaUsage
import { defineSchema, string, boolean, timestamp, reference } from '@edgebasejs/schema';
export default defineSchema({
entities: {
todos: {
fields: {
id: string({ primary: true }),
userId: reference('users'),
title: string({ required: true }),
completed: boolean({ default: false }),
createdAt: timestamp(),
updatedAt: timestamp(),
},
indexes: [{ fields: ['userId'] }],
},
},
});Exports
defineSchema- Field helpers:
string,text,integer,number,boolean,timestamp,json,reference
Notes
The schema output is compatible with the EdgeBase worker and generator.
