FYP database
  • Perl 99%
  • Shell 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-14 14:02:37 +00:00
docs add AI generated docs to the procedures API 2026-05-12 12:14:17 +03:00
migrations fix Dormant competition not selected 2026-05-14 15:04:37 +03:00
tests add club tests 2026-04-10 23:47:15 +03:00
.gitignore added - build script 2026-02-26 00:07:21 +02:00
.sqlfluff add - sqlfluff config 2026-02-02 17:53:54 +02:00
db_build Reapply "fixed minor typos" 2026-03-19 02:45:23 +02:00
db_clean made db_clean executable 2026-03-23 13:02:03 +02:00
db_run Added - db_run 2026-02-26 00:32:27 +02:00
readme.md merged AI generated docs to the main readme 2026-05-12 12:20:26 +03:00

LTA DATABASE

build instruction

First create a database

CREATE DATABASE lta;

Then create a user

CREATE USER 'ltadev'@'localhost' IDENTIFIED BY '';

Grant database ownership to the new user

GRANT ALL PRIVILEGES ON lta.* TO 'ltadev'@'localhost' WITH GRANT OPTION;

Run the build script

LTA_DB_NAME=lta LTA_DB_USER=ltadev ./db_build

Run a migration

LTA_DB_NAME=lta LTA_DB_USER=ltadev ./db_run 069 

Clear the DB

DROP DATABASE lta; CREATE DATABASE lta;

MySQL Stored Procedure API — Documentation Index

⚠️ Note: This documentation was generated by an AI assistant based on the stored procedure source code. Please verify details before use in production.


Overview

This documentation describes the MySQL stored procedure API for a sports club management system. Procedures are grouped by domain and documented in the style of a RESTful API reference.


Modules

Module Description
Authentication User signup, login, token issuance/validation, secrets
Users User account management, roles, and statuses
Clubs Club creation, retrieval, coach assignment, and deletion
Players Player registration, transfers, updates, and removal
Competitions Competition lifecycle, team enrollment, and standings
Matches Match creation, rosters, scoring, tries, referees, and stadiums

Common Conventions

OUT Parameters

Several procedures use MySQL OUT parameters to return generated IDs. Callers must declare session variables before calling:

CALL insert_player('John', 'Doe', '2000-01-01', 'M', '12345678', @playerid);
SELECT @playerid;

Status & Role Names

Statuses and roles are stored by name in lookup tables and resolved internally. Commonly used values:

User statuses: 'Actif', 'Waiting Approval', 'Deleted'
Club statuses: 'Actif', 'Deleted'
Player statuses: 'Actif', 'Deleted'
Competition statuses: 'Actif', 'Deleted'

⚠️ Status name lookups are case-sensitive in several procedures. Ensure data in lookup tables is consistent.

Error Handling

Procedures that perform validation raise errors using MySQL's SIGNAL mechanism:

SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'error description';

Callers should handle these using application-level try/catch or MySQL DECLARE HANDLER blocks.

Token Security

Tokens are stored as UNHEX(SHA2(token, 256)) — raw token strings are never stored. The caller is responsible for providing sufficiently random token values and for hashing passwords before passing them to insert_user / signup_user.