@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 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