Skip to content

Commit

Permalink
Try finish migrations on mysql/sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Apr 28, 2024
1 parent 0d26bc1 commit f6956e5
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -4,6 +4,9 @@ clean:
migration:
cd src ; ../vendor/bin/phinx migrate -c ../phinx-adapter.php ; cd ..

sysmigration:
cd src ; /usr/bin/phinx migrate -c /usr/lib/multiflexi/phinx-adapter.php ; cd ..

seed:
cd src ; ../vendor/bin/phinx seed:run -c ../phinx-adapter.php ; cd ..

Expand Down
6 changes: 3 additions & 3 deletions db/migrations/20200413150836_app_to_company.php
Expand Up @@ -9,11 +9,11 @@ class AppToCompany extends AbstractMigration {
public function change() {
$table = $this->table('appcompany');
$table->addColumn('app_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('interval','string',['length'=>1])
->addIndex(['app_id', 'company_id'])
->addForeignKey('app_id', 'apps', ['id'], ['constraint' => 'a2p-app_must_exist'])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'a2p-company_must_exist']);
->addForeignKey('app_id', 'apps', ['id'], ['constraint' => 'a2p_app_must_exist'])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'a2p_company_must_exist']);
$table->save();
}

Expand Down
6 changes: 3 additions & 3 deletions db/migrations/20200520140331_config_registry.php
Expand Up @@ -6,7 +6,7 @@ class ConfigRegistry extends AbstractMigration {

public function change() {
$customFields = $this->table('conffield');
$customFields->addColumn('app_id', 'integer', ['null' => false, 'signed'=>false])
$customFields->addColumn('app_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('keyname', 'string', ['length' => 64])
->addColumn('type', 'string', ['length' => 32])
->addColumn('description', 'string', ['length' => 1024])
Expand All @@ -16,8 +16,8 @@ public function change() {
$customFields->create();

$configs = $this->table('configuration');
$configs->addColumn('app_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false, 'signed'=>false])
$configs->addColumn('app_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('key', 'string', ['length' => 64])
->addColumn('value', 'string', ['length' => 1024])
->addIndex(['app_id', 'company_id', 'key'], ['unique' => true])
Expand Down
15 changes: 8 additions & 7 deletions db/migrations/20221123091933_company_env.php
@@ -1,11 +1,10 @@
<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CompanyEnv extends AbstractMigration {

final class CompanyEnv extends AbstractMigration
{
/**
* Change Method.
*
Expand All @@ -17,13 +16,15 @@ final class CompanyEnv extends AbstractMigration {
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change() {
public function change()
{
$table = $this->table('companyenv');
$table->addColumn('keyword', 'string', array('null' => false))
->addColumn('value', 'string', array('null' => false))
->addColumn('company_id', 'integer', ['null' => false, 'signed'=>false])
->addIndex(['keyword', 'company_id'], ['unique' => true])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'env-company_must_exist']);
->addColumn('company_id', 'integer', ['null' => false,'signed'=>false])
->addIndex(['keyword', 'company_id'], ['unique' => true])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'env-company_must_exist']);
$table->save();

}
}
12 changes: 8 additions & 4 deletions db/migrations/20221125095601_job.php
Expand Up @@ -19,13 +19,17 @@ final class Job extends AbstractMigration {
*/
public function change() {
$table = $this->table('job');
$table->addColumn('app_id', 'integer', ['null' => false, 'unsigned' => false])
$table->addColumn('app_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('begin', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
->addColumn('end', 'datetime', ['null' => true])
->addColumn('company_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('exitcode', 'integer', ['null' => true])
->addForeignKey('app_id', 'apps', ['id'], ['constraint' => 'job-app_must_exist'])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'job-company_must_exist']);
->addForeignKey('app_id', 'apps', ['id'],
['constraint' => 'job-app_must_exist'])
->addForeignKey('company_id', 'company', ['id'],
['constraint' => 'job-company_must_exist']);
$table->save();

}

}
4 changes: 2 additions & 2 deletions db/migrations/20231112224941_company_apps.php
Expand Up @@ -21,8 +21,8 @@ public function change(): void
{

$table = $this->table('companyapp');
$table->addColumn('app_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false, 'signed'=>false])
$table->addColumn('app_id', 'integer', ['null' => false,'signed'=>false])
->addColumn('company_id', 'integer', ['null' => false,'signed'=>false])
->addIndex(['app_id', 'company_id'], ['unique' => true])
->addForeignKey('app_id', 'apps', ['id'], ['constraint' => 'a2c-app_must_exist'])
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'a2c-company_must_exist']);
Expand Down
2 changes: 1 addition & 1 deletion db/migrations/20240107205916_action_config.php
Expand Up @@ -26,7 +26,7 @@ public function change(): void
->addColumn('keyname', 'string', ['comment' => 'Configuration Key name'])
->addColumn('value', 'string', ['comment' => 'Configuration Value'])
->addColumn('mode', 'string', ['null' => true, 'length' => 10, 'default' => null, 'comment' => 'success, fail or empty'])
->addColumn('runtemplate_id', 'integer', ['null' => false, 'signed'=>false])
->addColumn('runtemplate_id', 'integer', ['null' => false,'signed'=>false])
->addIndex(['module', 'keyname', 'mode', 'runtemplate_id'], ['unique' => true])
->addForeignKey('runtemplate_id', 'runtemplate', ['id'], ['constraint' => 'runtemplate_must_exist'])
->create();
Expand Down
1 change: 1 addition & 0 deletions debian/conf/phinx-adapter.php
Expand Up @@ -42,6 +42,7 @@
if (strstr(\Ease\Shared::cfg('DB_CONNECTION'), 'sqlite')) {
$sqlOptions["database"] = "/var/lib/dbconfig-common/sqlite3/multiflexi/" . basename(\Ease\Shared::cfg("DB_DATABASE"));
}

$engine = new \Ease\SQL\Engine(null, $sqlOptions);
$cfg = [
'paths' => [
Expand Down

0 comments on commit f6956e5

Please sign in to comment.