@phyng/typeschema
Version:
A database schema definition library using TypeScript or JSON
42 lines (30 loc) • 900 B
Markdown
A database schema definition library using TypeScript or JSON
[](https://www.npmjs.com/package/@phyng/typeschema)
[](https://phyng.com/typeschema/)
```bash
pnpm add @phyng/typeschema
npm install @phyng/typeschema
```
```ts
import { Db, Table, Field } from '@phyng/typeschema'
const db = Db([
Table('user', [
Field('id', 'int', { pk: true, increment: true }),
Field('username', 'string'),
Field('name', 'string', { null: true }),
]),
Table('post', [
Field('id', 'int', { pk: true, increment: true }),
Field('name', 'string'),
Field('content', 'string'),
]),
])
export default db
```
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.