From a5249b22a9a3477210c179db7491ced387b022b2 Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Fri, 4 Sep 2026 21:20:57 +0200 Subject: [PATCH 1/2] chore(db): update migration snapshot --- .../meta/20260804090200_snapshot.json | 968 ++++++++++++++++++ 1 file changed, 968 insertions(+) create mode 100644 src/server/db/migrations/meta/20260804090200_snapshot.json diff --git a/src/server/db/migrations/meta/20260804090200_snapshot.json b/src/server/db/migrations/meta/20260804090200_snapshot.json new file mode 100644 index 00000000..5b7f1d91 --- /dev/null +++ b/src/server/db/migrations/meta/20260804090200_snapshot.json @@ -0,0 +1,968 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "4ddf5859-9ccd-4f0f-a44c-28208d5e3a2b", + "prevId": "53d3c7fc-13a0-4f2c-ae15-86dfd097bc44", + "tables": { + "sessions": { + "name": "sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "users_username_unique": { + "name": "users_username_unique", + "columns": [ + "username" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "compliance_documents": { + "name": "compliance_documents", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "vehicle_id": { + "name": "vehicle_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "other_label": { + "name": "other_label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "document_number": { + "name": "document_number", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_date": { + "name": "start_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_date": { + "name": "end_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "recurrence_type": { + "name": "recurrence_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + }, + "recurrence_interval": { + "name": "recurrence_interval", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "cost": { + "name": "cost", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attachment": { + "name": "attachment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_compliance_documents_vehicle_id": { + "name": "idx_compliance_documents_vehicle_id", + "columns": [ + "vehicle_id" + ], + "isUnique": false + }, + "idx_compliance_documents_type": { + "name": "idx_compliance_documents_type", + "columns": [ + "type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "compliance_documents_vehicle_id_vehicles_id_fk": { + "name": "compliance_documents_vehicle_id_vehicles_id_fk", + "tableFrom": "compliance_documents", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "configs": { + "name": "configs", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "fuel_logs": { + "name": "fuel_logs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "vehicle_id": { + "name": "vehicle_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "odometer": { + "name": "odometer", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fuel_amount": { + "name": "fuel_amount", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rate": { + "name": "rate", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cost": { + "name": "cost", + "type": "real", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filled": { + "name": "filled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "missed_last": { + "name": "missed_last", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attachment": { + "name": "attachment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_fuel_logs_vehicle_id": { + "name": "idx_fuel_logs_vehicle_id", + "columns": [ + "vehicle_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "fuel_logs_vehicle_id_vehicles_id_fk": { + "name": "fuel_logs_vehicle_id_vehicles_id_fk", + "tableFrom": "fuel_logs", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_logs": { + "name": "maintenance_logs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "vehicle_id": { + "name": "vehicle_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "odometer": { + "name": "odometer", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "service_center": { + "name": "service_center", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cost": { + "name": "cost", + "type": "real", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attachment": { + "name": "attachment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_maintenance_logs_vehicle_id": { + "name": "idx_maintenance_logs_vehicle_id", + "columns": [ + "vehicle_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "maintenance_logs_vehicle_id_vehicles_id_fk": { + "name": "maintenance_logs_vehicle_id_vehicles_id_fk", + "tableFrom": "maintenance_logs", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "notification_providers": { + "name": "notification_providers", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "config": { + "name": "config", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channels": { + "name": "channels", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[\"reminder\",\"alert\",\"information\"]'" + }, + "is_enabled": { + "name": "is_enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "notifications": { + "name": "notifications", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "vehicle_id": { + "name": "vehicle_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel": { + "name": "channel", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'information'" + }, + "notification_key": { + "name": "notification_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "due_date": { + "name": "due_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_read": { + "name": "is_read", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "cleared_at": { + "name": "cleared_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_notifications_vehicle_id": { + "name": "idx_notifications_vehicle_id", + "columns": [ + "vehicle_id" + ], + "isUnique": false + }, + "idx_notifications_notification_key": { + "name": "idx_notifications_notification_key", + "columns": [ + "notification_key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "notifications_vehicle_id_vehicles_id_fk": { + "name": "notifications_vehicle_id_vehicles_id_fk", + "tableFrom": "notifications", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reminders": { + "name": "reminders", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "vehicle_id": { + "name": "vehicle_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "due_date": { + "name": "due_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "remind_schedule": { + "name": "remind_schedule", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recurrence_type": { + "name": "recurrence_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + }, + "recurrence_interval": { + "name": "recurrence_interval", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "recurrence_end_date": { + "name": "recurrence_end_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_completed": { + "name": "is_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_reminders_vehicle_id": { + "name": "idx_reminders_vehicle_id", + "columns": [ + "vehicle_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "reminders_vehicle_id_vehicles_id_fk": { + "name": "reminders_vehicle_id_vehicles_id_fk", + "tableFrom": "reminders", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "vehicles": { + "name": "vehicles", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "make": { + "name": "make", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "license_plate": { + "name": "license_plate", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "vin": { + "name": "vin", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "odometer": { + "name": "odometer", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fuel_type": { + "name": "fuel_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'petrol'" + }, + "vehicle_type": { + "name": "vehicle_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'car'" + }, + "custom_fields": { + "name": "custom_fields", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} From 1e2aa2f6e85d2734827ac6fe934e3812ccb81d2a Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Fri, 4 Sep 2026 23:03:11 +0200 Subject: [PATCH 2/2] style(db): format migration snapshot --- .../meta/20260804090200_snapshot.json | 80 +++++-------------- 1 file changed, 20 insertions(+), 60 deletions(-) diff --git a/src/server/db/migrations/meta/20260804090200_snapshot.json b/src/server/db/migrations/meta/20260804090200_snapshot.json index 5b7f1d91..6a5f62f2 100644 --- a/src/server/db/migrations/meta/20260804090200_snapshot.json +++ b/src/server/db/migrations/meta/20260804090200_snapshot.json @@ -49,12 +49,8 @@ "name": "sessions_user_id_users_id_fk", "tableFrom": "sessions", "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -105,9 +101,7 @@ "indexes": { "users_username_unique": { "name": "users_username_unique", - "columns": [ - "username" - ], + "columns": ["username"], "isUnique": true } }, @@ -230,16 +224,12 @@ "indexes": { "idx_compliance_documents_vehicle_id": { "name": "idx_compliance_documents_vehicle_id", - "columns": [ - "vehicle_id" - ], + "columns": ["vehicle_id"], "isUnique": false }, "idx_compliance_documents_type": { "name": "idx_compliance_documents_type", - "columns": [ - "type" - ], + "columns": ["type"], "isUnique": false } }, @@ -248,12 +238,8 @@ "name": "compliance_documents_vehicle_id_vehicles_id_fk", "tableFrom": "compliance_documents", "tableTo": "vehicles", - "columnsFrom": [ - "vehicle_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["vehicle_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -405,9 +391,7 @@ "indexes": { "idx_fuel_logs_vehicle_id": { "name": "idx_fuel_logs_vehicle_id", - "columns": [ - "vehicle_id" - ], + "columns": ["vehicle_id"], "isUnique": false } }, @@ -416,12 +400,8 @@ "name": "fuel_logs_vehicle_id_vehicles_id_fk", "tableFrom": "fuel_logs", "tableTo": "vehicles", - "columnsFrom": [ - "vehicle_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["vehicle_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -507,9 +487,7 @@ "indexes": { "idx_maintenance_logs_vehicle_id": { "name": "idx_maintenance_logs_vehicle_id", - "columns": [ - "vehicle_id" - ], + "columns": ["vehicle_id"], "isUnique": false } }, @@ -518,12 +496,8 @@ "name": "maintenance_logs_vehicle_id_vehicles_id_fk", "tableFrom": "maintenance_logs", "tableTo": "vehicles", - "columnsFrom": [ - "vehicle_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["vehicle_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -693,16 +667,12 @@ "indexes": { "idx_notifications_vehicle_id": { "name": "idx_notifications_vehicle_id", - "columns": [ - "vehicle_id" - ], + "columns": ["vehicle_id"], "isUnique": false }, "idx_notifications_notification_key": { "name": "idx_notifications_notification_key", - "columns": [ - "notification_key" - ], + "columns": ["notification_key"], "isUnique": true } }, @@ -711,12 +681,8 @@ "name": "notifications_vehicle_id_vehicles_id_fk", "tableFrom": "notifications", "tableTo": "vehicles", - "columnsFrom": [ - "vehicle_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["vehicle_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -819,9 +785,7 @@ "indexes": { "idx_reminders_vehicle_id": { "name": "idx_reminders_vehicle_id", - "columns": [ - "vehicle_id" - ], + "columns": ["vehicle_id"], "isUnique": false } }, @@ -830,12 +794,8 @@ "name": "reminders_vehicle_id_vehicles_id_fk", "tableFrom": "reminders", "tableTo": "vehicles", - "columnsFrom": [ - "vehicle_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["vehicle_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }