Database migration from Phinx
- Install using composer
- Type command line in your terminal
composer install
In this case i make database name showroam_db
.
If you create a different database name, you must change 'name' => 'showroam_db'
in phinx.php, according to the database name you created 'name' => '<YOUR_DATABASE_NAME>'
.
vendor/bin/phinx test
vendor/bin/phinx migrate -e development
To generate dummy data
vendor/bin/phinx seed:run
If you want clear all seed/data on any table. Change all code any ...Seeder.php on app/config/database/seeds/ to this.
$posts = $this->table('table_name');
//$posts->insert($data)->saveData();
// empty data
$posts -> truncate();
Run this command after change all code ...Seeder.php to running clear all data.
vendor/bin/phinx seed:run
-
Copy file
.env.example
at app/config/database/env.example -
Rename file
.env copy.example
to.env
-
Change name database
Example app/config/database/.env:
HOSTNAME_DATABASE=localhost USERNAME_DATABASE=root PASSWORD_DATABASE= NAME_DATABASE=my_database
- Copy file
.env.example
at app/config/api/env.example - Rename file
.env copy.example
to.env
- Get API Key from coinmarketcap.com
Example app/config/api/.envAPI_KEY=<YOUR_API_KEY> API_URL=https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest