1. Go to this page and download the library: Download mnapoli/dbal-schema library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mnapoli / dbal-schema example snippets
class MySchemaDefinition implements \DbalSchema\SchemaDefinition
{
public function define(Schema $schema)
{
$usersTable = $schema->createTable('users');
$usersTable->addColumn('id', 'integer');
$usersTable->addColumn('email', 'string');
$usersTable->addColumn('lastLogin', 'datetime');
$usersTable->addColumn('score', 'float', [
'notnull' => false,
]);
$usersTable->setPrimaryKey(['id']);
$usersTable->addUniqueIndex(['email']);
}
}
$schema = new MySchemaDefinition();
$dbalConnection = /* your DBAL connection, see http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html */
$command = new DbalSchemaCommand($dbalConnection, $schema);
$application = new Silly\Application();
$application->command('db [--force]', [$command, 'update']);
$application->command('db-purge [--force]', [$command, 'purge']);
$application->run();
use Doctrine\Migrations\DependencyFactory;
use Doctrine\Migrations\Provider\SchemaProvider;
use DbalSchema\DbalSchemaProvider;
$doctrineMigrationDependencyFactory = DependencyFactory::fromConnection(...);
$doctrineMigrationDependencyFactory->setService(SchemaProvider::class, new DbalSchemaProvider(new MySchemaDefinition()));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.