@housekit/kit 0.1.18 → 0.1.19
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 +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,8 +105,14 @@ export default {
|
|
|
105
105
|
HouseKit simplifies managing Replicated and Distributed tables across a cluster.
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
import { defineTable, t, Engine } from '@housekit/orm';
|
|
109
|
+
|
|
110
|
+
// Define a table that lives on a cluster (object syntax still supported)
|
|
111
|
+
export const events = defineTable('events', {
|
|
112
|
+
id: t.uuid('id').primaryKey(),
|
|
113
|
+
userId: t.uuid('user_id'),
|
|
114
|
+
createdAt: t.timestamp('created_at').default('now()'),
|
|
115
|
+
}, {
|
|
110
116
|
engine: Engine.ReplicatedMergeTree(),
|
|
111
117
|
|
|
112
118
|
// High Portability: Using '{cluster}' tells ClickHouse to use the
|
|
@@ -117,6 +123,9 @@ export const events = defineTable('events', (t) => ({ ... }), {
|
|
|
117
123
|
shardKey: 'user_id',
|
|
118
124
|
orderBy: 'id'
|
|
119
125
|
});
|
|
126
|
+
|
|
127
|
+
// Callback syntax is also available when you want presets or composition:
|
|
128
|
+
// defineTable('events', (t) => ({ ... }), { ... })
|
|
120
129
|
```
|
|
121
130
|
When you run `housekit push`, the CLI automatically detects the cluster configuration and executes the `ALTER` or `CREATE` statements across all nodes using the specified macro.
|
|
122
131
|
|
package/package.json
CHANGED