From bf315949f8511f07cfda25e1cd88937b6b0801a0 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Sat, 24 Nov 2018 22:22:28 -0600 Subject: [PATCH 1/4] Upgrade Symfony Console. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0c22a90..425d495 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "byjg/anydataset-db": "4.0.*", "byjg/uri": "^1.0", - "symfony/console": "^3.1" + "symfony/console": "^4.0" }, "require-dev": { "phpunit/phpunit": ">=5.7" From a2fc73611ae28f25093fa5b0cae952a773d9f1ca Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Mon, 26 Nov 2018 00:26:36 -0600 Subject: [PATCH 2/4] Splitting Database Migration and Database Migration Cli into different projects. --- README.md | 170 +++++++++---------------- composer.json | 3 +- scripts/migrate | 23 ---- src/Console/ConsoleCommand.php | 129 ------------------- src/Console/CreateCommand.php | 83 ------------ src/Console/DatabaseVersionCommand.php | 30 ----- src/Console/DownCommand.php | 44 ------- src/Console/InstallCommand.php | 50 -------- src/Console/ResetCommand.php | 61 --------- src/Console/UpCommand.php | 44 ------- src/Console/UpdateCommand.php | 46 ------- 11 files changed, 61 insertions(+), 622 deletions(-) delete mode 100755 scripts/migrate delete mode 100644 src/Console/ConsoleCommand.php delete mode 100644 src/Console/CreateCommand.php delete mode 100644 src/Console/DatabaseVersionCommand.php delete mode 100644 src/Console/DownCommand.php delete mode 100644 src/Console/InstallCommand.php delete mode 100644 src/Console/ResetCommand.php delete mode 100644 src/Console/UpCommand.php delete mode 100644 src/Console/UpdateCommand.php diff --git a/README.md b/README.md index fb0b9d5..78ee4ac 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,24 @@ Because of that this is an agnostic project (independent of framework and Progra ## Installing +### PHP Library + +If you want to use only the PHP Library in your project: + ``` composer require 'byjg/migration=4.0.*' ``` +### Command Line Interface + +The command line interface is standalone and does not require you install with your project. + +You can install global and create a symbolic lynk + +``` +composer require 'byjg/migration-cli=4.0.*' +``` + +Please visit https://github.com/byjg/migration-cli to get more informations about Migration CLI. ## Supported databases: @@ -102,114 +117,8 @@ If he is try to migrate UP or DOWN the migration script will down and alert him there a TWO versions 43. In that case, developer 2 will have to update your file do 44-dev.sql and continue to work until merge your changes and generate a final version. -### Running in the command line - -Migration library creates the 'migrate' script. It has the follow syntax: - -``` -Usage: - command [options] [arguments] - -Options: - -h, --help Display this help message - -q, --quiet Do not output any message - -V, --version Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - -n, --no-interaction Do not ask any interactive question - -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - -Available commands: - create Create the directory structure FROM a pre-existing database - down Migrate down the database version. - help Displays help for a command - install Install or upgrade the migrate version in a existing database - list Lists commands - reset Create a fresh new database - up Migrate Up the database version - update Migrate Up or Down the database version based on the current database version and the migration scripts available - version Get the current database version -``` - -#### Commands - -##### Basic Usage - -The basic usage is: - -```text -migrate --path= uri://connection -``` - -The `--path` specify where the base.sql and migrate scripts are located. -If you omitted the `--path` it will assume the current directory. You can also -set the `MIGRATE_PATH` environment variable with the base path - -The uri://connection is the uri that represents the connection to the database. -You can see [here](https://github.com/byjg/anydataset#connection-based-on-uri) -to know more about the connection string. - -You can omit the uri parameter if you define it in the -`MIGRATE_CONNECTION` environment variable - -```bash -export MIGRATE_CONNECTION=sqlite:///path/to/my.db -``` - -##### Command: create - -Create a empty directory structure with base.sql and migrations/up and migrations/down for migrations. This is -useful for create from scratch a migration scheme. - -Ex. - -```bash -migrate create /path/to/sql -``` - -##### Command: install - -If you already have a database but it is not controlled by the migration system you can use this method for -install the required tables for migration. - -```bash -migrate install mysql://server/database -``` - -##### Command: update - -Will apply all necessary migrations to keep your database updated. - -```bash -migrate update mysql://server/database -``` - -Update command can choose if up or down your database depending on your current database version. -You can also specify a version: -```bash -migrate update --up-to=34 -``` - -##### Command: reset - -Creates/replace a database with the "base.sql" and apply ALL migrations - -```bash -migrate reset # reset the database and apply all migrations scripts. -migrate reset --up-to=5 # reset the database and apply the migration from the - # start up to the version 5. -migrate reset --yes # reset the database without ask anything. Be careful!! -``` - -**Note on reset:** You can disable the reset command by setting the environment variable -`MIGRATE_DISABLE_RESET` to true: - -```bash -export MIGRATE_DISABLE_RESET=true -``` - -### Using the PHP API and Integrate it into your projects. +## Using the PHP API and Integrate it into your projects. The basic usage is @@ -236,14 +145,55 @@ $migration->registerDatabase('maria', \ByJG\DbMigration\Database\MySqlDatabase:: // and run ALL existing scripts for up the database version to the latest version $migration->reset(); -// Run ALL existing scripts for up the database version -// from the current version to the last version; -$migration->up(); +// Run ALL existing scripts for up or down the database version +// from the current version until the $version number; +// If the version number is not specified migrate until the last database version +$migration->update($version = null); ``` The Migration object controls the database version. +### Creating a version control in your project: + +```php +registerDatabase('mysql', \ByJG\DbMigration\Database\MySqlDatabase::class); + +// This command will create the version table in your database +$migration->createVersion(); +``` + +### Getting the current version + +```php +getCurrentVersion(); +``` + +### Add Callback to control the progress + +```php +addCallbackProgress(function ($command, $version) { + echo "Doing Command: $command at version $version"; +}); +``` + +### Getting the Db Driver instance + +```php +getDbDriver(); +``` + +To use it, please visit: https://github.com/byjg/anydataset-db + + ### Tips on writing SQL migrations #### Rely on explicit transactions diff --git a/composer.json b/composer.json index 425d495..481a0b8 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,7 @@ "prefer-stable": true, "require": { "byjg/anydataset-db": "4.0.*", - "byjg/uri": "^1.0", - "symfony/console": "^4.0" + "byjg/uri": "^1.0" }, "require-dev": { "phpunit/phpunit": ">=5.7" diff --git a/scripts/migrate b/scripts/migrate deleted file mode 100755 index d1f9b4d..0000000 --- a/scripts/migrate +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env php -add(new \ByJG\DbMigration\Console\ResetCommand()); -$application->add(new \ByJG\DbMigration\Console\UpCommand()); -$application->add(new \ByJG\DbMigration\Console\DownCommand()); -$application->add(new \ByJG\DbMigration\Console\CreateCommand()); -$application->add(new \ByJG\DbMigration\Console\DatabaseVersionCommand()); -$application->add(new \ByJG\DbMigration\Console\InstallCommand()); -$application->add(new \ByJG\DbMigration\Console\UpdateCommand()); -$application->run(); diff --git a/src/Console/ConsoleCommand.php b/src/Console/ConsoleCommand.php deleted file mode 100644 index 310faac..0000000 --- a/src/Console/ConsoleCommand.php +++ /dev/null @@ -1,129 +0,0 @@ -addArgument( - 'connection', - InputArgument::OPTIONAL, - 'The connection string. Ex. mysql://root:password@server/database', - getenv('MIGRATE_CONNECTION') - ) - ->addOption( - 'path', - 'p', - InputOption::VALUE_REQUIRED, - 'Define the path where the base.sql resides. If not set assumes the current folder' - ) - ->addOption( - 'up-to', - 'u', - InputOption::VALUE_REQUIRED, - 'Run up to the specified version' - ) - ->addOption( - 'no-base', - null, - InputOption::VALUE_NONE, - 'Remove the check for base.sql file' - ) - ->addUsage('') - ->addUsage('Example: ') - ->addUsage(' migrate reset mysql://root:password@server/database') - ->addUsage(' migrate up mysql://root:password@server/database') - ->addUsage(' migrate down mysql://root:password@server/database') - ->addUsage(' migrate up --up-to=10 --path=/somepath mysql://root:password@server/database') - ->addUsage(' migrate down --up-to=3 --path=/somepath mysql://root:password@server/database') - ; - } - - /** - * @var Migration - */ - protected $migration; - - protected $upTo; - - protected $connection; - - protected $path; - - /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @throws \ByJG\DbMigration\Exception\InvalidMigrationFile - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - $this->connection = $input->getArgument('connection'); - if (!$this->connection) { - throw new InvalidArgumentException( - 'You need to setup the connection in the argument or setting the environment MIGRATE_CONNECTION' - ); - } - - $this->path = $input->getOption('path'); - if (!$this->path) { - $this->path = (!empty(getenv('MIGRATE_PATH')) ? getenv('MIGRATE_PATH') : "."); - } - $this->path = realpath($this->path); - - $this->upTo = $input->getOption('up-to'); - - $requiredBase = !$input->getOption('no-base'); - - $migrationTable = (empty(getenv('MIGRATE_TABLE')) ? "migration_version" : getenv('MIGRATE_TABLE')); - $this->path = realpath($this->path); - $uri = new Uri($this->connection); - $this->migration = new Migration($uri, $this->path, $requiredBase, $migrationTable); - $this->migration - ->registerDatabase('sqlite', SqliteDatabase::class) - ->registerDatabase('mysql', MySqlDatabase::class) - ->registerDatabase('pgsql', PgsqlDatabase::class) - ->registerDatabase('dblib', DblibDatabase::class); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln('Connection String: ' . $this->connection); - $output->writeln('Path: ' . $this->path); - } - - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) { - $this->migration->addCallbackProgress(function ($command, $version) use ($output) { - $output->writeln('Doing: ' . $command . " to " . $version); - }); - } - } - - /** - * @param \Exception|\Error $exception - * @param \Symfony\Component\Console\Output\OutputInterface $output - */ - protected function handleError($exception, OutputInterface $output) - { - $output->writeln('-- Error migrating tables --'); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln(get_class($exception)); - $output->writeln($exception->getMessage()); - } - } -} diff --git a/src/Console/CreateCommand.php b/src/Console/CreateCommand.php deleted file mode 100644 index bea94d0..0000000 --- a/src/Console/CreateCommand.php +++ /dev/null @@ -1,83 +0,0 @@ -setName('create') - ->setDescription('Create the directory structure FROM a pre-existing database') - ->addArgument( - 'path', - InputArgument::REQUIRED, - 'Define the path where the base.sql resides. If not set assumes the current folder' - ) - ->addOption( - 'migration', - 'm', - InputOption::VALUE_NONE, - 'Create the migration script (Up and Down)' - ) - ->addUsage('') - ->addUsage('Example: ') - ->addUsage(' migrate create --path /path/to/strcuture') - ->addUsage(' migrate create --path /path/to/strcuture --migration ') - ; - } - - protected function initialize(InputInterface $input, OutputInterface $output) - { - } - - protected function createMigrationSql($path, $startVersion) - { - $files = glob("$path/*.sql"); - $lastVersion = $startVersion; - foreach ($files as $file) { - $version = intval(basename($file)); - if ($version > $lastVersion) { - $lastVersion = $version; - } - } - - $lastVersion = $lastVersion + 1; - - file_put_contents( - "$path/" . str_pad($lastVersion, 5, '0', STR_PAD_LEFT) . ".sql", - "-- Migrate to Version $lastVersion \n\n" - ); - - return $lastVersion; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $path = $input->getArgument('path'); - if (!file_exists($path)) { - mkdir($path, 0777, true); - } - - if (!file_exists("$path/base.sql")) { - file_put_contents("$path/base.sql", "-- Put here your base SQL"); - } - - if (!file_exists("$path/migrations")) { - mkdir("$path/migrations", 0777, true); - mkdir("$path/migrations/up", 0777, true); - mkdir("$path/migrations/down", 0777, true); - } - - if ($input->hasOption('migration')) { - $output->writeln('Created UP version: ' . $this->createMigrationSql("$path/migrations/up", 0)); - $output->writeln('Created DOWN version: ' . $this->createMigrationSql("$path/migrations/down", -1)); - } - } -} diff --git a/src/Console/DatabaseVersionCommand.php b/src/Console/DatabaseVersionCommand.php deleted file mode 100644 index 51afa92..0000000 --- a/src/Console/DatabaseVersionCommand.php +++ /dev/null @@ -1,30 +0,0 @@ -setName('version') - ->setDescription('Get the current database version'); - - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - parent::execute($input, $output); - try { - $versionInfo = $this->migration->getCurrentVersion(); - $output->writeln('version: ' . $versionInfo['version']); - $output->writeln('status.: ' . $versionInfo['status']); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} diff --git a/src/Console/DownCommand.php b/src/Console/DownCommand.php deleted file mode 100644 index aaa5ae3..0000000 --- a/src/Console/DownCommand.php +++ /dev/null @@ -1,44 +0,0 @@ -setName('down') - ->setDescription('Migrate down the database version.'); - - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - try { - $versionInfo = $this->migration->getCurrentVersion(); - if (strpos($versionInfo['status'], 'partial') !== false) { - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion( - 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N)', - false - ); - - if (!$helper->ask($input, $output, $question)) { - $output->writeln('Aborted.'); - - return; - } - } - - parent::execute($input, $output); - $this->migration->down($this->upTo, true); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php deleted file mode 100644 index cfffec5..0000000 --- a/src/Console/InstallCommand.php +++ /dev/null @@ -1,50 +0,0 @@ -setName('install') - ->setDescription('Install or upgrade the migrate version in a existing database'); - - } - - /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int|null|void - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - try { - parent::execute($input, $output); - - $action = 'Database is already versioned. '; - try { - $this->migration->getCurrentVersion(); - } catch (DatabaseNotVersionedException $ex) { - $action = 'Created the version table'; - $this->migration->createVersion(); - } catch (OldVersionSchemaException $ex) { - $action = 'Updated the version table'; - $this->migration->updateTableVersion(); - } - - $version = $this->migration->getCurrentVersion(); - $output->writeln($action); - $output->writeln('current version: ' . $version['version']); - $output->writeln('current status.: ' . $version['status']); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} diff --git a/src/Console/ResetCommand.php b/src/Console/ResetCommand.php deleted file mode 100644 index b3d3f49..0000000 --- a/src/Console/ResetCommand.php +++ /dev/null @@ -1,61 +0,0 @@ -setName('reset') - ->setDescription('Create a fresh new database') - ->addOption( - 'yes', - null, - InputOption::VALUE_NONE, - 'Answer yes to any interactive question' - ); - } - - /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int|null|void - * @throws \ByJG\DbMigration\Exception\ResetDisabledException - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - if (getenv('MIGRATE_DISABLE_RESET') === "true") { - throw new ResetDisabledException('Reset was disabled by MIGRATE_DISABLE_RESET environment variable. Cannot continue.'); - } - - try { - $helper = $this->getHelper('question'); - if (!$input->getOption('yes')) { - $question = new ConfirmationQuestion( - 'This will ERASE all of data in your data. Continue with this action? (y/N) ', - false - ); - - if (!$helper->ask($input, $output, $question)) { - $output->writeln('Aborted.'); - - return; - } - } - - parent::execute($input, $output); - $this->migration->prepareEnvironment(); - $this->migration->reset($this->upTo); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} diff --git a/src/Console/UpCommand.php b/src/Console/UpCommand.php deleted file mode 100644 index e7ad6bf..0000000 --- a/src/Console/UpCommand.php +++ /dev/null @@ -1,44 +0,0 @@ -setName('up') - ->setDescription('Migrate Up the database version'); - - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - try { - $versionInfo = $this->migration->getCurrentVersion(); - if (strpos($versionInfo['status'], 'partial') !== false) { - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion( - 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N) ', - false - ); - - if (!$helper->ask($input, $output, $question)) { - $output->writeln('Aborted.'); - - return; - } - } - - parent::execute($input, $output); - $this->migration->up($this->upTo, true); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} diff --git a/src/Console/UpdateCommand.php b/src/Console/UpdateCommand.php deleted file mode 100644 index c0636bf..0000000 --- a/src/Console/UpdateCommand.php +++ /dev/null @@ -1,46 +0,0 @@ -setName('update') - ->setDescription('Migrate Up or Down the database version based on the current database version and the ' . - 'migration scripts available' - ); - - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - try { - $versionInfo = $this->migration->getCurrentVersion(); - if (strpos($versionInfo['status'], 'partial') !== false) { - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion( - 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N) ', - false - ); - - if (!$helper->ask($input, $output, $question)) { - $output->writeln('Aborted.'); - - return; - } - } - - parent::execute($input, $output); - $this->migration->update($this->upTo, true); - } catch (\Exception $ex) { - $this->handleError($ex, $output); - } - } -} From de7f33ddd0b71440b28ebccbe232449a690f2ec1 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Mon, 26 Nov 2018 00:33:19 -0600 Subject: [PATCH 3/4] Update composer.json --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 481a0b8..c4798aa 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,5 @@ "ByJG\\DbMigration\\": "src/" } }, - "bin": [ - "scripts/migrate" - ], "license": "MIT" } From 66f82bf7b0ef593902fe2563bd7d11871a86958e Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Wed, 28 Nov 2018 22:38:17 -0600 Subject: [PATCH 4/4] Add opensource.byjg.com github page --- README.md | 48 ++++++++++++++++++++++++------------------------ _config.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 _config.yml diff --git a/README.md b/README.md index 78ee4ac..bb27556 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Database Migrations +# Database Migrations PHP [![Opensource ByJG](https://img.shields.io/badge/opensource-byjg.com-brightgreen.svg)](http://opensource.byjg.com) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/byjg/migration/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/byjg/migration/?branch=master) @@ -27,16 +27,16 @@ But at the end despite these good features the reality in big projects someone w Because of that this is an agnostic project (independent of framework and Programming Language) and use pure and native SQL commands for migrate your database. -## Installing +# Installing -### PHP Library +## PHP Library If you want to use only the PHP Library in your project: ``` composer require 'byjg/migration=4.0.*' ``` -### Command Line Interface +## Command Line Interface The command line interface is standalone and does not require you install with your project. @@ -48,14 +48,14 @@ composer require 'byjg/migration-cli=4.0.*' Please visit https://github.com/byjg/migration-cli to get more informations about Migration CLI. -## Supported databases: +# Supported databases: * Sqlite * Mysql / MariaDB * Postgres * SqlServer -## How It Works? +# How It Works? The Database Migration uses PURE SQL to manage the database versioning. In order to get working you need to: @@ -63,7 +63,7 @@ In order to get working you need to: - Create the SQL Scripts - Manage using Command Line or the API. -### The SQL Scripts +## The SQL Scripts The scripts are divided in three set of scripts: @@ -118,7 +118,7 @@ the migration script will down and alert him there a TWO versions 43. In that ca file do 44-dev.sql and continue to work until merge your changes and generate a final version. -## Using the PHP API and Integrate it into your projects. +# Using the PHP API and Integrate it into your projects. The basic usage is @@ -154,7 +154,7 @@ $migration->update($version = null); The Migration object controls the database version. -### Creating a version control in your project: +## Creating a version control in your project: ```php registerDatabase('mysql', \ByJG\DbMigration\Database\MySqlDatabase:: $migration->createVersion(); ``` -### Getting the current version +## Getting the current version ```php getCurrentVersion(); ``` -### Add Callback to control the progress +## Add Callback to control the progress ```php addCallbackProgress(function ($command, $version) { }); ``` -### Getting the Db Driver instance +## Getting the Db Driver instance ```php getDbDriver(); To use it, please visit: https://github.com/byjg/anydataset-db -### Tips on writing SQL migrations +# Tips on writing SQL migrations -#### Rely on explicit transactions +## Rely on explicit transactions ```sql -- DO @@ -228,7 +228,7 @@ and warn you when you attempt to run it again. The difference is that with expli transactions you know that the database cannot be in an inconsistent state after an unexpected failure. -#### On creating triggers and SQL functions +## On creating triggers and SQL functions ```sql -- DO @@ -291,7 +291,7 @@ comment after every inner semicolon of a function definition `byjg/migration` wi Unfortunately, if you forget to add any of these comments the library will split the `CREATE FUNCTION` statement in multiple parts and the migration will fail. -#### Avoid the colon character (`:`) +## Avoid the colon character (`:`) ```sql -- DO @@ -319,14 +319,14 @@ read this as an invalid named parameter in an invalid context and fail when it t The only way to fix this inconsistency is avoiding colons altogether (in this case, PostgreSQL also has an alternative syntax: `CAST(value AS type)`). -#### Use an SQL editor +## Use an SQL editor Finally, writing manual SQL migrations can be tiresome, but it is significantly easier if you use an editor capable of understanding the SQL syntax, providing autocomplete, introspecting your current database schema and/or autoformatting your code. -### Handle different migration inside one schema +# Handle different migration inside one schema If you need to create different migration scripts and version inside the same schema it is possible but is too risky and I do not recommend at all. @@ -344,7 +344,7 @@ For security reasons, this feature is not available at command line, but you can We really recommend do not use this feature. The recommendation is one migration for one schema. -## Unit Tests +# Unit Tests This library has integrated tests and need to be setup for each database you want to test. @@ -357,9 +357,9 @@ vendor/bin/phpunit tests/PostgresDatabaseTest.php vendor/bin/phpunit tests/SqlServerDatabaseTest.php ``` -### Using Docker for testing +## Using Docker for testing -#### MySql +### MySql ```bash npm i @usdocker/usdocker @usdocker/mysql @@ -374,7 +374,7 @@ docker run -it --rm \ phpunit tests/MysqlDatabaseTest ``` -#### Postgresql +### Postgresql ```bash npm i @usdocker/usdocker @usdocker/postgres @@ -389,7 +389,7 @@ docker run -it --rm \ phpunit tests/PostgresDatabaseTest ``` -#### Microsoft SqlServer +### Microsoft SqlServer ```bash npm i @usdocker/usdocker @usdocker/mssql @@ -404,7 +404,7 @@ docker run -it --rm \ phpunit tests/SqlServerDatabaseTest ``` -## Related Projects +# Related Projects - [Micro ORM](https://github.com/byjg/micro-orm) - [Anydataset](https://github.com/byjg/anydataset) diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..d5f67f7 --- /dev/null +++ b/_config.yml @@ -0,0 +1,53 @@ +name: migration + +project: + version: 4.0.0 + download_url: https://github.com/byjg/migration/releases + +license: + software: MIT + software_url: https://opensource.org/licenses/MIT + + docs: MIT + docs_url: https://opensource.org/licenses/MIT + +git_edit_address: https://github.com/byjg/migration/blob/master/ + +links: + header: + - title: GitHub + url: https://github.com/byjg/migration + - title: ByJG + url: https://opensource.byjg.com/ + footer: + - title: GitHub + url: https://github.com/byjg/migration + - title: Issues + url: https://github.com/byjg/migration/issues + +ui: + header: + color1: "#080331" + color2: "#0033cc" + trianglify: true + +social: + github: + user: byjg + repo: migration + twitter: + enabled: false + via: + hash: opensourcebyjg + account: + facebook: + enabled: false + profileUrl: + +analytics: + google: UA-130014324-1 + +# Build settings +markdown: kramdown +remote_theme: allejo/jekyll-docs-theme +