scheme for saving sensor data
This commit is contained in:
parent
a44284b9b1
commit
5935064606
3 changed files with 23 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import { integer, json, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import { integer, json, pgTable, real, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text().primaryKey(),
|
||||
|
@ -18,9 +18,28 @@ export const sessions = pgTable("sessions", {
|
|||
export const floors = pgTable("floors", {
|
||||
floor: integer().primaryKey(),
|
||||
url: text().notNull(),
|
||||
image: text(),
|
||||
});
|
||||
|
||||
export const plans = pgTable("plans", {
|
||||
floor: integer().primaryKey(),
|
||||
plan: json().notNull(),
|
||||
});
|
||||
|
||||
export const sensors = pgTable("sensors", {
|
||||
id: text().primaryKey(),
|
||||
user: text()
|
||||
.references(() => users.id)
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const sensorData = pgTable("sensor_data", {
|
||||
uuid: uuid().primaryKey(),
|
||||
sensor: text("sensor")
|
||||
.references(() => sensors.id)
|
||||
.notNull(),
|
||||
temperature: real().notNull(),
|
||||
humidity: real().notNull(),
|
||||
pressure: real().notNull(),
|
||||
altitude: real().notNull(),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue