practical-tutorials / practical-tutorials/project-based-learning
Script SQL para crear esquema de base de datos financiera (Opción A)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 284k
- Forks
- 36.3k
- PR merge metrics
- No merged PRs in 30d
Description
Descripción
Crear un script SQL que defina el esquema inicial de la base de datos para un sistema de finanzas personales. Este sistema permitirá registrar transacciones, presupuestos, metas de ahorro y (opcionalmente) usuarios y cuentas. El esquema debe ser compatible con MySQL y cubrir el MVP de la aplicación.
Tablas requeridas:
transactions: registro de ingresos/gastos, categorías y descripción.budgets: presupuestos por categoría y periodo.savings_goals: metas de ahorro con estado.- (Opcional:
accountspara soportar varias cuentas o wallets)
Debe incluir claves primarias, tipos de datos adecuados y referencias entre tablas donde aplique.
Why
- Permite que el backend almacene y consulte los datos financieros de forma estructurada.
- Facilita la generación de reportes “fin de mes”, seguimiento de objetivos y visualización de gastos/ingresos.
- Es fundamental para el funcionamiento de toda la app y para poder avanzar hacia la integración con frontend y generación de reportes.
Possible Implementation & Open Questions
Script SQL sugerido:
CREATE TABLE accounts (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
currency VARCHAR(10) DEFAULT 'MXN',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
account_id INT DEFAULT NULL,
type ENUM('income','expense') NOT NULL,
amount DECIMAL(12,2) NOT NULL,
category VARCHAR(100),
description TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(account_id) REFERENCES accounts(id) ON DELETE SET NULL
);
CREATE TABLE budgets (
id INT AUTO_INCREMENT PRIMARY KEY,
account_id INT DEFAULT NULL,
category VARCHAR(100) NOT NULL,
limit_amount DECIMAL(12,2) NOT NULL,
period ENUM('monthly','weekly','yearly') NOT NULL DEFAULT 'monthly',
start_date DATE DEFAULT NULL,
end_date DATE DEFAULT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(account_id) REFERENCES accounts(id) ON DELETE SET NULL
);
CREATE TABLE savings_goals (
id INT AUTO_INCREMENT PRIMARY KEY,
account_id INT DEFAULT NULL,
name VARCHAR(100) NOT NULL,
target_amount DECIMAL(12,2) NOT NULL,
saved_amount DECIMAL(12,2) DEFAULT 0.0,
icon VARCHAR(50),
target_date DATE DEFAULT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(account_id) REFERENCES accounts(id) ON DELETE SET NULL
);
Preguntas abiertas:
- ¿Es necesario soportar múltiples usuarios o es solo para uso personal? (si sí, agregar tabla users y relación con cuentas)
- ¿Se requiere historial de modificaciones (audit trail)?
- ¿Se usarán categorías predefinidas o personalizables?
Is this something you're interested in working on?
- YES
- NO
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed MySQL schema in the issue and resolving the open questions about users, audit history, and category ownership. Done means a MySQL-compatible SQL script defines the required transactions, budgets, and savings_goals tables with suitable keys, types, and references, plus accounts if selected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100