Download the PHP package openstore/schema-core without Composer
On this page you can find all versions of the php package openstore/schema-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package schema-core
Openstore Schema Core
openstore-schema-core provides a basic database schema used in the openstore project. It consists of around 80 tables specifically designed to deal with an online catalog.
Disclaimer: this is a work-in-progress !
Warning: the
openstore-schema-core
project relies on doctrine2 to facilitate schema generation. No work have been done to make entities useful through doctrine as openstore usezend-db
for database access. In other words, schema generation works well but there's work to do if you need using doctrine for data access (fix naming of relationship, make repositories...).
Requirements
- PHP 7.1+
- MySQL or MariaDB with InnoDB
Features
- [x] Automatic schema generation from doctrine entities.
- [x] Support for painless schema migrations.
- [x] Provides special triggers, procedures and functions (see extras).
- [x] Raw sql generation. (see generated sql)
Install
Clone the project
Alternatively you can install the project through composer composer require openstore/schema-core
Setup
Configuration
Make a copy of the distribution config file and edit your database parameters:
Database
First ensure your database server is supported and enable support for utf8mb4
charset.
Database | Storage engine | File format | Large prefix |
---|---|---|---|
MySQL 5.6+ | INNODB engine | Barracuda | On |
Mariadb 10+ | INNODB/XTRADB | Barracuda | On |
Note: to be able to work with
utf8mb4
check that the following parameters are present in the mysql configuration file (my.cnf
):
- [x]
innodb_file_per_table=1
- [x]
innodb_file_format=barracuda
(default for MariaDb 10.2.2+, removed in 10.3)- [x]
innodb_large_prefix=1
(default for Mariadb 10.2.2+, removed in 10.3)
Then create a new database:
Commands
You can list the registered commands by executing:
Practically, use the following commands for:
Command | Description |
---|---|
openstore:schema:create |
Create a schema on a new empty database. |
openstore:schema:recreate-extra |
Recreate all triggers, procedures, functions... |
openstore:schema:update |
Apply schema migration on an existing database. |
NOTE: use the option
--dump-sql
to display the DDL instead of applying onto the database. This is particularly useful to show migration needed over a production database, for example:Will show the migrations that have to be applied on the current database.
FAQ
Caution: backup and restore recipes described below have not been for real production usage. Always be sure of what you're doing.
Backup a database
With mysqldump
, good to backup schema
(ddl) and data
(inserts) in separated files, it
allows to restore the data on a fresh database. As an example:
Restore data on an newly created schema
First perform a backup with mysqldump
as illustrated above, then create a new schema:
Move/rename database
After having restored the database in the new schema, you might want to move/rename it.
For development or small database, you can use mysqldump
:
You can also (unix)-pipe the two last commands
Future
- [ ] Start working on repositories.
- [ ] Document tables and conventions.
- [ ] Add doctrine validate to CI (fix wrong relations names).
Notes
Unicode
From version 0.40.0, openstore-schema-core
defaults to utf8mb4
charset by default.
If you don't have the possibility to set mysql server variables (i.e. on a continuous integration server...) you can fall back to the generated compatibility scripts.
Compressing tables
Optional, to reduce disk usage you can change the compression format of the following tables:
Contributing
Contributions are welcome, fork the repository and make a pull request.
Tips for contributors
Be sure to execute code style check before commit:
You can also fix the code style issues automatically:
Don't forget to regenerate regenerate the sql doc:
All versions of schema-core with dependencies
doctrine/dbal Version ^2.9.2
doctrine/common Version ^2.10
doctrine/orm Version ^2.6.3
gedmo/doctrine-extensions Version ^2.4.36
doctrine/data-fixtures Version ^1.2.2
symfony/console Version ~3.0|~4.0