@syncular/migrations 0.0.1-98 → 0.0.2-126
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.
- package/README.md +37 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @syncular/migrations
|
|
2
|
+
|
|
3
|
+
Versioned migration utilities for Syncular apps. Provides `defineMigrations()` and `runMigrations()` with migration tracking and checksum validation (plus an optional reset strategy for client DBs).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @syncular/migrations
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { defineMigrations, runMigrations } from '@syncular/migrations';
|
|
15
|
+
|
|
16
|
+
export const migrations = defineMigrations({
|
|
17
|
+
v1: async (db) => {
|
|
18
|
+
await db.schema.createTable('tasks').addColumn('id', 'text').execute();
|
|
19
|
+
},
|
|
20
|
+
v2: async (db) => {
|
|
21
|
+
await db.schema.alterTable('tasks').addColumn('done', 'integer').execute();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await runMigrations({ db, migrations });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
- Schema migrations: https://syncular.dev/docs/build/migrations
|
|
31
|
+
|
|
32
|
+
## Links
|
|
33
|
+
|
|
34
|
+
- GitHub: https://github.com/syncular/syncular
|
|
35
|
+
- Issues: https://github.com/syncular/syncular/issues
|
|
36
|
+
|
|
37
|
+
> Status: Alpha. APIs and storage layouts may change between releases.
|