Files
opensourcepos/app/Libraries/MY_Migration.php
objecttothis cdb21d3e4c Migrations fixes
- Minor formating changes
- Adding migration helper calls where needed
- Adding locale helper calls where needed
- Add use statement to tax_lib for sale_lib
- pass gcaptcha enabled to the login view after checking to see if the key exists so that we don't get code errors before migrations 20170501150000
- Fixed getWhere in Appconfig model
2023-04-27 21:54:10 -04:00

45 lines
831 B
PHP

<?php
namespace App\Libraries;
use CodeIgniter\Database\MigrationRunner;
class MY_Migration extends MigrationRunner
{
public function get_last_migration(): string
{
$migrations = $this->findMigrations();
return basename(end($migrations)->version);
}
public function get_current_version(): string
{
if($this->db->tableExists('migrations'))
{
$builder = $this->db->table('migrations');
$builder->select('version');
return $builder->get()->getRow()->version;
}
return 0;
}
public function is_latest(): bool
{
$last_version = $this->get_last_migration();
$current_version = $this->get_current_version();
return $last_version == $current_version;
}
public function up(): void
{
// TODO: Implement up() method.
}
public function down(): void
{
// TODO: Implement down() method.
}
}