@surveilr/bootstrap-sql 0.0.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.
- package/README.md +42 -0
- package/dist/chunk-HZLAQ5XF.js +1315 -0
- package/dist/chunk-QTY32BJY.js +844 -0
- package/dist/index.cjs +2896 -0
- package/dist/index.d.cts +278 -0
- package/dist/index.d.ts +278 -0
- package/dist/index.js +808 -0
- package/dist/models.cjs +1394 -0
- package/dist/models.d.cts +16708 -0
- package/dist/models.d.ts +16708 -0
- package/dist/models.js +140 -0
- package/dist/views.cjs +2120 -0
- package/dist/views.d.cts +2462 -0
- package/dist/views.d.ts +2462 -0
- package/dist/views.js +87 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# rssd-drizzle
|
|
2
|
+
|
|
3
|
+
Drizzle ORM schema for the RSSD (Resource Surveillance State Database) system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install rssd-drizzle better-sqlite3 drizzle-orm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Initialization
|
|
12
|
+
|
|
13
|
+
To initialize the database using
|
|
14
|
+
[`surveilr`](https://github.com/surveilr/packages), run the following commands:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Ingest files to create the initial database
|
|
18
|
+
surveilr ingest files -d rssd.db
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { drizzle } from "drizzle-orm/better-sqlite3";
|
|
25
|
+
import Database from "better-sqlite3";
|
|
26
|
+
import * as schema from "rssd-drizzle";
|
|
27
|
+
|
|
28
|
+
const sqlite = new Database("rssd.db");
|
|
29
|
+
const db = drizzle(sqlite, { schema });
|
|
30
|
+
|
|
31
|
+
// Use your type-safe database
|
|
32
|
+
const devices = await db.select().from(schema.device);
|
|
33
|
+
|
|
34
|
+
console.log(devices);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Structure
|
|
38
|
+
|
|
39
|
+
- `models.ts`: Table definitions
|
|
40
|
+
- `relations.ts`: Table relations
|
|
41
|
+
- `views.ts`: SQL view definitions (Drizzle-based)
|
|
42
|
+
- `index.ts`: Main entry point exporting all schemas
|