https://github.com/thecoder507/lpf-database
PostgreSQL database for Liga Panameña de Fútbol (LPF), including schema and sample data.
https://github.com/thecoder507/lpf-database
Last synced: 4 months ago
JSON representation
PostgreSQL database for Liga Panameña de Fútbol (LPF), including schema and sample data.
- Host: GitHub
- URL: https://github.com/thecoder507/lpf-database
- Owner: thecoder507
- Created: 2025-09-23T18:48:00.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-24T19:46:03.000Z (9 months ago)
- Last Synced: 2025-10-11T05:54:24.406Z (9 months ago)
- Size: 108 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚽ LPF Database (Liga Panameña de Fútbol)
PostgreSQL database for the Liga Panameña de Fútbol (LPF), with schema, Apertura 2024 sample data, and views for standings and match queries.
---
## 📌 Project Description
This project models the main entities of the LPF, such as:
- Teams (equipos)
- Matches (partidos)
- Stadiums (estadios)
- Conferences (conferencias)
- Phases (fases)
- Seasons (temporadas)
- Tournaments (torneos)
It also includes constraints, indexes, and roles for better performance and security.
---
## 🗂️ Database Schema (ERD)

---
## 📂 Database Contents
The `lpf_database.sql` export includes the following:
### 🗄️ Tables
- **equipos** → Teams information (name, city, stadium, conference, foundation date)
- **partidos** → Matches between teams (date, goals, stadium, phase, type of match)
- **estadios** → Stadium details (name, location, capacity)
- **fases** → Tournament phases (classification, repechaje, semifinal, final)
- **conferencias** → League conferences (East/West)
- **temporadas** → Seasons (year)
- **torneos** → Tournaments linked to seasons (Apertura, Clausura)
### 👀 Views
- **goles_equipo_vista** → Goals scored/conceded per team
- **tabla_posiciones_vista** → Standings (points, wins, draws, losses, GD) by conference
- **partidos_info_vista** → Match details with teams, result, stadium, and phase
### 🔐 Constraints
- Primary keys (`id` in each table)
- Foreign keys (relationships between equipos, conferencias, estadios, torneos, fases, partidos)
- Check constraints (e.g., no negative goals, local team ≠ visiting team)
- Unique constraints (unique team names, stadium names, season year, etc.)
### ⚡ Indexes
- `equipos_nombre_idx` → quick search by team name
- `partidos_equipo_local_id_idx` → filter by home team
- `partidos_equipo_visitante_id_idx` → filter by away team
- `partidos_fase_id_idx` → filter by phase
- `partidos_jornada_idx` → filter by matchday
### 👥 Roles & Permissions
- **readonly** → can only view data
- **readwrite** → can view, insert, update, and delete data
---
## 🚀 How to Import
1. Clone this repository or download the `.sql` file.
2. Create a new database in PostgreSQL (e.g., `lpf`).
3. Import the dump using `psql`:
```bash
psql -U postgres -d lpf -f lpf_database.sql