PHP Database Migrations for Everyone

Overview

Phinx: Simple PHP Database Migrations

Build Status Code Coverage Latest Stable Version Minimum PHP Version Total Downloads

Intro

Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minutes, you can install Phinx and create your first database migration. Phinx is just about migrations without all the bloat of a database ORM system or framework.

Check out book.cakephp.org/phinx (EN, ZH) for the comprehensive documentation.

phinxterm

Features

  • Write database migrations using database agnostic PHP code.
  • Migrate up and down.
  • Migrate on deployment.
  • Seed data after database creation.
  • Get going in less than 5 minutes.
  • Stop worrying about the state of your database.
  • Take advantage of SCM features such as branching.
  • Integrate with any app.

Supported Adapters

Phinx natively supports the following database adapters:

  • MySQL
  • PostgreSQL
  • SQLite
  • Microsoft SQL Server

Install & Run

See version and branch overview for branch and PHP compatibility.

Composer

The fastest way to install Phinx is to add it to your project using Composer (https://getcomposer.org/).

  1. Install Composer:

    curl -sS https://getcomposer.org/installer | php
    
  2. Require Phinx as a dependency using Composer:

    php composer.phar require robmorgan/phinx
    
  3. Install Phinx:

    php composer.phar install
    
  4. Execute Phinx:

    php vendor/bin/phinx
    

As a Phar

You can also use the Box application to build Phinx as a Phar archive (https://box-project.github.io/box2/).

  1. Clone Phinx from GitHub

    git clone https://github.com/cakephp/phinx.git
    cd phinx
    
  2. Install Composer

    curl -s https://getcomposer.org/installer | php
    
  3. Install the Phinx dependencies

    php composer.phar install
    
  4. Install Box:

    curl -LSs https://box-project.github.io/box2/installer.php | php
    
  5. Create a Phar archive

    php box.phar build
    

Documentation

Check out https://book.cakephp.org/phinx for the comprehensive documentation.

Other translations include:

Contributing

Please read the CONTRIBUTING document.

News & Updates

Follow @CakePHP on Twitter to stay up to date.

Limitations

PostgreSQL

Misc

Version History

Please read the release notes.

License

(The MIT license)

Copyright (c) 2017 Rob Morgan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Multiple Databases

    Multiple Databases

    It would be cool if Phinx could handle migrations for different databases all from the same instance. In our company setup we have one application which uses n databases, with different migrations for each that need to be handled.

    What are you thoughts on handling multiple databases? I might fork and see if I can get it working but I want to know if you'd ever merge something like that?

    feature waiting on feedback 
    opened by wpillar 97
  • Create an Initial Migration from an Existing Database

    Create an Initial Migration from an Existing Database

    Is it possible for Phinx to create an initial migration from an existing database? My scenario is that I have an application with a database and it's tables already and I'd like to start using Phinx to handle my migrations (previously i was manually creating SQL scripts). I'd love if Phinx could inspect my database and create an initial migration file with the current table structures as a starting point.

    I hope that made sense.

    feature 
    opened by ylynfatt 82
  • Suggestion to add a seed()

    Suggestion to add a seed()

    A suggestion to add a seed() function that is defined inside any migration classes. If it exists, Phinx will run the seed() only after it runs up().

    I often need this to seed tables with initial data, which goes along with migration.

    feature 
    opened by CMCDragonkai 53
  • Add update and updateData methods

    Add update and updateData methods

    Added update and updateData methods. Also added a shortcut method for updating.

    @rquadling @robmorgan I'm sure there may be changes needed. Please let me know and I'll implement ASAP.

    Thanks for the opportunity to work with you.

    Fixes #862

    feature 
    opened by BallisticPain 47
  • Rollbacks by start time

    Rollbacks by start time

    A new Configuration option named version_order was added. Its possible values are:

    • creation-time (the default): causes the Rollback and Status commands to order the executed migrations by their creation times (aka Migration IDs or Names).
    • start-time: causes the Rollback and Status commands to order the executed migrations by their start times (aka Execution Times).

    This means that when invoking the Rollback command:

    • With a start-time version order, the last executed migration will be rollbacked.
    • With a start-time version order and a -d (date) option, the migration start times will be used to determine the target version to rollback to. In other words, all migrations which were executed after that date will be rollbacked.
    • With a start-time version order and a -t (target version) option, all migrations which were executed after the target version was executed will be rollbacked.

    In terms of testing:

    • The old testRollbacksByDate test was renamed to testRollbackToDateTime and turned into a unit test, ensuring the rollback method is called with the right target version. A new testRollback was added which ensures the correct output of the rollback operation (as was being done in the old testRollbacksByDate test).
    • More test cases were added.
    • General test improvements were done (like adding the expected arguments to the underlying Manager calls in RollbackTest and StatusTest.

    Other notes:

    • The old rollback and rollbackToDateTime methods were merged into a single rollback method that handles all cases and version orders.
    • This PR replaces https://github.com/robmorgan/phinx/pull/745.
    opened by ghost 42
  • Support for UPDATE & DELETE methods?

    Support for UPDATE & DELETE methods?

    Rob, have you given any thought to creating insert, update, and delete methods instead of having queries written inline?

    I don't know that they'd add any specific functionality, but something like the way Zend_Db (v1, not v2) does would be nice to have.

    feature 
    opened by gms8994 37
  • Implemented Dry Runs

    Implemented Dry Runs

    A new --dry-run option was added to the Migrate and Rollback commands, which causes the executed/rollbacked Migrations Code to be outputted instead of executed.

    Technically speaking, I implemented it in a way that the new option is passed from the Migrate and Rollback Commands to the Manager class, whose executeMigration method was updated to print a different text header for the migrations being executed/rollbacked when dry-running. The parameter is then passed on to the Environment class' executeMigration method which enables dry-running in the PDOAdapter. Finally, when a statement is executed via the PDOAdapter.execute method, if dry-running was enabled it simply prints the SQL code and returns, instead of actually executing it via the underlying database connection.

    For #567 and based on https://github.com/wheniwork/phinx/pull/1

    opened by ghost 36
  • Add debug option to show raw SQL

    Add debug option to show raw SQL

    Sometimes when trying to run migration and failing for weird database errors it's hard to debug the problem without knowing what exact SQL is being issued against the server. The --verbose option shows what Phinx is trying to do, but not exactly how.

    Maybe another option -vv or --debug could show the commands sent to the server?

    feature 
    opened by igorsantos07 30
  • Support pre and post migrations for zero-downtime deployments

    Support pre and post migrations for zero-downtime deployments

    It is common to run migrations at deploy time, and those migrations are often split into pre- and post-deploy migrations. Pre-deploy migrations affect the current version of the app for a few moments before the new version is deployed. Post-deploy migrations are only applied after the new version has been deployed. This is to ensure no errors occur during a live, zero-downtime deployment.

    For example, new columns are usually added during pre-deploy, because if those columns are not present the moment the new version goes live, errors will occur because the app will try to access non-existent columns. Deleted columns should often be removed during post-deploy, because if they are removed whilst the current app version is running, errors will occur because the current version may still be trying to access them.

    To support these two types of migrations, there needs to be a mechanism to mark a given migration is either pre or post and the migration command must accept an option to toggle which migration subgroup is being targeted. This changes migration command behaviour from one-pass two two-pass style, where the command must be invoked twice - once for each migration subgroup - to perform the complete migration.

    Key discussion points

    1. Should we implement this feature?
    2. How should migrations be marked as pre and post?
    3. Should a new migration command be added or should the existing command be repurposed to support this behaviour with additional arguments or options?
    opened by Bilge 28
  • Error when trying to run init

    Error when trying to run init

    platform: windows8 trying to run: php vendor/bin/phinx init output result: SRC_DIR="pwd" cd "dirname "$0"" cd "../robmorgan/phinx/bin" BIN_TARGET="pwd/phinx" cd "$SRC_DIR" "$BIN_TARGET" "$@"

    bug 
    opened by ahmarov 27
  • Supporting namespaces in configuration, Migrations and Seeds.

    Supporting namespaces in configuration, Migrations and Seeds.

    Please consider my pull request, in which I made some enhancement. The pull request fixes following issues:

    • #168 Move migrations under the Phinx\Migration namespace
    • #756 Namespace loading failed
    • #1054 BUG: The same migration name can be created in multiple directories. (if add namespace in configuration)

    I implemented an idea of @rquadling (view comment). So, support of namespaces looks like this: php like:

    return [
        'paths' => [
            'migrations' => [
                '/path/to/migration/without/namespace',
                'Foo' => '/path/to/migration/Foo',
            ],
            'seeds' => [
                '/path/to/seeds/without/namespace',
                'Baz' => '/path/to/seeds/Baz',
            ]
        ],
    ];
    

    yaml like:

    paths:
        migrations:
          0: ./db/migrations
          Foo\Bar: ./db/FooBar
        seeds:
          0: ./db/seeds
          Foo\Bar: ./db/seeds/Foo/Bar
    

    json like:

    {
        "paths": {
            "migrations": {
                "0": "./db/migrations",
                "Foo\\Bar": "./db/FooBar"
            }
        }
    }
    
    

    Migrations/Seeds contain namespace just at the beginning of the file.

    Migrations/Seeds files without namespace are still working for backward compatibility.

    For using namespaces in migrations/seeds make new folders and change configuration.

    The solution doesn't fully compatible with PSR-4 (there are versions in file names).

    I tryed to covered the code with the unit's tests as full as possible.

    enhancement 
    opened by andrey-mokhov 25
  • Seeding chicken/egg problem

    Seeding chicken/egg problem

    I used the seeding feature for the first time today and found that it is useless for Postgres. My SQL seed file will create all the schemas and tables as needed, however Phinx cannot even run a seed file without first calling AdapterInterface::createSchemaTable().

    https://github.com/cakephp/phinx/blob/2922b17953f4a0910efb4ba5ae7cb528eea5718e/src/Phinx/Db/Adapter/PdoAdapter.php#L133

    In my case, $schemaTableName=phinx.log, which is a schema called phinx with a table called log. Except, however, the schema phinx doesn't exist yet. Perhaps in MySQL land, in which most of you seem to live, it is reasonable to assume the schema would already exist, since MySQL makes the mistake of conflating database and schema, but in any other reasonable DBMS this assumption makes it impossible to seed the database unless we manually create schemas separately beforehand, which is to say, we need to seed before we seed, which makes no sense.

    To be clear, I am disputing whether it makes any logical sense for Phinx to force creation of its migration table at seed time. I opine it does not, because seeding should make no assumptions about the current state of the database, particularly as its own schema is not used at all for the seeding process, as clearly noted in the documentation:

    ⚠️ Unlike with migrations, Phinx does not keep track of which seed classes have been run.

    It does not keep track of seed classes, ergo it should not be setting up schema and tables to track migrations at seed time.

    It seems to me there is a fundamentally flawed assumption that we should always, on every connection, be checking whether the Phinx schema exists. This seems like a really hacky way to create the Phinx table. The Phinx table should be created once and once only per database and there should be a formal way to do so, instead of implicitly doing it on every connection regardless of why that connection is being created.

    To be absolutely clear, this seed migration will never work when migration_table is set to phinx.log:

    <?php
    final class Foo extends Phinx\Seed\AbstractSeed
    {
        public function run(): void
        {
            $this->execute('CREATE SCHEMA phinx');
        }
    }
    

    Running this seed file on a fresh Postgres database gives:

    SQLSTATE[3F000]: Invalid schema name: 7 ERROR:  schema "phinx" does not exist
    LINE 1: CREATE TABLE "phinx"."log" ("version" BIGINT NOT NULL, "migr...
                         ^
    
    opened by Bilge 0
  • add fix for mariadb virtual column creation

    add fix for mariadb virtual column creation

    When using virtual column definition with Literal class, migration fails with SQL syntax error on MariaDB as NOT NULL or NULL are not allowed at the end of column definition. Below is the link to an issue.

    Fixes https://github.com/cakephp/phinx/issues/2157

    bug 
    opened by oskarkregar 3
  • Run Phinx migrations parallel on multiple database exhaust the CPU

    Run Phinx migrations parallel on multiple database exhaust the CPU

    • While running phinx migration on multiple databases always exhaust the database CPU

    Use Case 1 database has 17 migrations to execute and there are total of 500 database, I am running 20 in PARALLEL but it always throw below error after executing few. PDOException: SQLSTATE[HY000] [2002] Connection refused in /composer/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:83 Stack trace: #0 /composer/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(83): PDO->__construct('mysql:host=127....', 'dbuser', 'dbpassword', Array)

    opened by Mubasher-iqbal 0
  • Phinxlog insert is not part of migration transaction

    Phinxlog insert is not part of migration transaction

    == 20221128213727 AddContactIdToPerson: migrating START TRANSACTION ALTER TABLE person ADD contact_id INT(11) NULL COMMIT INSERT INTO phinxlog (version, migration_name, start_time, end_time, breakpoint) VALUES ('20221128213727', 'AddContactIdToPerson', '2022-11-28 21:40:06', '2022-11-28 21:40:06', 0); == 20221128213727 AddContactIdToPerson: migrated 0.0116s

    should be

    == 20221128213727 AddContactIdToPerson: migrating START TRANSACTION; ALTER TABLE person ADD contact_id INT(11) NULL; INSERT INTO phinxlog (version, migration_name, start_time, end_time, breakpoint) VALUES ('20221128213727', 'AddContactIdToPerson', '2022-11-28 21:40:06', '2022-11-28 21:40:06', 0); COMMIT; == 20221128213727 AddContactIdToPerson: migrated 0.0116s

    bug 
    opened by JRDuncan 0
  • DEFAULT_GENERATED being added to queries.

    DEFAULT_GENERATED being added to queries.

    Versions:

    phinx: 0.11 mysql: 8+ pho: 7.2

    Refering to: https://github.com/dbeaver/dbeaver/issues/10797


    when creating a colum which has CURRENT_TIMESTAMP as the default value, mysql adds 'DEFAULT_GENERATED' into the extra column.

    This then gets added to any alter statements and causes a syntax issue.


    REPRODUCTION:

    ####Create a table with a datetime field with CURRENT_TIMESTAMP as the default value.

    CREATE TABLE `test_table` (
    	`id`  INT NOT NULL AUTO_INCREMENT,
    	`name` VARCHAR(80) NOT NULL,
    	`last_changed` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    	PRIMARY KEY (`id`) USING BTREE
    )
    

    ####using phinx to rename the column

    public function change(){
        $this->table('test_table')
                ->renameColumn('last_changed', 'updated_at')
                ->update();
    }
    
    opened by larsgullestrup 0
Releases(0.13.3)
  • 0.13.3(Dec 8, 2022)

    Fixes

    • Fix string to int return type by @dereuromark in https://github.com/cakephp/phinx/pull/2150
    • Fix rolling back columns with indices for SQLite and SQL Server by @ndm2 in https://github.com/cakephp/phinx/pull/2128
    • Add testcases for Util::getVersionFromFileName function by @MasterOdin in https://github.com/cakephp/phinx/pull/2153
    • Fix reference to MysqlAdapter::FIRST constant in migrations doc by @niekatywny in https://github.com/cakephp/phinx/pull/2143

    Full Changelog: https://github.com/cakephp/phinx/compare/0.13.2...0.13.3

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.13.2(Nov 30, 2022)

    Fixes

    • Maintain indexes / triggers after altering sqlite tables by @MasterOdin in https://github.com/cakephp/phinx/pull/2040
    • Fix documentation seeder_base_class configuration by @N-Silbernagel in https://github.com/cakephp/phinx/pull/2124
    • Fix deprecated ${} string interpolation by @rigrig in https://github.com/cakephp/phinx/pull/2133
    • Fix enum by @dereuromark in https://github.com/cakephp/phinx/pull/2140

    New Contributors

    • @Arhell made their first contribution in https://github.com/cakephp/phinx/pull/2120
    • @N-Silbernagel made their first contribution in https://github.com/cakephp/phinx/pull/2124
    • @rigrig made their first contribution in https://github.com/cakephp/phinx/pull/2133
    • @nono-lqdn made their first contribution in https://github.com/cakephp/phinx/pull/2137

    Full Changelog: https://github.com/cakephp/phinx/compare/0.13.1...0.13.2

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.13.1(Oct 11, 2022)

    Fixes

    • Fix target being set to 0 if omitted when running migrate by @nrob81 in #2115
    • Fix deprecation warning on return value for Config::offsetGet by @MasterOdin in #2117

    Full Changelog: https://github.com/cakephp/phinx/compare/0.13.0...0.13.1

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.13.0(Oct 6, 2022)

    Breaking Changes

    • set column null by default unless identity by @MasterOdin in #1872. Previously columns were created as NOT NULL by default, and to now get that behavior, you will need to explicitly pass 'null' => false in the column options.
    • remove remove $direction argument to preFlightCheck and postFlightCheck (use isMigratingUp property) by @MasterOdin in #1892
    • make utf8mb4 default charset and collation for new mysql tables by @MasterOdin in #1875 (Set charset and collation setting in phinx.php to utf8mb3 for prior behavior)
    • make default PKs for mysql unsigned by default by @MasterOdin in #1899. When defining foreign keys, you will need to now need to set $signed => false. To restore prior behavior, pass $signed => true when defining the default PK.
    • Add type hints to codebase by @MasterOdin in #1995 (This does not affect the up, down, or change methods for AbstractMigration. If you extend from phinx, you will need to add type hinting to your code)
    • remove deprecated hasSchemaTable function from AdapterInterface by @MasterOdin in #1877
    • remove deprecated insert, dropTable methods from MigrationInterface by @MasterOdin in #1878
    • Do not set code when recasting PDOException when connecting to DB by @MasterOdin in #2101
    • Implement identity in PostgresAdapter by @ajibarra in #2085 (identity columns for postgres 10+ will now be generated as INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY instead of SERIAL NOT NULL)

    Deprecations

    • Deprecate the default_migration_table config setting, use migration_table instead by @MasterOdin in #1961

    New Features

    • add createSchema and dropSchema methods on MigrationInterface by @MasterOdin in #1871

    Improvements

    • remove check on column type for setting collation / encoding by @Masterodin in #1881
    • trigger deprecation notice when using default_database by @MasterOdin in #1890 (function had been marked as deprecated in 0.12.0)
    • add support for smallserial alias for postgres by @MasterOdin in #1915 (note, using smallinteger on an identity column will now use the type smallserial)
    • allow setting migration_table per environment by @MasterOdin in #1961
    • Add new shouldExecute method to AbstractMigration and AbstractSeed by @AdrienPoupa in #1939
    • Add for geometry column type to SqlServerAdapter by @tedce in #1969
    • Add optional $params argument to query/execute adapter methods to allow usage of prepared queries by @MasterOdin in #1962
    • Allow specifying template style for create command by @MasterOdin in #2013 (note, the name of the base migration file has changed, argument has changed for AbstractCommand::getMigrationTemplateFilename)
    • Improve associative array phpdocs by @dereuromark in #2034
    • Pass environment to seed from manager by @martenb in #2102 (note, parameter change to Manager::getSeeds method)

    Full Changelog: https://github.com/cakephp/phinx/compare/0.12.13...0.13.0

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.12.13(Oct 3, 2022)

  • 0.12.12(Jul 15, 2022)

    Fixes

    • Fix setting persistent option for PDO connection by @paulermo in https://github.com/cakephp/phinx/pull/2092
    • Fix SqlServerAdapter returning empty string instead of null for column default by @reeperbahnause in https://github.com/cakephp/phinx/pull/2090

    Full Changelog: https://github.com/cakephp/phinx/compare/0.12.11...0.12.12

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.12.11(Jul 4, 2022)

    Improvements

    • Add full text search index GIN type by @antoniovj1 in https://github.com/cakephp/phinx/pull/2066
    • Support sqlite query parameters by @swiffer in https://github.com/cakephp/phinx/pull/2053, https://github.com/cakephp/phinx/pull/2083
    • Add setting DSN options for SqlServerAdapter by @ingLomeland in https://github.com/cakephp/phinx/pull/2094

    Full Changelog: https://github.com/cakephp/phinx/compare/0.12.10...0.12.11

    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.99 MB)
  • 0.12.10(Jan 21, 2022)

    Fixes

    • Fixed setting default for Blob, Geometry, Json, and Text for MySQL 8+
    • Fix using MysqlAdapter::INT_* constants as column limit
    • Properly return limit for MySQL columns that include it (e.g. smallint(5))
    • Fix adding columns to sqlite tables created externally from phinx

    Improvements

    • Do not print information output with option --no-info
    • Remove decimal from unsupported sqlite types list
    • Mark compatibility with Symfony 6.x
    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.97 MB)
  • 0.12.9(Oct 12, 2021)

    Fixes

    • Fixed renaming table not using prefix/suffix on new name
    • Fixed changing boolean column option's in PostgreSQL, this was a regression of previous release patch that is now resolved

    Improvements

    • PHP 8.1 compatibility
    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.90 MB)
  • 0.12.8(Sep 1, 2021)

    Fixes

    • Fixes issue with MySQL Adapter primary key getter

    Improvements

    • Expose hasPrimaryKey() method in Table object. This mirrors the existing hasForeignKey() function.
    • Postgres: Allow change from int to bool and char to uuid
    • Allow setting column to false to ignore it in addTimestamps()/addTimestampsWithTimezone methods. This is useful if not both fields are used.
    • Adding the mediumint type for the MySql adapter
    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.90 MB)
  • 0.12.7(May 18, 2021)

    Fixes

    • Fixed error when creating a foreign key on a table without an autoincrementing primary key in SQLite

    Improvements

    • Support for psr/container v2
    Source code(tar.gz)
    Source code(zip)
  • 0.12.6(Mar 16, 2021)

  • 0.12.5(Jan 21, 2021)

    Fixes

    • Fix not being able to set limit on big integer for MySQL
    • Run preFlightCheck and postFlightCheck immediately after migration
    • Ensure a default of CURRENT_TIMESTAMP(3) is not quoted in MySQL
    • Fix PDO exception not being thrown when trying to add column to non-existent table in SQLite
    • Better handle specifying schema in configuration file and inline migrations for postgresql Since phinx did support this at one time and then it broke

    Improvements

    • Support setting order for indexes
    • Add ability to set generic PDO attributes
    • Support for include clause when adding an index
    • Support looking up foreign key by name in sqlite3
    • Support for tinyint and smallint in SQL Server
    • Automatically handle casting when changing column to bigint, smallint, int on postgresql
    Source code(tar.gz)
    Source code(zip)
    phinx.phar(1.84 MB)
  • 0.12.4(Aug 18, 2020)

    Fixes

    • Fixed adding columns to existing SQLite table with table constraints
    • Fixed problems in SQLite Adapter around foreign key creation
    • Fixed renaming columns in mixed case table in Postgres
    • Fix error when using Phinx with MySQL 8.0.21+

    Improvements

    • Added support for decimal in SQLite adapter
    • Added support for native Mysql blob types and fallback for binary
    • Removed cakephp/collection dependency
    Source code(tar.gz)
    Source code(zip)
  • 0.12.3(Jun 26, 2020)

  • 0.12.2(Jun 24, 2020)

    Fixes

    • Fixed issue around tinyint(1) and bool detection
    • Fixed default/update values for addTimestamps columns

    Improvements

    • Support user-configured DI container
    • Added further support for tinyint and binary UUID
    • Added support for configuring test DB through DSN
    • Allow name to be optional for create command
    • Relaxed migration & seed class name restrictions
    Source code(tar.gz)
    Source code(zip)
  • 0.11.7(May 12, 2020)

    Fixes

    • Do not throw an exception for missing phinxlog for dry-run
    • Adjusted the composer constraints to include the symfony/yaml component again.
    Source code(tar.gz)
    Source code(zip)
  • 0.12.1(Apr 11, 2020)

  • 0.12.0(Apr 9, 2020)

    Breaking Changes

    • Minimum of PHP 7.2 required now.
    • cakephp/database>=4.0 now required. This could impact migrations/seeds that use the query APIs.
    • In environment configuration default_database is now default_environment.

    New Features

    • Upgraded to PHPUnit 8.0
    • Added setDataDomain(), getDataDomain(), and getColumnForType() to adapters.
    • Improved SQLite column add functionality.
    • SQLite now creates columns as NOT NULL by default, regardless if a default value for the column is specified or not. This brings it in line with how the other adapters work.
    Source code(tar.gz)
    Source code(zip)
  • 0.11.6(Apr 6, 2020)

  • 0.11.5(Apr 5, 2020)

    Fixes

    • Fixed schema table not being properly quoted in some queries
    • $_ENV is mixed with $_SERVER for getting replacement config tokens
    • Fixed DSN handling in Migrate and Seed commands

    Improvements

    • Improved Wrapper to support status command in JSON format
    • Made YAML extension optional.
    • Raise error on ignored primary key.
    Source code(tar.gz)
    Source code(zip)
  • 0.11.4(Dec 24, 2019)

    Included commits: https://github.com/cakephp/phinx/compare/0.11.3...0.11.4

    Fixes

    • Fixed offset warning shown when using invalid version for breakpoint

    Improvements

    • Added fetch_mode option support for PDO adapter
    • Print version order when running migrate
    • Allow setting SRID for geometry types
    Source code(tar.gz)
    Source code(zip)
  • 0.11.3(Dec 12, 2019)

  • 0.11.2(Dec 8, 2019)

    Fixes

    • SQLite fixes
    • Do not print out status table when specifying --format json

    Improvements

    • PHP 7.4 compatibility
    • Symfony 5 compatibility
    • Introduced new command to list migration template creation aliases
    Source code(tar.gz)
    Source code(zip)
  • 0.11.1(Aug 28, 2019)

    Bug Fixes

    • Fixed version in composer.json
    • Fixed minimum versions of dependencies #1592

    Other Changes

    • Use $defaultName instead of COMMAND_NAME in command classes. #1596
    • Added prefer-lowest build to travis. #1592
    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Aug 28, 2019)

    Bug Fixes

    • Fixed command names to fix breaking changes in symfony/console #1588
    • Fixed missing ; when using --dry-run #1573
    • Fix inserting multiple rows without zero key #1566
    • Fix option names in exception message.

    New Features

    • AdapterWrapper::hasDatabase() now has a return value #1572

    Other Changes

    • Improved test coverage with postgres #1577
    • Update PHPUnit version constraint #1591
    • Updated travis build configuration.
    Source code(tar.gz)
    Source code(zip)
  • v0.10.8(Jul 8, 2019)

    Bug Fixes

    • [PDO & SQLite] Quoting (#1542)
    • [Postgres] Fix truncate table (#1555, #1474)
    • [SQLite] Fix truncate table (#1556)
    • [SQLite] Fixes to index handling (#1545)
    • [SQLite] Improved dropDatabase, and other minor fixes (#1533)
    • [SqlServer] Fix SqlServer syntax after making precision alias of limit (#1529)

    New Features

    • Add double type (#1493)
    • Introduce --set and --unset options for breakpoints (#1560)
    • [SQLite] Implement hasPrimaryKey and hasForeignKey (#1548)
    • [SQLite] New implementation of getColumns (#1554)

    Other Changes

    • Document that double is now a valid column type (#1527)
    • Enable testing for PHP 7.3
    • Typos in documentation (#1525)
    • Updated documentation regarding the use of saveData() rather than save() in seeds (#1473)
    Source code(tar.gz)
    Source code(zip)
  • v0.10.7(Apr 25, 2019)

    Bug Fixes

    • Several bug fixes introduced in 0.10 related to the batching of alter table statements (#1523)
    • Fixed DSN parsing (#1433)
    • SQLite Adapter now respects LIMIT on CHAR typed columns (#1518)
    • Fixes decimal info getColumns() (#1466)
    • Prevent data insertion when passing an empty array (#1496)
    • Quote column names when running CHECK command (#1444)

    New Features

    • Add double type (#1493)
    • Add Exit Status 1 on Exception (#1462)
    • Non integer primary sqlite (#1450)
    • Add feature to be able to define a boostrap script (#1455)
    • Add small integer support to all Mysql, SqlServer and Sqlite (#1438)
    • Make removeIndex work with one column as a string (#1437)
    Source code(tar.gz)
    Source code(zip)
  • v0.10.6(Aug 12, 2018)

    Bug Fixes

    • Fixed wrong SQL used when adding new columns to a table in SQLite
    • Do not output all migrations in the -vvv output when running migrations every single time.

    New Features

    • Ability to change the primary key and table comment
    • Added Table::getColumn() method
    Source code(tar.gz)
    Source code(zip)
  • v0.10.5(Jul 12, 2018)

Extract SQL statements from migrations

This is my package MigrationToSql To install: composer require bcleverly/migrationtosql --dev This repo is here to help you extract the SQL queries fr

Ben 4 Apr 15, 2022
Migrations for MongoDB based on PHPMongo ODM

PHPMongo Migrator Migrations for MongoDB based on PHPMongo ODM Schema not required in MongoDb, so we dont need to create databases, collections or alt

Sokil 29 Jul 13, 2022
Pure PHP NoSQL database with no dependency. Flat file, JSON based document database.

Please give it a Star if you like the project ?? ❤️ SleekDB - A NoSQL Database made using PHP Full documentation: https://sleekdb.github.io/ SleekDB i

Kazi Mehedi Hasan 745 Jan 7, 2023
SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate.

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate. NoSQL API

SleekwareDB 12 Dec 11, 2022
The lightweight PHP database framework to accelerate development

The lightweight PHP database framework to accelerate development Features Lightweight - Less than 100 KB, portable with only one file Easy - Extremely

Angel Lai 4.6k Dec 28, 2022
Database management in a single PHP file

Adminer - Database management in a single PHP file Adminer Editor - Data manipulation for end-users https://www.adminer.org/ Supports: MySQL, MariaDB

Jakub Vrána 5.5k Jan 1, 2023
A php class for managing and connecting to a database

Query builder class php This class is responsible for creating and executing sql commands and helps you to execute as easily as possible and safely. I

Mohammad Qasemi 39 Dec 11, 2022
Database lookup tool in php, skidlookup has not been claimed so if u want to use this src all right's go to u, idea came from fedsearch

skidlookup Database lookup tool in php, skidlookup has not been claimed so if u want to use this src, all right's go to u, idea came from fedsearch in

Nano 12 Dec 1, 2021
A complete, simple and powerful database framework written in PHP

BaseSQL BaseSQL is a complete database framework written in PHP. It was built to accelerate projects development by handle database connections and qu

Willian Pinheiro 2 Sep 21, 2021
Connect and work with MySQL/MariaDB database through MySQLi in PHP. This is an introductory project, If you need a simple and straightforward example that takes you straight to the point, you can check out these examples.

First MySQLi PHP Connect and work with MySQL/MariaDB database through MySQLi in PHP. The above exercises are designed for students. This is an introdu

Max Base 4 Feb 22, 2022
Database lookup tool in php, skidlookup has not been claimed so if u want to use this src all right's go to u, idea came from fedsearch

skidlookup Database lookup tool in php, skidlookup has not been claimed so if u want to use this src, all right's go to u, idea came from fedsearch in

Nano 12 Dec 1, 2021
The fastest pure PHP database framework with a powerful static code generator, supports horizontal scale up, designed for PHP7

Maghead 4.0.x IS CURRENTLY UNDER HEAVY DEVELOPMENT, API IS NOT STABLE Maghead is an open-source Object-Relational Mapping (ORM) designed for PHP7. Mag

Maghead 477 Dec 24, 2022
phpSleekDBAdmin - a web-based SleekDB database admin tool written in PHP

phpSleekDBAdmin is a web-based SleekDB database admin tool written in PHP. Following in the spirit of the flat-file system used by SleekDB, phpSleekDBAdmin consists of a single source file, phpsleekdbadmin.php. The interface and user experience is comparable to that of phpLiteAdmin and phpMyAdmin.

GalAnonym 8 Oct 26, 2022
PHP Reader for the MaxMind DB Database Format

This is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).

MaxMind 577 Dec 26, 2022
PHP application-level database locking mechanisms to implement concurrency control patterns.

PHP DB Locker Introduction PHP application-level database locking mechanisms to implement concurrency control patterns. Supported drivers: Postgres In

cybercog 3 Sep 29, 2022
A simple library for managing database connections, results pagination and building queries in PHP

PHP lions-software-database-manager This is a simple library for managing database connections, results pagination and building queries in PHP. Esta é

Lions Software 0 Feb 7, 2022
The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

Mark Armendariz 0 Jan 7, 2022
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style OR

The Laravel Components 2.5k Dec 27, 2022
ORM layer that creates models, config and database on the fly

RedBeanPHP 5 RedBeanPHP is an easy to use ORM tool for PHP. Automatically creates tables and columns as you go No configuration, just fire and forget

Gabor de Mooij 2.2k Jan 9, 2023