# Log changes to the database during upgrades

Sitefinity CMS logs all database schema changes applied during the upgrade phase. For example, adding a new column to an existing table: `ALTER TABLE table_name ALTER COLUMN column_name datatype`

The Data Definition Language (DDL) statement for each update is recorded in the `UpgradeTrace.log`. The file is located in the `~\App_Data\Sitefinity\Logs` folder of your project.\
Together with the DDL migration statements, Sitefinity CMS stores additional information that describes the entire database schema migration process in general:

* The complexity of the schema migration:
  * Trivial - contains schema artifacts without influencing the existing schema
  * Extending - contains schema artifacts that extend the existing schema
  * Complex - contains schema artifacts with structural changes
* Types of the schema changes to be applied to the underlying database:
  * Adding new artifacts:

    * Adding columns on an existing tables
    * Adding foreign key constraints to existing tables
    * Adding foreign key constraints to new tables - the create table statement is included as well
    * Adding indices to existing tables
    * Adding indices definition for new tables - the create table statement is included as well
    * Adding new tables
    * Adding structures independent of existing
    * Adding primary key constraints to existing tables
    * Adding primary key constraints to new tables - the create table statement is included as well
  * Modifying existing artifacts:

    * Modifying columns of existing tables
    * Modifying existing structures
  * Removing existing artifacts:

    * Removing columns from existing tables
    * Removing foreign key constraints from existing tables
    * Removing indices from existing tables
    * Removing primary key constraints from existing tables
  * Using temporary tables to migrate data during structural table changes

> success **EXAMPLE**: Following is an example of the contents of the `UpgradeTrace.log` file after a **complex**schema migration:
>
> ```Text
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:34
> Message: Db Migration Complexity: Complex
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:34
> Message: Adding a column(s) on an existing table(s).
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:34
> Message: Modifying a column(s) on an existing table(s).
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:34
> Message: -- add column for field parentTypeId
> ALTER TABLE [sf_meta_types] ADD [parent_type_id] uniqueidentifier NULL
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:34
> Message: -- Column was read from database as: [cultures] varchar(1000) null
> -- modify column for field cultures
> ALTER TABLE [sf_schema_vrsns] ALTER COLUMN [cultures] varchar(2000) NULL
> ----------------------------------------
> ```

> success **EXAMPLE**: Following is an example of the contents of the `UpgradeTrace.log` file after an **extending**schema migration:
>
> ```Text
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:35
> Message: Db Migration Complexity: Extending
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:35
> Message: Adding a column(s) on an existing table(s).
> ----------------------------------------
> ----------------------------------------
> Timestamp: 18/09/2015 12:59:35
> Message: -- add column for field rootTaxonomy
> ALTER TABLE [sf_taxonomies] ADD [root_id] uniqueidentifier NULL
> ----------------------------------------
> ```
