Skip to content

Commit

Permalink
refactor: migration & seeding process
Browse files Browse the repository at this point in the history
  • Loading branch information
im-machakata committed Mar 27, 2024
1 parent 5378aea commit 51f0d31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: getRequest
uses: skgandikota/[email protected]
with:
url: "https://ors-zqetri23.isaac.co.zw/re-install"
url: "https://ors-zqetri23.isaac.co.zw/sys/re-install"

- name: Get Migration Results
run: |
Expand Down
7 changes: 6 additions & 1 deletion app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Controllers\Requisition;
use App\Controllers\TravelAndSubsistencies;
use App\Models\Account;
use App\Models\Department;
use CodeIgniter\Router\RouteCollection;

/**
Expand Down Expand Up @@ -60,15 +61,19 @@
$routes->group('sys', function (RouteCollection $routes) {
$routes->get('install', function () {
command('migrate');
if(!model(Department::class)->first()) {
command('db:seed Departments');
}
if (!model(Account::class)->first()) {
command('db:seed Accounts');
}
return redirect()->to('/');
});
$routes->get('re-install', function () {
command('migrate:rollback --force --all');
command('db:seed Accounts');
command('migrate');
command('db:seed Accounts');
command('db:seed Departments');
return redirect()->to('/');
});
$routes->get('crash-it', function () {
Expand Down

0 comments on commit 51f0d31

Please sign in to comment.