diff --git a/packages/core/migrations/0013_neat_colleen_wing.sql b/packages/core/migrations/0013_neat_colleen_wing.sql new file mode 100644 index 00000000..0b7c5d60 --- /dev/null +++ b/packages/core/migrations/0013_neat_colleen_wing.sql @@ -0,0 +1,3 @@ +CREATE TYPE "public"."controller_support" AS ENUM('full', 'unknown');--> statement-breakpoint +ALTER TABLE "base_games" ALTER COLUMN "controller_support" SET DATA TYPE controller_support;--> statement-breakpoint +ALTER TABLE "base_games" ALTER COLUMN "controller_support" SET NOT NULL; \ No newline at end of file diff --git a/packages/core/migrations/meta/0013_snapshot.json b/packages/core/migrations/meta/0013_snapshot.json new file mode 100644 index 00000000..73971a59 --- /dev/null +++ b/packages/core/migrations/meta/0013_snapshot.json @@ -0,0 +1,1265 @@ +{ + "id": "ac06d391-f715-4643-9952-e992ec14a2a3", + "prevId": "84625b17-0a15-4d45-a32d-b0791ab07c92", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.base_games": { + "name": "base_games", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "release_date": { + "name": "release_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "primary_genre": { + "name": "primary_genre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "controller_support": { + "name": "controller_support", + "type": "controller_support", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "compatibility": { + "name": "compatibility", + "type": "compatibility", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'unknown'" + }, + "score": { + "name": "score", + "type": "numeric(2, 1)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "idx_base_games_slug": { + "name": "idx_base_games_slug", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.categories": { + "name": "categories", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "category_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_categories_type": { + "name": "idx_categories_type", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "categories_slug_type_pk": { + "name": "categories_slug_type_pk", + "columns": [ + "slug", + "type" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.steam_account_credentials": { + "name": "steam_account_credentials", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "steam_id": { + "name": "steam_id", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expiry": { + "name": "expiry", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "steam_account_credentials_steam_id_steam_accounts_id_fk": { + "name": "steam_account_credentials_steam_id_steam_accounts_id_fk", + "tableFrom": "steam_account_credentials", + "tableTo": "steam_accounts", + "columnsFrom": [ + "steam_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.friends_list": { + "name": "friends_list", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "steam_id": { + "name": "steam_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "friend_steam_id": { + "name": "friend_steam_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_friends_list_friend_steam_id": { + "name": "idx_friends_list_friend_steam_id", + "columns": [ + { + "expression": "friend_steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "friends_list_steam_id_steam_accounts_id_fk": { + "name": "friends_list_steam_id_steam_accounts_id_fk", + "tableFrom": "friends_list", + "tableTo": "steam_accounts", + "columnsFrom": [ + "steam_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "friends_list_friend_steam_id_steam_accounts_id_fk": { + "name": "friends_list_friend_steam_id_steam_accounts_id_fk", + "tableFrom": "friends_list", + "tableTo": "steam_accounts", + "columnsFrom": [ + "friend_steam_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "friends_list_steam_id_friend_steam_id_pk": { + "name": "friends_list_steam_id_friend_steam_id_pk", + "columns": [ + "steam_id", + "friend_steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.games": { + "name": "games", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "base_game_id": { + "name": "base_game_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "category_slug": { + "name": "category_slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "category_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_games_category_slug": { + "name": "idx_games_category_slug", + "columns": [ + { + "expression": "category_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_games_category_type": { + "name": "idx_games_category_type", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_games_category_slug_type": { + "name": "idx_games_category_slug_type", + "columns": [ + { + "expression": "category_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "games_base_game_id_base_games_id_fk": { + "name": "games_base_game_id_base_games_id_fk", + "tableFrom": "games", + "tableTo": "base_games", + "columnsFrom": [ + "base_game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "games_categories_fkey": { + "name": "games_categories_fkey", + "tableFrom": "games", + "tableTo": "categories", + "columnsFrom": [ + "category_slug", + "type" + ], + "columnsTo": [ + "slug", + "type" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "games_base_game_id_category_slug_type_pk": { + "name": "games_base_game_id_category_slug_type_pk", + "columns": [ + "base_game_id", + "category_slug", + "type" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.images": { + "name": "images", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "image_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "image_hash": { + "name": "image_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "base_game_id": { + "name": "base_game_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "dimensions": { + "name": "dimensions", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "extracted_color": { + "name": "extracted_color", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_images_type": { + "name": "idx_images_type", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_images_game_id": { + "name": "idx_images_game_id", + "columns": [ + { + "expression": "base_game_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "images_base_game_id_base_games_id_fk": { + "name": "images_base_game_id_base_games_id_fk", + "tableFrom": "images", + "tableTo": "base_games", + "columnsFrom": [ + "base_game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "images_image_hash_type_base_game_id_position_pk": { + "name": "images_image_hash_type_base_game_id_position_pk", + "columns": [ + "image_hash", + "type", + "base_game_id", + "position" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.game_libraries": { + "name": "game_libraries", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "base_game_id": { + "name": "base_game_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_game_libraries_owner_id": { + "name": "idx_game_libraries_owner_id", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "game_libraries_base_game_id_base_games_id_fk": { + "name": "game_libraries_base_game_id_base_games_id_fk", + "tableFrom": "game_libraries", + "tableTo": "base_games", + "columnsFrom": [ + "base_game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "game_libraries_owner_id_steam_accounts_id_fk": { + "name": "game_libraries_owner_id_steam_accounts_id_fk", + "tableFrom": "game_libraries", + "tableTo": "steam_accounts", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "game_libraries_base_game_id_owner_id_pk": { + "name": "game_libraries_base_game_id_owner_id_pk", + "columns": [ + "base_game_id", + "owner_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.members": { + "name": "members", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "char(30)", + "primaryKey": false, + "notNull": true + }, + "team_id": { + "name": "team_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true + }, + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "char(30)", + "primaryKey": false, + "notNull": false + }, + "steam_id": { + "name": "steam_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_member_steam_id": { + "name": "idx_member_steam_id", + "columns": [ + { + "expression": "team_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_member_user_id": { + "name": "idx_member_user_id", + "columns": [ + { + "expression": "team_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"members\".\"user_id\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "members_user_id_users_id_fk": { + "name": "members_user_id_users_id_fk", + "tableFrom": "members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "members_steam_id_steam_accounts_id_fk": { + "name": "members_steam_id_steam_accounts_id_fk", + "tableFrom": "members", + "tableTo": "steam_accounts", + "columnsFrom": [ + "steam_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "restrict" + } + }, + "compositePrimaryKeys": { + "members_id_team_id_pk": { + "name": "members_id_team_id_pk", + "columns": [ + "id", + "team_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.steam_accounts": { + "name": "steam_accounts", + "schema": "", + "columns": { + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "char(30)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "steam_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "real_name": { + "name": "real_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "member_since": { + "name": "member_since", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "profile_url": { + "name": "profile_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "avatar_hash": { + "name": "avatar_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "limitations": { + "name": "limitations", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "steam_accounts_user_id_users_id_fk": { + "name": "steam_accounts_user_id_users_id_fk", + "tableFrom": "steam_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "idx_steam_username": { + "name": "idx_steam_username", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.teams": { + "name": "teams", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "char(30)", + "primaryKey": true, + "notNull": true + }, + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true + }, + "invite_code": { + "name": "invite_code", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "max_members": { + "name": "max_members", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_team_slug": { + "name": "idx_team_slug", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "teams_owner_id_users_id_fk": { + "name": "teams_owner_id_users_id_fk", + "tableFrom": "teams", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "teams_slug_steam_accounts_username_fk": { + "name": "teams_slug_steam_accounts_username_fk", + "tableFrom": "teams", + "tableTo": "steam_accounts", + "columnsFrom": [ + "slug" + ], + "columnsTo": [ + "username" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "idx_team_invite_code": { + "name": "idx_team_invite_code", + "nullsNotDistinct": false, + "columns": [ + "invite_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "char(30)", + "primaryKey": true, + "notNull": true + }, + "time_created": { + "name": "time_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "polar_customer_id": { + "name": "polar_customer_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "idx_user_email": { + "name": "idx_user_email", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.compatibility": { + "name": "compatibility", + "schema": "public", + "values": [ + "high", + "mid", + "low", + "unknown" + ] + }, + "public.controller_support": { + "name": "controller_support", + "schema": "public", + "values": [ + "full", + "unknown" + ] + }, + "public.category_type": { + "name": "category_type", + "schema": "public", + "values": [ + "tag", + "genre", + "publisher", + "developer" + ] + }, + "public.image_type": { + "name": "image_type", + "schema": "public", + "values": [ + "heroArt", + "icon", + "logo", + "superHeroArt", + "poster", + "boxArt", + "screenshot", + "background" + ] + }, + "public.member_role": { + "name": "member_role", + "schema": "public", + "values": [ + "child", + "adult" + ] + }, + "public.steam_status": { + "name": "steam_status", + "schema": "public", + "values": [ + "online", + "offline", + "dnd", + "playing" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/core/migrations/meta/_journal.json b/packages/core/migrations/meta/_journal.json index 859fbe54..7f97fe37 100644 --- a/packages/core/migrations/meta/_journal.json +++ b/packages/core/migrations/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1746905730079, "tag": "0012_glorious_jetstream", "breakpoints": true + }, + { + "idx": 13, + "version": "7", + "when": 1746925065142, + "tag": "0013_neat_colleen_wing", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/core/src/base-game/base-game.sql.ts b/packages/core/src/base-game/base-game.sql.ts index 81b39310..bd1e2596 100644 --- a/packages/core/src/base-game/base-game.sql.ts +++ b/packages/core/src/base-game/base-game.sql.ts @@ -3,6 +3,7 @@ import { timestamps, utc } from "../drizzle/types"; import { json, numeric, pgEnum, pgTable, text, unique, varchar } from "drizzle-orm/pg-core"; export const CompatibilityEnum = pgEnum("compatibility", ["high", "mid", "low", "unknown"]) +export const ControllerEnum = pgEnum("controller_support", ["full", "unknown"]) export const Size = z.object({ @@ -26,7 +27,7 @@ export const baseGamesTable = pgTable( size: json("size").$type().notNull(), description: text("description").notNull(), primaryGenre: text("primary_genre").notNull(), - controllerSupport: text("controller_support"), + controllerSupport: ControllerEnum("controller_support").notNull(), compatibility: CompatibilityEnum("compatibility").notNull().default("unknown"), // Score ranges from 0.0 to 5.0 score: numeric("score", { precision: 2, scale: 1 }) diff --git a/packages/core/src/base-game/index.ts b/packages/core/src/base-game/index.ts index abe53427..6ac628f5 100644 --- a/packages/core/src/base-game/index.ts +++ b/packages/core/src/base-game/index.ts @@ -2,9 +2,9 @@ import { z } from "zod"; import { fn } from "../utils"; import { Common } from "../common"; import { Examples } from "../examples"; -import { createTransaction } from "../drizzle/transaction"; -import { CompatibilityEnum, baseGamesTable, Size } from "./base-game.sql"; import { eq, isNull, or, and } from "drizzle-orm"; +import { createTransaction } from "../drizzle/transaction"; +import { CompatibilityEnum, baseGamesTable, Size, ControllerEnum } from "./base-game.sql"; export namespace BaseGame { export const Info = z.object({ @@ -40,7 +40,7 @@ export namespace BaseGame { description: "The main category or genre that best represents the game's content and gameplay style", example: Examples.BaseGame.primaryGenre }), - controllerSupport: z.string().nullable().openapi({ + controllerSupport: z.enum(ControllerEnum.enumValues).openapi({ description: "Indicates the level of gamepad/controller compatibility: 'Full', 'Partial', or null for no support", example: Examples.BaseGame.controllerSupport }), diff --git a/packages/core/src/examples.ts b/packages/core/src/examples.ts index 0d96a50a..d2703ac1 100644 --- a/packages/core/src/examples.ts +++ b/packages/core/src/examples.ts @@ -152,7 +152,7 @@ export namespace Examples { id: "1809540", slug: "nine-sols", name: "Nine Sols", - controllerSupport: "full", + controllerSupport: "full" as const, releaseDate: new Date("2024-05-29T06:53:24.000Z"), compatibility: "high" as const, size: { diff --git a/packages/zero/schema.ts b/packages/zero/schema.ts index b340d4dd..6273f783 100644 --- a/packages/zero/schema.ts +++ b/packages/zero/schema.ts @@ -96,7 +96,7 @@ const base_games = table("base_games") size: json(), description: string(), primary_genre: string(), - controller_support: string().optional(), + controller_support: enumeration<"full" | "unknown">(), compatibility: enumeration<"high" | "mid" | "low" | "unknown">(), score: number(), ...timestamps