Skip to main content
ElCoco ships with nine migrations that create the full database schema from scratch. Run them in order with a single Artisan command.

Running migrations

php artisan migrate
Applies all pending migrations in chronological order.

Migration files

All migration files live in database/migrations/. They are listed below in the order Laravel applies them (filename prefix determines execution order).

0001_01_01_000000_create_users_table

Creates: users, password_reset_tokens, sessions The foundational authentication tables generated by Laravel Breeze. One migration file creates three tables:
  • users — stores admin accounts (name, email, bcrypt password, email verification timestamp, remember token).
  • password_reset_tokens — ephemeral tokens for the forgot-password flow, keyed by email.
  • sessions — database-backed session storage (user_id, ip_address, user_agent, payload, last_activity).

0001_01_01_000001_create_cache_table

Creates: cache, cache_locks Required when CACHE_STORE=database (the default). Stores cached values and distributed lock records.
ColumnTypeNotes
keyvarcharPrimary key
valuemediumtextSerialised cache payload
expirationintUnix timestamp
cache_locks has the same structure and is used by Laravel’s atomic lock primitives.

0001_01_01_000002_create_jobs_table

Creates: jobs, job_batches, failed_jobs Required when QUEUE_CONNECTION=database (the default). Three tables handle the full job lifecycle:
  • jobs — pending jobs (queue name, payload, attempt count, reserved/available timestamps).
  • job_batches — metadata for Bus::batch() grouped dispatches (total, pending, failed job counts).
  • failed_jobs — permanent record of failed jobs with their full exception trace for debugging.

2025_12_09_024943_create_personal_access_tokens_table

Creates: personal_access_tokens Required by Laravel Sanctum for API token authentication. Uses a polymorphic tokenable morph pair so any Eloquent model can issue tokens.
ColumnTypeNotes
idbigintPrimary key
tokenable_typevarcharMorph type
tokenable_idbigintMorph ID
nametextToken label
tokenvarchar(64)Hashed token value, unique
abilitiestextNullable. JSON-encoded permission list
last_used_attimestampNullable
expires_attimestampNullable, indexed

2026_02_22_create_quote_block_categories_table

Creates: quote_block_categories The first ElCoco domain migration. Establishes the category hierarchy for organising service blocks.
ColumnTypeDefaultNotes
idbigint unsignedAuto-increment PK
namevarchar(255)Category display name
descriptiontextnullOptional description
is_activetinyint(1)1Visibility flag
orderint0Sort position
created_attimestamp
updated_attimestamp

2026_03_01_create_quote_blocks_table

Creates: quote_blocks Individual service items that clients select in the builder. References quote_block_categories with a cascade-on-delete foreign key.
ColumnTypeDefaultNotes
idbigint unsignedAuto-increment PK
namevarchar(255)Block name
descriptiontextnullOptional
category_idbigint unsignedFK → quote_block_categories.id (cascade)
base_pricedecimal(10,2)0.00Unit price
default_hoursint0Estimated hours
configjsonnullKey-value extras array
formulatextnullReserved (not yet used)
validation_rulesjsonnullReserved (not yet used)
is_activetinyint(1)1Visibility flag
orderint0Sort within category
created_attimestamp
updated_attimestamp
Indexes: category_id, is_active, order

2026_03_02_create_quotes_table

Creates: quotes The central quote record. One row is created per client submission (or draft save).
ColumnTypeDefaultNotes
idbigint unsignedAuto-increment PK
referencevarchar(255)Unique. Set by model boot(), not migration
client_namevarchar(255)
client_emailvarchar(255)
client_companyvarchar(255)null
client_phonevarchar(255)null
project_descriptiontextnull
additional_requirementstextnull
datajsonFull builder payload
subtotaldecimal(12,2)
taxdecimal(12,2)
totaldecimal(12,2)
total_hoursint
statusenumdraftdraft, sent, accepted, rejected, expired
sent_attimestampnull
pdf_pathvarchar(255)nullRelative public-disk path
created_attimestamp
updated_attimestamp
Indexes: reference, client_email, status, created_at
The reference column has a unique constraint in the migration but its value is generated at the model layer in Quote::boot(), not by a database default. See Database schema for details.

2026_03_03_201935_create_quotes_item

Creates: quote_items Line items belonging to a quote. One row per block added. Both foreign keys cascade on delete.
ColumnTypeDefaultNotes
idbigint unsignedAuto-increment PK
quote_idbigint unsignedFK → quotes.id (cascade)
quote_block_idbigint unsignedFK → quote_blocks.id (cascade)
namevarchar(255)Snapshot of block name
descriptiontextnullSnapshot of block description
typevarchar(255)Block type (e.g. generic)
quantityint1
hoursint0
unit_pricedecimal(10,2)
total_pricedecimal(10,2)
datajsonnullConfig snapshot
created_attimestamp
updated_attimestamp
Indexes: quote_id, quote_block_id

2026_03_03_201938_create_quote_replies_table

Creates: quote_replies Stores admin replies (meeting confirmations) linked to a quote. Cascade-deletes when the parent quote is deleted.
ColumnTypeNotes
idbigint unsignedAuto-increment PK
quote_idbigint unsignedFK → quotes.id (cascade)
messagetextNullable. Meeting confirmation message
sent_to_emailvarchar(255)Nullable. Recipient email
sent_attimestampScheduled meeting datetime
created_attimestamp
updated_attimestamp

Migration summary

OrderFileTables created
10001_01_01_000000_create_users_tableusers, password_reset_tokens, sessions
20001_01_01_000001_create_cache_tablecache, cache_locks
30001_01_01_000002_create_jobs_tablejobs, job_batches, failed_jobs
42025_12_09_024943_create_personal_access_tokens_tablepersonal_access_tokens
52026_02_22_create_quote_block_categories_tablequote_block_categories
62026_03_01_create_quote_blocks_tablequote_blocks
72026_03_02_create_quotes_tablequotes
82026_03_03_201935_create_quotes_itemquote_items
92026_03_03_201938_create_quote_replies_tablequote_replies

Build docs developers (and LLMs) love