Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Apr 13, 2024
1 parent c7f872a commit 5fc7181
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions src/Mvc/Model/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,16 @@ class Migration

/**
* Path where to save the migration
*
* @var string
*/
private static string $migrationPath = '';

/**
* Skip auto increment
*
* @var bool
*/
private static bool $skipAI = true;

/**
* Version of the migration file
*
* @var string|null
*/
protected ?string $version = null;

Expand Down Expand Up @@ -174,8 +168,6 @@ public static function setup(Config $database, bool $verbose = false): void

/**
* Set the skip auto increment value
*
* @param bool $skip
*/
public static function setSkipAutoIncrement(bool $skip): void
{
Expand All @@ -184,8 +176,6 @@ public static function setSkipAutoIncrement(bool $skip): void

/**
* Set the migration directory path
*
* @param string $path
*/
public static function setMigrationPath(string $path): void
{
Expand Down Expand Up @@ -250,7 +240,7 @@ public static function generate(

$classVersion = preg_replace('/[^0-9A-Za-z]/', '', (string) $version->getStamp());
$className = $camelize->__invoke($table) . 'Migration_' . $classVersion;
$shouldExportDataFromTable = self::shouldExportDataFromTable($table, $exportTables);
$shouldExportDataFromTable = in_array($table, $exportTables);

$generateAction = new GenerateAction($adapter, $description, $indexes, $references, $tableOptions);
$generateAction->createEntity($className)
Expand All @@ -272,11 +262,6 @@ public static function generate(
return $printer->printFile($generateAction->getEntity());
}

public static function shouldExportDataFromTable(string $table, array $exportTables): bool
{
return in_array($table, $exportTables);
}

/**
* Migrate
*
Expand Down Expand Up @@ -843,8 +828,6 @@ static function ($value) {

/**
* Delete the migration datasets from the table
*
* @param string $tableName
*/
public function batchDelete(string $tableName): void
{
Expand Down Expand Up @@ -875,8 +858,6 @@ static function ($value) {

/**
* Get db connection
*
* @return AbstractAdapter
*/
public function getConnection(): AbstractAdapter
{
Expand All @@ -885,10 +866,6 @@ public function getConnection(): AbstractAdapter

/**
* Execute Multi Insert
*
* @param string $table
* @param array $columns
* @param string $values
*/
protected function executeMultiInsert(string $table, array $columns, string $values): void
{
Expand Down Expand Up @@ -935,10 +912,6 @@ public static function resolveDbSchema(Config $config): ?string
}

/**
* @param string $tableName
* @param string $schemaName
* @param IndexInterface $index
*
* @throw RuntimeException
*/
private function addPrimaryKey(string $tableName, string $schemaName, IndexInterface $index): void
Expand All @@ -959,9 +932,6 @@ private function addPrimaryKey(string $tableName, string $schemaName, IndexInter
}

/**
* @param string $tableName
* @param string $schemaName
*
* @throw RuntimeException
*/
private function dropPrimaryKey(string $tableName, string $schemaName): void
Expand All @@ -981,10 +951,6 @@ private function dropPrimaryKey(string $tableName, string $schemaName): void
}

/**
* @param string $tableName
* @param string $schemaName
* @param IndexInterface $indexName
*
* @throw RuntimeException
*/
private function addIndex(string $tableName, string $schemaName, IndexInterface $indexName): void
Expand All @@ -1005,10 +971,6 @@ private function addIndex(string $tableName, string $schemaName, IndexInterface
}

/**
* @param string $tableName
* @param string $schemaName
* @param string $indexName
*
* @throw RuntimeException
*/
private function dropIndex(string $tableName, string $schemaName, string $indexName): void
Expand Down

0 comments on commit 5fc7181

Please sign in to comment.