Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update: phinx
Browse files Browse the repository at this point in the history
  • Loading branch information
darkalchemy committed Jun 29, 2020
1 parent 7924725 commit 8db1b6c
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 239 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ If you want to use redis as your session handler, you should add this to php.ini
composer cleanup # runs php_cs_fixer
composer clear_cache # clears all file based caches
composer compile # compile all twig templates
composer create-migration # create new migration class
composer migrate # migrate the database
composer rollback # rollback all database changes
composer set-perms # set writable perms for cache/log folders for both webserver and cli
Expand Down
3 changes: 1 addition & 2 deletions app/Migrations/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ class Migration extends AbstractMigration
{
protected Builder $schema;

protected function init()
public function init()
{
parent::init();
$this->schema = Capsule::schema();
}
}
10 changes: 4 additions & 6 deletions app/Migrations/MigrationStub.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,19 @@ class $className extends $baseClassName
$table->timestamp('last_login')->nullable();
$table->timestamps();
});

$this->schema->table('users', function (Blueprint $table) {

});
}

/**
*
*/
public function down()
{
$this->schema->table('', function (Blueprint $table) {
// rollback
$this->schema->table('users', function (Blueprint $table) {

});

$this->schema->drop('');
// or drop
$this->schema->drop('users');
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"odan/session": "^4.0",
"php-di/slim-bridge": "^3.0",
"phpmailer/phpmailer": "^6.1",
"robmorgan/phinx": "^0.11.4",
"robmorgan/phinx": "^0.12.3",
"selective/config": "^0.1.1",
"slim/csrf": "^1.0",
"slim/flash": "^0.4.0",
Expand Down Expand Up @@ -70,6 +70,7 @@
"dump": "composer dump-autoload -a",
"post-update-cmd": "composer dump-autoload -o",
"post-create-project-cmd": "php -r \"copy('config/settings.example.php', 'config/settings.php');\"",
"create-migration": "vendor/bin/phinx create -c config/phinx.php --ansi -- ",
"migrate": "vendor/bin/phinx migrate -c config/phinx.php -e default --ansi",
"rollback": "vendor/bin/phinx rollback -c config/phinx.php -e default --ansi -t 0",
"translate": "php bin/utilities.php translate",
Expand Down
Loading

0 comments on commit 8db1b6c

Please sign in to comment.