Tienda Mi Cholo uses EF Core’s code-first migration system to version-control every schema change. Each migration is a timestamped C# class in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/nuevo-proyecto-viernes/llms.txt
Use this file to discover all available pages before exploring further.
Final_proyecto.Migrations namespace that contains Up() (apply) and Down() (rollback) methods generated by the EF Core tooling. Three migrations bring the database from nothing to the current production schema. The migration history is stored in the __EFMigrationsHistory table that EF Core maintains automatically in TIENDA_MICHOLO.
Always commit migration files to source control alongside the model changes that produced them. Migrations are the authoritative record of how the schema evolved and are required to reproduce the database on any new environment.
Running Migrations
To apply all pending migrations and bring the database up to date:Final proyecto.csproj is located) after cloning the repository or pulling new migration files.
Migration History
Migration 1 — Inicial
Timestamp:20260706200951Class:
Inicial
This is the foundational migration. It creates all seven application tables from scratch, establishes every foreign key constraint and index, and seeds the reference data the application requires before first use.
Migration 2 — AddEstadoToProducto
Timestamp:20260707002811Class:
AddEstadoToProducto
Adds the Estado column to the Productos table so individual products can be marked active or inactive without being deleted.
Change applied:
| Column | Type | Nullable | Default |
|---|---|---|---|
Estado | bit | NOT NULL | false (0) |
The column is added with a default of
false. After applying this migration you should update any existing products to Estado = true if they are intended to be available for sale. The POST /Producto/Nuevo action always sets Estado = true for new products created through the UI.Down): Drops the Estado column from Productos.
Migration 3 — MakeClienteFieldsNullable
Timestamp:20260707011120Class:
MakeClienteFieldsNullable
Makes Correo and Direccion nullable on Clientes, and also makes Descripcion nullable on Productos. This allows client records to be created without an email address or physical address — important for the boleta flow where the sale controller creates client records on the fly with minimal information.
Changes applied:
| Table | Column | Old Type | New Type |
|---|---|---|---|
Clientes | Correo | nvarchar(100) NOT NULL | nvarchar(100) NULL |
Clientes | Direccion | nvarchar(200) NOT NULL | nvarchar(200) NULL |
Productos | Descripcion | nvarchar(200) NOT NULL | nvarchar(200) NULL |
Down): Reverts all three columns to NOT NULL with an empty-string default ("").
Creating New Migrations
After modifying a model class or theAppDbContext, generate a new migration and apply it:
AddTelefonoToUsuario, RenameProductoColumns).