BEdita4 uses CakePHP Migrations plugin for schema creation and update.
Schema migration files are located in
plugins/BEdita/Core/config/Migrations and they are basically PHP files that describe
database schema evolution.
With simple shell commands you can check migration status and perform schema update. See also db_admin shell command to perform schema check and initialization.
A MySQL schema file, provided for convenience only, is available in
It’s not used anywhere in BEdita but it may be used as a quick reference.
A simple ER diagram is displayed here to give you a glimpse of BEdita4 core schema. Don’t use it as a reference though: we will keep an updated version of this diagram, but some tables or fields may still be missing.
The recommended way to create a schema migration is to use the
In your terminal, run:
$ bin/cake bake resources_migration MigrationsName
This command will generate two files in your config/Migrations folder:
YYYYMMDDHHMMSS_MigrationName.php: this is the file used as reference in the phinxlog
YYYYMMDDHHMMSS_MigrationName.yml: this will contain the real content of the migration
Then, you can use the yaml syntax to describe the migration:
# MigrationName migration
In the following example, we are going to add a property to the
profiles model, as well as a relation with the
# AddAuthorStuff migration
- name: pen_name
- name: author_of
label: Author of
inverse_label: Authored by
description: Author relation