From a3b913429996e6f589ca45ba6a07d80b36f3e0df Mon Sep 17 00:00:00 2001 From: Timothy Yin Date: Wed, 11 Mar 2026 00:16:19 +0800 Subject: [PATCH] chore: update schema file --- apps/csms/drizzle/0001_superb_the_twelve.sql | 22 + apps/csms/drizzle/meta/0001_snapshot.json | 1815 ++++++++++++++++++ apps/csms/drizzle/meta/_journal.json | 7 + 3 files changed, 1844 insertions(+) create mode 100644 apps/csms/drizzle/0001_superb_the_twelve.sql create mode 100644 apps/csms/drizzle/meta/0001_snapshot.json diff --git a/apps/csms/drizzle/0001_superb_the_twelve.sql b/apps/csms/drizzle/0001_superb_the_twelve.sql new file mode 100644 index 0000000..9e64ac0 --- /dev/null +++ b/apps/csms/drizzle/0001_superb_the_twelve.sql @@ -0,0 +1,22 @@ +CREATE TABLE "passkey" ( + "id" text PRIMARY KEY NOT NULL, + "name" text, + "public_key" text NOT NULL, + "user_id" text NOT NULL, + "credential_id" text NOT NULL, + "counter" integer NOT NULL, + "device_type" text NOT NULL, + "backed_up" boolean NOT NULL, + "transports" text, + "created_at" timestamp, + "aaguid" text +); +--> statement-breakpoint +ALTER TABLE "jwks" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +DROP TABLE "jwks" CASCADE;--> statement-breakpoint +ALTER TABLE "passkey" ADD CONSTRAINT "passkey_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "passkey_userId_idx" ON "passkey" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX "passkey_credentialID_idx" ON "passkey" USING btree ("credential_id");--> statement-breakpoint +CREATE INDEX "account_userId_idx" ON "account" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX "session_userId_idx" ON "session" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier"); \ No newline at end of file diff --git a/apps/csms/drizzle/meta/0001_snapshot.json b/apps/csms/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..9dfe697 --- /dev/null +++ b/apps/csms/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1815 @@ +{ + "id": "93382c4a-cbc2-4854-a52a-ba4fd6d68b09", + "prevId": "6b92f83e-6808-4773-b02d-0959316c548f", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.passkey": { + "name": "passkey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backed_up": { + "name": "backed_up", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "transports": { + "name": "transports", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "aaguid": { + "name": "aaguid", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "passkey_userId_idx": { + "name": "passkey_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "passkey_credentialID_idx": { + "name": "passkey_credentialID_idx", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "passkey_user_id_user_id_fk": { + "name": "passkey_user_id_user_id_fk", + "tableFrom": "passkey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_username": { + "name": "display_username", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.charge_point": { + "name": "charge_point", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "charge_point_identifier": { + "name": "charge_point_identifier", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "charge_point_serial_number": { + "name": "charge_point_serial_number", + "type": "varchar(25)", + "primaryKey": false, + "notNull": false + }, + "charge_point_model": { + "name": "charge_point_model", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "charge_point_vendor": { + "name": "charge_point_vendor", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "firmware_version": { + "name": "firmware_version", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "iccid": { + "name": "iccid", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "imsi": { + "name": "imsi", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "meter_serial_number": { + "name": "meter_serial_number", + "type": "varchar(25)", + "primaryKey": false, + "notNull": false + }, + "meter_type": { + "name": "meter_type", + "type": "varchar(25)", + "primaryKey": false, + "notNull": false + }, + "registration_status": { + "name": "registration_status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'Pending'" + }, + "heartbeat_interval": { + "name": "heartbeat_interval", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 60 + }, + "last_heartbeat_at": { + "name": "last_heartbeat_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_boot_notification_at": { + "name": "last_boot_notification_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "fee_per_kwh": { + "name": "fee_per_kwh", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "charge_point_charge_point_identifier_unique": { + "name": "charge_point_charge_point_identifier_unique", + "nullsNotDistinct": false, + "columns": [ + "charge_point_identifier" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.charging_profile": { + "name": "charging_profile", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "connector_number": { + "name": "connector_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "transaction_id": { + "name": "transaction_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "stack_level": { + "name": "stack_level", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "charging_profile_purpose": { + "name": "charging_profile_purpose", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "charging_profile_kind": { + "name": "charging_profile_kind", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "recurrency_kind": { + "name": "recurrency_kind", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "valid_from": { + "name": "valid_from", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "valid_to": { + "name": "valid_to", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "charging_schedule": { + "name": "charging_schedule", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_charging_profile_charge_point_id": { + "name": "idx_charging_profile_charge_point_id", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_charging_profile_connector_id": { + "name": "idx_charging_profile_connector_id", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_charging_profile_purpose_stack": { + "name": "idx_charging_profile_purpose_stack", + "columns": [ + { + "expression": "connector_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "charging_profile_purpose", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stack_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "charging_profile_charge_point_id_charge_point_id_fk": { + "name": "charging_profile_charge_point_id_charge_point_id_fk", + "tableFrom": "charging_profile", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "charging_profile_connector_id_connector_id_fk": { + "name": "charging_profile_connector_id_connector_id_fk", + "tableFrom": "charging_profile", + "tableTo": "connector", + "columnsFrom": [ + "connector_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "charging_profile_transaction_id_transaction_id_fk": { + "name": "charging_profile_transaction_id_transaction_id_fk", + "tableFrom": "charging_profile", + "tableTo": "transaction", + "columnsFrom": [ + "transaction_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.connector": { + "name": "connector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'Unavailable'" + }, + "error_code": { + "name": "error_code", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'NoError'" + }, + "info": { + "name": "info", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_error_code": { + "name": "vendor_error_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "last_status_at": { + "name": "last_status_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_connector_charge_point_id": { + "name": "idx_connector_charge_point_id", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_connector_charge_point_connector": { + "name": "idx_connector_charge_point_connector", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "connector_charge_point_id_charge_point_id_fk": { + "name": "connector_charge_point_id_charge_point_id_fk", + "tableFrom": "connector", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.connector_status_history": { + "name": "connector_status_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_number": { + "name": "connector_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "error_code": { + "name": "error_code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "info": { + "name": "info", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_error_code": { + "name": "vendor_error_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status_timestamp": { + "name": "status_timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "received_at": { + "name": "received_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_status_history_connector_id": { + "name": "idx_status_history_connector_id", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_status_history_timestamp": { + "name": "idx_status_history_timestamp", + "columns": [ + { + "expression": "status_timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_status_history_received_at": { + "name": "idx_status_history_received_at", + "columns": [ + { + "expression": "received_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "connector_status_history_connector_id_connector_id_fk": { + "name": "connector_status_history_connector_id_connector_id_fk", + "tableFrom": "connector_status_history", + "tableTo": "connector", + "columnsFrom": [ + "connector_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.id_tag": { + "name": "id_tag", + "schema": "", + "columns": { + "id_tag": { + "name": "id_tag", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "parent_id_tag": { + "name": "parent_id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'Accepted'" + }, + "expiry_date": { + "name": "expiry_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "balance": { + "name": "balance", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "id_tag_user_id_user_id_fk": { + "name": "id_tag_user_id_user_id_fk", + "tableFrom": "id_tag", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.local_auth_list": { + "name": "local_auth_list", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "list_version": { + "name": "list_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id_tag": { + "name": "id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "parent_id_tag": { + "name": "parent_id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "id_tag_status": { + "name": "id_tag_status", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "expiry_date": { + "name": "expiry_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_local_auth_list_charge_point_id_tag": { + "name": "idx_local_auth_list_charge_point_id_tag", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id_tag", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "local_auth_list_charge_point_id_charge_point_id_fk": { + "name": "local_auth_list_charge_point_id_charge_point_id_fk", + "tableFrom": "local_auth_list", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.meter_value": { + "name": "meter_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "transaction_id": { + "name": "transaction_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "connector_id": { + "name": "connector_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_number": { + "name": "connector_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "sampled_values": { + "name": "sampled_values", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "received_at": { + "name": "received_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_meter_value_transaction_id": { + "name": "idx_meter_value_transaction_id", + "columns": [ + { + "expression": "transaction_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_meter_value_connector_id": { + "name": "idx_meter_value_connector_id", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_meter_value_timestamp": { + "name": "idx_meter_value_timestamp", + "columns": [ + { + "expression": "timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "meter_value_transaction_id_transaction_id_fk": { + "name": "meter_value_transaction_id_transaction_id_fk", + "tableFrom": "meter_value", + "tableTo": "transaction", + "columnsFrom": [ + "transaction_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "meter_value_connector_id_connector_id_fk": { + "name": "meter_value_connector_id_connector_id_fk", + "tableFrom": "meter_value", + "tableTo": "connector", + "columnsFrom": [ + "connector_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "meter_value_charge_point_id_charge_point_id_fk": { + "name": "meter_value_charge_point_id_charge_point_id_fk", + "tableFrom": "meter_value", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.reservation": { + "name": "reservation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "connector_number": { + "name": "connector_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "expiry_date": { + "name": "expiry_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "id_tag": { + "name": "id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "parent_id_tag": { + "name": "parent_id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'Active'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_reservation_charge_point_id": { + "name": "idx_reservation_charge_point_id", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_reservation_status": { + "name": "idx_reservation_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_reservation_expiry_date": { + "name": "idx_reservation_expiry_date", + "columns": [ + { + "expression": "expiry_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "reservation_charge_point_id_charge_point_id_fk": { + "name": "reservation_charge_point_id_charge_point_id_fk", + "tableFrom": "reservation", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "reservation_connector_id_connector_id_fk": { + "name": "reservation_connector_id_connector_id_fk", + "tableFrom": "reservation", + "tableTo": "connector", + "columnsFrom": [ + "connector_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.transaction": { + "name": "transaction", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "charge_point_id": { + "name": "charge_point_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "connector_number": { + "name": "connector_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id_tag": { + "name": "id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "id_tag_status": { + "name": "id_tag_status", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "start_timestamp": { + "name": "start_timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "start_meter_value": { + "name": "start_meter_value", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stop_id_tag": { + "name": "stop_id_tag", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "stop_timestamp": { + "name": "stop_timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "stop_meter_value": { + "name": "stop_meter_value", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "stop_reason": { + "name": "stop_reason", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "charge_amount": { + "name": "charge_amount", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reservation_id": { + "name": "reservation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_transaction_charge_point_id": { + "name": "idx_transaction_charge_point_id", + "columns": [ + { + "expression": "charge_point_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_transaction_connector_id": { + "name": "idx_transaction_connector_id", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_transaction_id_tag": { + "name": "idx_transaction_id_tag", + "columns": [ + { + "expression": "id_tag", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_transaction_start_timestamp": { + "name": "idx_transaction_start_timestamp", + "columns": [ + { + "expression": "start_timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "transaction_charge_point_id_charge_point_id_fk": { + "name": "transaction_charge_point_id_charge_point_id_fk", + "tableFrom": "transaction", + "tableTo": "charge_point", + "columnsFrom": [ + "charge_point_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "transaction_connector_id_connector_id_fk": { + "name": "transaction_connector_id_connector_id_fk", + "tableFrom": "transaction", + "tableTo": "connector", + "columnsFrom": [ + "connector_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/csms/drizzle/meta/_journal.json b/apps/csms/drizzle/meta/_journal.json index 122a87b..91717e1 100644 --- a/apps/csms/drizzle/meta/_journal.json +++ b/apps/csms/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1773148750321, "tag": "0000_last_big_bertha", "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1773159362406, + "tag": "0001_superb_the_twelve", + "breakpoints": true } ] } \ No newline at end of file