kysely-schema 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +112 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # kysely-schema
2
+
3
+ > Schema-first development tool for Kysely — **Prisma's DX + Kysely's power + Zero runtime overhead**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/kysely-schema.svg)](https://www.npmjs.com/package/kysely-schema)
6
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/guntur-d/kysely-schema/blob/main/LICENSE)
7
+
8
+ ## ⚠️ Development Status
9
+
10
+ This package is in early development and undergoing active testing.
11
+ Expect breaking changes between minor versions. Not recommended for
12
+ production use yet.
13
+
14
+ ## Features
15
+
16
+ - 📝 **Schema-first** — Define your database schema in TypeScript
17
+ - 🔄 **Auto-migrations** — Generate Kysely migration files from schema changes
18
+ - 🎯 **Type-safe** — Auto-generate TypeScript types for your Kysely queries
19
+ - 🪶 **Lightweight** — Zero runtime overhead, pure code generation
20
+ - 💪 **Full SQL control** — Generates standard Kysely schema builder code
21
+ - 🔌 **Works with Kysely** — Complements existing Kysely migrations, doesn't replace them
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # Install
27
+ npm install -D kysely-schema-cli
28
+ # or
29
+ pnpm add -D kysely-schema-cli
30
+
31
+ # Initialize (installs kysely + db driver for you)
32
+ npx kysely-schema init
33
+ # or
34
+ npx kys init
35
+ ```
36
+
37
+ Define your schema in `schema/index.ts`:
38
+
39
+ ```typescript
40
+ import { defineSchema, table, column } from 'kysely-schema';
41
+
42
+ export default defineSchema({
43
+ user: table({
44
+ id: column.serial().primaryKey(),
45
+ email: column.text().notNull().unique(),
46
+ name: column.text().nullable(),
47
+ createdAt: column.timestamp().default('now()').notNull(),
48
+ }),
49
+
50
+ post: table({
51
+ id: column.serial().primaryKey(),
52
+ title: column.text().notNull(),
53
+ content: column.text().nullable(),
54
+ authorId: column.integer().notNull().references('user', 'id').onDelete('cascade'),
55
+ createdAt: column.timestamp().default('now()').notNull(),
56
+ }),
57
+ });
58
+ ```
59
+
60
+ Generate migrations and types:
61
+
62
+ ```bash
63
+ # Generate a Kysely migration
64
+ npx kysely-schema generate-migration "initial"
65
+
66
+ # Generate TypeScript types
67
+ npx kysely-schema generate-types
68
+
69
+ # Run migration (standard Kysely)
70
+ npx kysely migrate:latest
71
+ ```
72
+
73
+ ## CLI Commands
74
+
75
+ | Command | Alias | Description |
76
+ |---------|-------|-------------|
77
+ | `init` | — | Scaffold config, schema, migrations, and generated dirs |
78
+ | `generate-migration <name>` | `gm` | Generate a Kysely migration file from your schema |
79
+ | `generate-types` | `gt` | Generate TypeScript `Database` interface |
80
+ | `diff` | — | Show schema changes since last migration |
81
+ | `validate` | — | Validate your schema definition |
82
+ | `dev` | — | Watch schema, auto-regenerate types, validate, and show diffs |
83
+
84
+ ## Comparison
85
+
86
+ | Feature | Prisma | kysely-codegen | **kysely-schema** |
87
+ |---------|--------|----------------|-------------------|
88
+ | Schema-first | ✅ | ❌ | ✅ |
89
+ | Lightweight | ❌ | ✅ | ✅ |
90
+ | Full SQL control | ❌ | ✅ | ✅ |
91
+ | Auto-migrations | ✅ | ❌ | ✅ |
92
+ | Type generation | ✅ | ✅ | ✅ |
93
+ | Runtime overhead | Heavy | None | **None** |
94
+
95
+ ## Documentation
96
+
97
+ - [Getting Started](https://github.com/guntur-d/kysely-schema/blob/main/docs/getting-started.md)
98
+ - [Schema Definition](https://github.com/guntur-d/kysely-schema/blob/main/docs/schema-definition.md)
99
+ - [Migrations](https://github.com/guntur-d/kysely-schema/blob/main/docs/migrations.md)
100
+ - [API Reference](https://github.com/guntur-d/kysely-schema/blob/main/docs/api-reference.md)
101
+
102
+ ## Contributing
103
+
104
+ This project is open source and we welcome contributions!
105
+
106
+ - 🐛 **Report bugs**: [GitHub Issues](https://github.com/guntur-d/kysely-schema/issues)
107
+ - 💡 **Feature requests**: [GitHub Discussions](https://github.com/guntur-d/kysely-schema/discussions)
108
+ - 🔀 **Pull requests**: [GitHub Repository](https://github.com/guntur-d/kysely-schema)
109
+
110
+ ## License
111
+
112
+ [MIT](https://github.com/guntur-d/kysely-schema/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely-schema",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Schema-first development tool for Kysely",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",