MV framework logo
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Documentation
Download .zip version 3.2.0 from 25.12.2024
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
Documentation
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker

Migrations

Starting with version 2.5, migrations are available in MV. For older versions, you can update the framework and use migrations. You can launch migrations through the console and through the admin panel.

The migrations section in the admin panel is only available for the root user with id=1 and is located in the My settings section in the upper right corner of the admin panel.

MV offers to perform database structure transformations based on the current state of the models, as well as special settings in the $migrations parameter, which can be added to any model.

To check for migrations via Composer, you need to run the command:

composer mv:migrations

Migrations for creating new fields and tables are created automatically. For other types of migrations, you need to add code to the class of the desired model.

class Pages extends Model
{
    ...
    
    protected $migrations = [
        'add_index' => ['active', 'id, active', 'name'],
        'drop_index' => ['parent'],
        'drop_column' => ['title'],
        'rename_column' => ['content' => 'main_content']
    ];
}

Migrations for creating new fields and tables are created automatically. For other types of migrations, you need to add code to the class of the desired model.

Notes

1. New models and fields added to the model class are included in migrations automatically, including additional tables for many-to-many fields.

2. The drop_column and rename_column options are available for the SQLite database only in newer versions of PDO.

3. If a field in the model class was commented out or deleted in the code, it will not be included in the migration for deletion.

4. If a field was deleted via the drop_column option but remains in the model class code, the migration will offer to create it again.

5. For many-to-one fields, migrations will offer to create an index in the opposite model to speed up retrieval.

Previous section

System settings

Next section

Debugging
MV workshop banner
MV tracker

© 2014-2025, MV framework team

MV tracker project Github