|
10 | 10 | # |
11 | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 |
|
13 | | -ActiveRecord::Schema[7.2].define(version: 2026_03_19_120001) do |
| 13 | +ActiveRecord::Schema[7.2].define(version: 2026_03_22_120000) do |
| 14 | + create_schema "auth" |
| 15 | + create_schema "extensions" |
| 16 | + create_schema "graphql" |
| 17 | + create_schema "graphql_public" |
| 18 | + create_schema "pgbouncer" |
| 19 | + create_schema "realtime" |
| 20 | + create_schema "storage" |
| 21 | + create_schema "supabase_migrations" |
| 22 | + create_schema "vault" |
| 23 | + |
14 | 24 | # These are extensions that must be enabled in order to support this database |
| 25 | + enable_extension "pg_graphql" |
| 26 | + enable_extension "pg_stat_statements" |
15 | 27 | enable_extension "pgcrypto" |
16 | 28 | enable_extension "plpgsql" |
| 29 | + enable_extension "supabase_vault" |
| 30 | + enable_extension "uuid-ossp" |
17 | 31 |
|
18 | 32 | create_table "ai_champion_matrices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
19 | 33 | t.string "champion_a", null: false |
|
186 | 200 | t.index ["match_type"], name: "index_matches_on_match_type" |
187 | 201 | t.index ["organization_id", "created_at"], name: "idx_matches_org_created" |
188 | 202 | t.index ["organization_id", "game_start", "victory"], name: "idx_matches_org_game_start_victory", comment: "Otimiza queries de winrate por período" |
| 203 | + t.index ["organization_id", "game_start"], name: "idx_matches_org_game_start" |
189 | 204 | t.index ["organization_id", "id"], name: "idx_matches_org_id" |
190 | 205 | t.index ["organization_id", "match_type"], name: "idx_matches_org_match_type" |
| 206 | + t.index ["organization_id", "victory"], name: "idx_matches_org_victory" |
191 | 207 | t.index ["organization_id"], name: "index_matches_on_organization_id" |
192 | 208 | t.index ["riot_match_id"], name: "index_matches_on_riot_match_id", unique: true |
193 | 209 | t.index ["victory"], name: "index_matches_on_victory" |
194 | 210 | end |
195 | 211 |
|
196 | 212 | create_table "messages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
197 | 213 | t.uuid "user_id", null: false |
198 | | - t.uuid "recipient_id" |
199 | 214 | t.uuid "organization_id", null: false |
200 | 215 | t.text "content", null: false |
201 | 216 | t.boolean "deleted", default: false, null: false |
202 | 217 | t.datetime "deleted_at" |
203 | 218 | t.datetime "created_at", null: false |
204 | 219 | t.datetime "updated_at", null: false |
| 220 | + t.uuid "recipient_id" |
| 221 | + t.index ["organization_id", "created_at"], name: "idx_messages_active_by_org", where: "(deleted = false)" |
| 222 | + t.index ["organization_id", "created_at"], name: "idx_messages_org_created_at" |
205 | 223 | t.index ["organization_id", "recipient_id", "user_id", "created_at"], name: "idx_messages_dm_reverse" |
| 224 | + t.index ["organization_id", "user_id", "created_at"], name: "idx_messages_org_user_created_at" |
206 | 225 | t.index ["organization_id", "user_id", "recipient_id", "created_at"], name: "idx_messages_active_dm", where: "(deleted = false)" |
207 | 226 | t.index ["organization_id", "user_id", "recipient_id", "created_at"], name: "idx_messages_dm_created_at" |
208 | 227 | t.index ["organization_id"], name: "index_messages_on_organization_id" |
|
358 | 377 | t.index ["champion"], name: "index_player_match_stats_on_champion" |
359 | 378 | t.index ["crowd_control_score"], name: "idx_pms_cc_score" |
360 | 379 | t.index ["match_id", "player_id"], name: "idx_player_stats_match_player_agg", comment: "Otimiza agregações de estatísticas (SUM kills/deaths/assists)" |
| 380 | + t.index ["match_id"], name: "idx_player_stats_match" |
361 | 381 | t.index ["objectives_stolen"], name: "idx_pms_objectives_stolen", where: "(objectives_stolen > 0)" |
362 | 382 | t.index ["player_id", "champion"], name: "idx_pms_player_champion" |
363 | 383 | t.index ["player_id", "cs_per_min"], name: "idx_pms_player_cs_per_min" |
|
426 | 446 | t.index ["organization_id", "deleted_at"], name: "idx_players_org_deleted_active", where: "(deleted_at IS NULL)", comment: "Índice parcial para COUNT de players ativos" |
427 | 447 | t.index ["organization_id", "last_sync_at"], name: "idx_players_org_last_sync" |
428 | 448 | t.index ["organization_id", "role"], name: "index_players_on_org_and_role" |
| 449 | + t.index ["organization_id", "status"], name: "idx_players_org_status" |
429 | 450 | t.index ["organization_id", "sync_status"], name: "idx_players_org_sync_status" |
430 | 451 | t.index ["organization_id"], name: "index_players_on_organization_id" |
431 | 452 | t.index ["player_access_enabled"], name: "index_players_on_player_access_enabled", comment: "Quick lookup for players with access enabled" |
|
499 | 520 | t.jsonb "metadata", default: {} |
500 | 521 | t.datetime "created_at", null: false |
501 | 522 | t.datetime "updated_at", null: false |
| 523 | + t.uuid "scrim_id" |
502 | 524 | t.index ["created_by_id"], name: "index_schedules_on_created_by_id" |
503 | 525 | t.index ["event_type"], name: "index_schedules_on_event_type" |
504 | 526 | t.index ["match_id"], name: "index_schedules_on_match_id" |
505 | 527 | t.index ["organization_id", "event_type"], name: "idx_schedules_org_event_type" |
506 | 528 | t.index ["organization_id", "start_time", "event_type"], name: "idx_schedules_org_time_type", comment: "Otimiza queries de próximos eventos" |
| 529 | + t.index ["organization_id", "start_time"], name: "idx_schedules_org_time" |
507 | 530 | t.index ["organization_id"], name: "index_schedules_on_organization_id" |
| 531 | + t.index ["scrim_id"], name: "index_schedules_on_scrim_id" |
508 | 532 | t.index ["start_time"], name: "index_schedules_on_start_time" |
509 | 533 | t.index ["status"], name: "index_schedules_on_status" |
510 | 534 | end |
|
730 | 754 | t.datetime "last_login_at", precision: nil |
731 | 755 | t.datetime "created_at", null: false |
732 | 756 | t.datetime "updated_at", null: false |
| 757 | + t.string "supabase_uid" |
733 | 758 | t.index ["email"], name: "index_users_on_email", unique: true |
734 | 759 | t.index ["organization_id"], name: "index_users_on_organization_id" |
735 | 760 | t.index ["role"], name: "index_users_on_role" |
| 761 | + t.index ["supabase_uid"], name: "index_users_on_supabase_uid" |
736 | 762 | end |
737 | 763 |
|
738 | 764 | create_table "vod_reviews", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
|
805 | 831 | add_foreign_key "saved_builds", "users", column: "created_by_id" |
806 | 832 | add_foreign_key "schedules", "matches" |
807 | 833 | add_foreign_key "schedules", "organizations" |
| 834 | + add_foreign_key "schedules", "scrims", on_delete: :cascade |
808 | 835 | add_foreign_key "schedules", "users", column: "created_by_id" |
809 | 836 | add_foreign_key "scouting_watchlists", "organizations" |
810 | 837 | add_foreign_key "scouting_watchlists", "scouting_targets" |
|
0 commit comments