Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OswalSnow/AR-Barber/llms.txt

Use this file to discover all available pages before exploring further.

AR Barbería’s database schema is built incrementally through 10 migration files. Each file is timestamped and run in order, so the schema evolves from the core Laravel skeleton tables through the barbershop-specific domain: appointments, workday schedules, services, and a portfolio image gallery. This page documents every migration and the final state of the key tables.

Running migrations

1

Run all pending migrations

Apply every migration file to your database in chronological order:
php artisan migrate
2

Reset and reseed (development only)

Drop all tables, re-run all migrations, and execute any database seeders. Use this to start fresh during development:
php artisan migrate:fresh --seed
migrate:fresh destroys all data in the database. Never run it against a production database.

Migration history

The table below lists every migration file, the table it affects, and the columns or changes it introduces.
Migration fileTable(s) affectedKey columns / changes
0001_01_01_000000_create_users_tableusers, password_reset_tokens, sessionsusers: id, name, email, password, remember_token, timestamps. sessions: id, user_id, payload, last_activity.
0001_01_01_000001_create_cache_tablecache, cache_lockscache: key, value, expiration.
0001_01_01_000002_create_jobs_tablejobs, job_batches, failed_jobsjobs: id, queue, payload, attempts, reserved_at. failed_jobs: uuid, connection, queue, payload, exception, failed_at.
2026_03_09_233705_create_appointments_tableappointmentsid, customer_name, customer_phone, starts_at, user_id, status (enum: pending/completed/cancelled), timestamps.
2026_03_09_233715_create_workdays_tableworkdaysid, user_id, day, is_open, start_time, end_time, timestamps.
2026_04_10_044043_add_ends_at_to_appointments_tableappointmentsAdds servicio string column (default 'corte') and ends_at datetime column (nullable).
2026_05_23_192320_add_soft_deletes_to_appointments_tableappointmentsAdds deleted_at column (soft deletes).
2026_05_23_194007_create_services_tableservicesid, name, duration_minutes, timestamps.
2026_05_23_194108_create_appointment_service_tableappointment_serviceid, appointment_id (FK → appointments), service_id (FK → services). Cascade delete on both FKs.
2026_05_24_002851_create_portfolio_images_tableportfolio_imagesid, path, timestamps.

Schema evolution of the appointments table

The appointments table grew through three separate migrations as requirements expanded:
1

Initial creation (March 2026)

The first migration created the core booking record with customer_name, customer_phone, starts_at, user_id (the assigned barber), and status (an enum of pending, completed, cancelled).At this point the appointment had a start time but no end time, no service field, and no mechanism for tracking cancellations without deleting the row.
2

Service type and end time added (April 2026)

A second migration added both servicio (a string column for the service type, defaulting to 'corte') and ends_at (a nullable datetime). This allowed the booking form to capture which service was requested and enabled the calendar to display appointment blocks with a real duration and prevent double-booking by querying the starts_at/ends_at range.
3

Soft deletes added (May 2026)

Adding deleted_at enables soft deletes via Laravel’s SoftDeletes trait. Cancelled appointments are no longer removed from the database — they are hidden from normal queries but can be restored or audited later.
The servicio column (plain text) predates the services table. The appointment_service pivot table introduced in May 2026 is the foundation for migrating to a structured service catalog. Both columns may coexist during a transition period.

The appointment_service pivot table

appointment_service is a many-to-many join table between appointments and services. It allows a single appointment to include multiple services (for example, a haircut and a beard trim), and allows the services table to track a standard catalog with per-service duration_minutes. This pivot replaces the legacy free-text servicio column as the canonical source of service data.

Final schema: key tables

appointments

ColumnTypeNotes
idbigint, PKAuto-increment.
customer_namestringName provided during booking.
customer_phonestringPhone number for reminders.
serviciostringLegacy plain-text service label.
starts_atdatetimeAppointment start time.
ends_atdatetimeAppointment end time (added April 2026).
user_idbigint, FKReferences users.id (the barber).
statusenumBooking status. Allowed values: pending, completed, cancelled. Default: pending.
deleted_atdatetime, nullableSoft delete timestamp (added May 2026).
created_at / updated_attimestampsStandard Laravel timestamps.

workdays

ColumnTypeNotes
idbigint, PKAuto-increment.
user_idbigint, FKReferences users.id (the barber).
daydateCalendar date this record applies to (YYYY-MM-DD).
is_openbooleanWhether the barber accepts bookings on this day.
start_timetimeOpening time for the workday.
end_timetimeClosing time for the workday.
created_at / updated_attimestampsStandard Laravel timestamps.

users

ColumnTypeNotes
idbigint, PKAuto-increment.
namestringDisplay name.
emailstring, uniqueLogin credential.
passwordstringHashed password.
remember_tokenstring, nullablePersistent login token.
created_at / updated_attimestampsStandard Laravel timestamps.

Build docs developers (and LLMs) love