|
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_02_08_200854) do |
| 13 | +ActiveRecord::Schema[7.2].define(version: 2026_02_12_000000) do |
14 | 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 | 15 |
|
24 | 16 | # These are extensions that must be enabled in order to support this database |
25 | | - enable_extension "pg_graphql" |
26 | | - enable_extension "pg_stat_statements" |
27 | 17 | enable_extension "pgcrypto" |
28 | 18 | enable_extension "plpgsql" |
29 | | - enable_extension "supabase_vault" |
30 | | - enable_extension "uuid-ossp" |
31 | 19 |
|
32 | 20 | create_table "audit_logs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
33 | 21 | t.uuid "organization_id", null: false |
|
178 | 166 | t.index ["match_type"], name: "index_matches_on_match_type" |
179 | 167 | t.index ["organization_id", "created_at"], name: "idx_matches_org_created" |
180 | 168 | t.index ["organization_id", "game_start", "victory"], name: "idx_matches_org_game_start_victory", comment: "Otimiza queries de winrate por período" |
181 | | - t.index ["organization_id", "game_start"], name: "idx_matches_org_game_start" |
182 | | - t.index ["organization_id", "game_start"], name: "index_matches_on_org_and_game_start" |
183 | | - t.index ["organization_id", "victory"], name: "idx_matches_org_victory" |
184 | | - t.index ["organization_id", "victory"], name: "index_matches_on_org_and_victory" |
185 | 169 | t.index ["organization_id"], name: "index_matches_on_organization_id" |
186 | 170 | t.index ["riot_match_id"], name: "index_matches_on_riot_match_id", unique: true |
187 | 171 | t.index ["victory"], name: "index_matches_on_victory" |
188 | 172 | end |
189 | 173 |
|
| 174 | + create_table "notifications", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
| 175 | + t.uuid "user_id", null: false |
| 176 | + t.string "title", limit: 200, null: false |
| 177 | + t.text "message", null: false |
| 178 | + t.string "type", null: false |
| 179 | + t.text "link_url" |
| 180 | + t.string "link_type", limit: 20 |
| 181 | + t.uuid "link_id" |
| 182 | + t.boolean "is_read", default: false |
| 183 | + t.datetime "read_at", precision: nil |
| 184 | + t.text "channels", default: ["in_app"], array: true |
| 185 | + t.boolean "email_sent", default: false |
| 186 | + t.boolean "discord_sent", default: false |
| 187 | + t.jsonb "metadata", default: {} |
| 188 | + t.datetime "created_at", null: false |
| 189 | + t.datetime "updated_at", null: false |
| 190 | + t.index ["created_at"], name: "index_notifications_on_created_at", order: :desc |
| 191 | + t.index ["is_read"], name: "index_notifications_on_is_read" |
| 192 | + t.index ["user_id"], name: "index_notifications_on_user_id" |
| 193 | + t.check_constraint "type::text = ANY (ARRAY['info'::character varying, 'success'::character varying, 'warning'::character varying, 'error'::character varying, 'match'::character varying, 'schedule'::character varying, 'system'::character varying]::text[])", name: "notifications_type_check" |
| 194 | + end |
| 195 | + |
190 | 196 | create_table "opponent_teams", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
191 | 197 | t.string "name", null: false |
192 | 198 | t.string "tag" |
|
296 | 302 | t.datetime "updated_at", null: false |
297 | 303 | t.index ["champion"], name: "index_player_match_stats_on_champion" |
298 | 304 | t.index ["match_id", "player_id"], name: "idx_player_stats_match_player_agg", comment: "Otimiza agregações de estatísticas (SUM kills/deaths/assists)" |
299 | | - t.index ["match_id"], name: "idx_player_stats_match" |
300 | | - t.index ["match_id"], name: "index_player_match_stats_on_match" |
301 | | - t.index ["match_id"], name: "index_player_match_stats_on_match_id" |
302 | 305 | t.index ["player_id", "match_id"], name: "index_player_match_stats_on_player_id_and_match_id", unique: true |
303 | 306 | t.index ["player_id"], name: "index_player_match_stats_on_player_id" |
304 | 307 | end |
|
362 | 365 | 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" |
363 | 366 | t.index ["organization_id", "last_sync_at"], name: "idx_players_org_last_sync" |
364 | 367 | t.index ["organization_id", "role"], name: "index_players_on_org_and_role" |
365 | | - t.index ["organization_id", "status"], name: "idx_players_org_status" |
366 | | - t.index ["organization_id", "status"], name: "index_players_on_org_and_status" |
367 | 368 | t.index ["organization_id", "sync_status"], name: "idx_players_org_sync_status" |
368 | 369 | t.index ["organization_id"], name: "index_players_on_organization_id" |
369 | 370 | t.index ["player_access_enabled"], name: "index_players_on_player_access_enabled", comment: "Quick lookup for players with access enabled" |
|
402 | 403 | t.jsonb "metadata", default: {} |
403 | 404 | t.datetime "created_at", null: false |
404 | 405 | t.datetime "updated_at", null: false |
405 | | - t.uuid "scrim_id" |
406 | 406 | t.index ["created_by_id"], name: "index_schedules_on_created_by_id" |
407 | 407 | t.index ["event_type"], name: "index_schedules_on_event_type" |
408 | 408 | t.index ["match_id"], name: "index_schedules_on_match_id" |
409 | 409 | t.index ["organization_id", "event_type"], name: "idx_schedules_org_event_type" |
410 | 410 | t.index ["organization_id", "start_time", "event_type"], name: "idx_schedules_org_time_type", comment: "Otimiza queries de próximos eventos" |
411 | | - t.index ["organization_id", "start_time", "event_type"], name: "index_schedules_on_org_time_type" |
412 | | - t.index ["organization_id", "start_time"], name: "idx_schedules_org_time" |
413 | 411 | t.index ["organization_id"], name: "index_schedules_on_organization_id" |
414 | | - t.index ["scrim_id"], name: "index_schedules_on_scrim_id" |
415 | 412 | t.index ["start_time"], name: "index_schedules_on_start_time" |
416 | 413 | t.index ["status"], name: "index_schedules_on_status" |
417 | 414 | end |
|
609 | 606 | t.index ["category"], name: "index_team_goals_on_category" |
610 | 607 | t.index ["created_by_id"], name: "index_team_goals_on_created_by_id" |
611 | 608 | t.index ["organization_id", "status"], name: "idx_team_goals_org_status", comment: "Otimiza COUNT de goals por status" |
612 | | - t.index ["organization_id", "status"], name: "index_team_goals_on_org_and_status" |
613 | 609 | t.index ["organization_id"], name: "index_team_goals_on_organization_id" |
614 | 610 | t.index ["player_id"], name: "index_team_goals_on_player_id" |
615 | 611 | t.index ["status"], name: "index_team_goals_on_status" |
|
638 | 634 | t.datetime "last_login_at", precision: nil |
639 | 635 | t.datetime "created_at", null: false |
640 | 636 | t.datetime "updated_at", null: false |
641 | | - t.string "supabase_uid" |
642 | 637 | t.index ["email"], name: "index_users_on_email", unique: true |
643 | 638 | t.index ["organization_id"], name: "index_users_on_organization_id" |
644 | 639 | t.index ["role"], name: "index_users_on_role" |
645 | | - t.index ["supabase_uid"], name: "index_users_on_supabase_uid" |
646 | 640 | end |
647 | 641 |
|
648 | 642 | create_table "vod_reviews", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| |
|
702 | 696 | add_foreign_key "draft_plans", "users", column: "created_by_id" |
703 | 697 | add_foreign_key "draft_plans", "users", column: "updated_by_id" |
704 | 698 | add_foreign_key "matches", "organizations" |
| 699 | + add_foreign_key "notifications", "users" |
705 | 700 | add_foreign_key "password_reset_tokens", "users" |
706 | 701 | add_foreign_key "player_match_stats", "matches" |
707 | 702 | add_foreign_key "player_match_stats", "players" |
708 | 703 | add_foreign_key "players", "organizations" |
709 | 704 | add_foreign_key "players", "organizations", column: "previous_organization_id", on_delete: :nullify |
710 | 705 | add_foreign_key "schedules", "matches" |
711 | 706 | add_foreign_key "schedules", "organizations" |
712 | | - add_foreign_key "schedules", "scrims", on_delete: :cascade |
713 | 707 | add_foreign_key "schedules", "users", column: "created_by_id" |
714 | 708 | add_foreign_key "scouting_watchlists", "organizations" |
715 | 709 | add_foreign_key "scouting_watchlists", "scouting_targets" |
|
0 commit comments