{ "id": "d1116059-9901-4852-9826-5a4458564eb5", "prevId": "8809abd6-6301-4dba-9f67-13071abd3086", "version": "7", "dialect": "postgresql", "tables": { "public.account": { "name": "account", "schema": "", "columns": { "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true }, "provider": { "name": "provider", "type": "text", "primaryKey": false, "notNull": true }, "providerAccountId": { "name": "providerAccountId", "type": "text", "primaryKey": false, "notNull": true }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": false }, "token_type": { "name": "token_type", "type": "text", "primaryKey": false, "notNull": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false }, "session_state": { "name": "session_state", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "account_userId_user_id_fk": { "name": "account_userId_user_id_fk", "tableFrom": "account", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": { "account_provider_providerAccountId_pk": { "name": "account_provider_providerAccountId_pk", "columns": [ "provider", "providerAccountId" ] } }, "uniqueConstraints": {} }, "public.apiKey": { "name": "apiKey", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "keyId": { "name": "keyId", "type": "text", "primaryKey": false, "notNull": true }, "keyHash": { "name": "keyHash", "type": "text", "primaryKey": false, "notNull": true }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "apiKey_userId_user_id_fk": { "name": "apiKey_userId_user_id_fk", "tableFrom": "apiKey", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "apiKey_keyId_unique": { "name": "apiKey_keyId_unique", "columns": [ "keyId" ], "nullsNotDistinct": false }, "apiKey_name_userId_unique": { "name": "apiKey_name_userId_unique", "columns": [ "name", "userId" ], "nullsNotDistinct": false } } }, "public.category": { "name": "category", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "real", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "colorId": { "name": "colorId", "type": "text", "primaryKey": false, "notNull": true }, "parentId": { "name": "parentId", "type": "text", "primaryKey": false, "notNull": false }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "category_colorId_color_id_fk": { "name": "category_colorId_color_id_fk", "tableFrom": "category", "columnsFrom": [ "colorId" ], "tableTo": "color", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "no action" }, "category_parentId_category_id_fk": { "name": "category_parentId_category_id_fk", "tableFrom": "category", "columnsFrom": [ "parentId" ], "tableTo": "category", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "no action" }, "category_userId_user_id_fk": { "name": "category_userId_user_id_fk", "tableFrom": "category", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "category_userId_code_unique": { "name": "category_userId_code_unique", "columns": [ "userId", "code" ], "nullsNotDistinct": false } } }, "public.color": { "name": "color", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "hexcode": { "name": "hexcode", "type": "text", "primaryKey": false, "notNull": true }, "inverse": { "name": "inverse", "type": "text", "primaryKey": false, "notNull": false }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "color_userId_user_id_fk": { "name": "color_userId_user_id_fk", "tableFrom": "color", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "color_userId_name_unique": { "name": "color_userId_name_unique", "columns": [ "userId", "name" ], "nullsNotDistinct": false } } }, "public.config": { "name": "config", "schema": "", "columns": { "key": { "name": "key", "type": "text", "primaryKey": true, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} }, "public.day": { "name": "day", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "date": { "name": "date", "type": "text", "primaryKey": false, "notNull": true }, "mood": { "name": "mood", "type": "integer", "primaryKey": false, "notNull": false }, "comment": { "name": "comment", "type": "text", "primaryKey": false, "notNull": false }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "day_userId_user_id_fk": { "name": "day_userId_user_id_fk", "tableFrom": "day", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "day_date_unique": { "name": "day_date_unique", "columns": [ "date" ], "nullsNotDistinct": false } } }, "public.hour": { "name": "hour", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true }, "comment": { "name": "comment", "type": "text", "primaryKey": false, "notNull": false }, "time": { "name": "time", "type": "integer", "primaryKey": false, "notNull": true }, "datetime": { "name": "datetime", "type": "timestamp", "primaryKey": false, "notNull": true }, "dayId": { "name": "dayId", "type": "text", "primaryKey": false, "notNull": true }, "categoryId": { "name": "categoryId", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "hour_userId_user_id_fk": { "name": "hour_userId_user_id_fk", "tableFrom": "hour", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" }, "hour_dayId_day_id_fk": { "name": "hour_dayId_day_id_fk", "tableFrom": "hour", "columnsFrom": [ "dayId" ], "tableTo": "day", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" }, "hour_categoryId_category_id_fk": { "name": "hour_categoryId_category_id_fk", "tableFrom": "hour", "columnsFrom": [ "categoryId" ], "tableTo": "category", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "hour_dayId_datetime_unique": { "name": "hour_dayId_datetime_unique", "columns": [ "dayId", "datetime" ], "nullsNotDistinct": false } } }, "public.measurement": { "name": "measurement", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "hourId": { "name": "hourId", "type": "text", "primaryKey": false, "notNull": false }, "dayId": { "name": "dayId", "type": "text", "primaryKey": false, "notNull": true }, "metricId": { "name": "metricId", "type": "text", "primaryKey": false, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "measurement_hourId_hour_id_fk": { "name": "measurement_hourId_hour_id_fk", "tableFrom": "measurement", "columnsFrom": [ "hourId" ], "tableTo": "hour", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "no action" }, "measurement_dayId_day_id_fk": { "name": "measurement_dayId_day_id_fk", "tableFrom": "measurement", "columnsFrom": [ "dayId" ], "tableTo": "day", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" }, "measurement_metricId_metric_id_fk": { "name": "measurement_metricId_metric_id_fk", "tableFrom": "measurement", "columnsFrom": [ "metricId" ], "tableTo": "metric", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" }, "measurement_userId_user_id_fk": { "name": "measurement_userId_user_id_fk", "tableFrom": "measurement", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {} }, "public.metric": { "name": "metric", "schema": "", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true }, "unit": { "name": "unit", "type": "text", "primaryKey": false, "notNull": false }, "goal": { "name": "goal", "type": "real", "primaryKey": false, "notNull": false }, "icon": { "name": "icon", "type": "text", "primaryKey": false, "notNull": true }, "createdAt": { "name": "createdAt", "type": "timestamp", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "metric_userId_user_id_fk": { "name": "metric_userId_user_id_fk", "tableFrom": "metric", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "metric_userId_name_unique": { "name": "metric_userId_name_unique", "columns": [ "userId", "name" ], "nullsNotDistinct": false } } }, "public.session": { "name": "session", "schema": "", "columns": { "sessionToken": { "name": "sessionToken", "type": "text", "primaryKey": true, "notNull": true }, "userId": { "name": "userId", "type": "text", "primaryKey": false, "notNull": true }, "expires": { "name": "expires", "type": "timestamp", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "session_userId_user_id_fk": { "name": "session_userId_user_id_fk", "tableFrom": "session", "columnsFrom": [ "userId" ], "tableTo": "user", "columnsTo": [ "id" ], "onUpdate": "no action", "onDelete": "cascade" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {} }, "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 }, "emailVerified": { "name": "emailVerified", "type": "integer", "primaryKey": false, "notNull": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": false, "default": "'user'" }, "timezone": { "name": "timezone", "type": "text", "primaryKey": false, "notNull": true, "default": "'America/Los_Angeles'" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_email_unique": { "name": "user_email_unique", "columns": [ "email" ], "nullsNotDistinct": false } } }, "public.verificationToken": { "name": "verificationToken", "schema": "", "columns": { "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true }, "expires": { "name": "expires", "type": "timestamp", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": { "verificationToken_identifier_token_pk": { "name": "verificationToken_identifier_token_pk", "columns": [ "identifier", "token" ] } }, "uniqueConstraints": {} } }, "enums": {}, "schemas": {}, "sequences": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }