Questions tagged [phinx]

Database migration tool for PHP apps.

About

Database migrations tool for PHP apps..Phinx is just about migrations without all the bloat of a database ORM system or framework.

Links

GitHub

Phinx

104 questions
3
votes
1 answer

Fatal error: Call to a member function run() on null in {path to the test file}

I am using PHPUnit 5.7.23 and phinx 0.9.1, public function setUp(){ $this->phinx = new PhinxApplication; $this->phinx->setAutoExit(false); $this->phinx->run(new StringInput('migrate'), new NullOutput); …
Jozef Barca
  • 160
  • 2
  • 12
3
votes
1 answer

Running Phinx migrate a second time does not update the database with the new migration

I've created the following migration. It works the first time I run it, but if I make changes to the migration - such as adding a new column - when I run phinx mingrate -c src/phinx-config.php it doesn't update the database. It appears to do…
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
3
votes
1 answer

Phinx migrations - explicit length of integer column

Can you tell me please if is possible to set explicit length of integer column via Phinx migrations addColumn() method? Documentation uses limit option with MysqlAdapter::INT_REGULAR like ['limit' => MysqlAdapter::INT_SMALL, 'signed' => false] but…
Čamo
  • 3,863
  • 13
  • 62
  • 114
3
votes
1 answer

Adding a 'varbinary' MySQL field type with Phinx Migrate

I'm trying to create a migration in Phinx which will create a varbinary type field in a MySQL DB to store an ip_address. This is what I have: $table = $this->table('my_table'); $table->addColumn('ip_address', 'varbinary', ['after' => 'id', 'limit'…
Nathan Pitman
  • 2,286
  • 4
  • 30
  • 46
3
votes
1 answer

CakePHP 3.x Database Migration Plugin: Is there a way to Change a table field?

I am trying to figure out how best to modify a MySQL Table's existing Column using the CakePHP Migrations plugin. I do not need to add or drop the column, I simply want to modify a string column's length. Currently the column is defined as a…
Kingsolmn
  • 1,868
  • 2
  • 23
  • 39
2
votes
1 answer

Phinx migration SQLSTATE[42S01]: Base table or view already exists:

I want to use Phinx to manage my database. I already have a database with tables setup, so I wrote migrations to reflect what is already in place. Testing from an empty database everything works well, but on the populated database I get the…
Asis
  • 319
  • 1
  • 2
  • 14
2
votes
1 answer

Running Phinx seeds from migration file

I'm writing a set of Phinx migrations that install an application database and insert the seeds. My first 4 migration files build the database schema (with foreign key constraints), triggers, functions, and stored procedures respectively. I'd like…
Tanoro
  • 871
  • 2
  • 10
  • 30
2
votes
0 answers

Alter table to Add default auto increment primary key 'id' in Phinx migration

I had created a table in a Phinx migration using $table = $this->table('verification', ['id' => false, 'primary_key' => ['validation_id']]); $table->addColumn('validation_id','string',['limit' => 15, 'null' => false]) …
Akul Gupta
  • 21
  • 3
2
votes
0 answers

Phinx table already exists? Want to add 1 extra table

I'm pretty new to phinx, I made a number of migrations and ran the migration which created the tables as it should have. However I made a new migration to add an extra table, now If i run migrate -c phinx.php it tries to re-add the tables that are…
ShlongMór
  • 45
  • 5
2
votes
1 answer

Phinx migration error, "Could not find class" but looking in the correct file?

I'm trying to run database migrations using the phinx library for a Phalcon framework example project called 'Vokuro' and I'm getting this error. The file directory is correct so I'm clueless as to why this is…
2
votes
1 answer

How i can getDatabaseName in Phinx?

I am using Phinx to migrate. https://github.com/cakephp/phinx Now i want to use the name of my database in some special query in Migration file, the database name is specified depending on the enviroment in the phinx-config file. return [ …
larabee
  • 156
  • 5
2
votes
1 answer

Can I use two different environments in a Phinx migration?

I'm using phinx to manage my databases and I need to gather data from a database and insert it into another one. I have defined the two environments in a config file like so: 'environments' => [ 'default_database' => 'current', …
2
votes
4 answers

PDO Insert not accepting "true" or "false", but only 0 and 1

After introducing phinx as a database migration tool, I am no longer able to use true and false through PDO's execute statement. Whenever I do, I get the following error: PHP Warning: PDOStatement::execute(): SQLSTATE[22007]: Invalid datetime…
allinonemovie
  • 652
  • 1
  • 6
  • 20
2
votes
1 answer

How to access the auto-generated ID from a Phinx migration insert?

PHP Phinx is a Database Seeder / Migration library from CakePHP. This will create a fake user, but how would I create a row that has a FOREIGN KEY (or regular ID reference) to the id of that new user, i.e. a sub-user?
Jonathan
  • 6,741
  • 7
  • 52
  • 69
2
votes
1 answer

How to rollback in phinx

I want to rollback to previous stage. I Google and found this command phinx breakpoint -e development But it is not working.
hamza
  • 58
  • 1
  • 7