Database Connection
Simple Invoice uses MySQL/MariaDB as its database system. Database configuration is managed through PHP constants defined in the configuration files.Configuration Constants
The database connection parameters are defined inconfig/db.php:
config/db.php
Database server host. Typically
localhost or 127.0.0.1Database username with access to the Simple Invoice database
Database user password
Name of the database to use
Connection Implementation
The actual database connection is established inconfig/conexion.php using MySQLi:
config/conexion.php
Database Schema
Simple Invoice uses a relational database structure with the following core tables:Core Tables
perfil
Company profile and configuration settings
users
System users and authentication
clientes
Customer information
products
Product catalog
facturas
Invoice headers
detalle_factura
Invoice line items
currencies
Supported currencies (32 currencies)
tmp
Temporary session data
Table Relationships
Key Relationships
- facturas → clientes: Each invoice is linked to a customer via
id_cliente - facturas → users: Each invoice is created by a user (seller) via
id_vendedor - facturas → detalle_factura: One-to-many relationship via
numero_factura - detalle_factura → products: Invoice items reference products via
id_producto - perfil → currencies: Company profile uses currency symbol from currencies table
Database Setup
Character Set
The database uses UTF-8 encoding to support international characters:- Default charset:
utf8 - Some tables use:
utf8_unicode_cicollation - Company profile table (
perfil):latin1
Storage Engines
- MyISAM: Used for most tables (clientes, products, facturas, detalle_factura, tmp)
- InnoDB: Used for users, perfil, and currencies tables
Consider migrating all tables to InnoDB for better transaction support and foreign key constraints.
