fixed:migration 表前缀
This commit is contained in:
parent
cc34e058f0
commit
cba66dfe58
@ -3,6 +3,7 @@ namespace catcher\generate\factory;
|
|||||||
|
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
|
use catcher\Utils;
|
||||||
use JaguarJack\MigrateGenerator\MigrateGenerator;
|
use JaguarJack\MigrateGenerator\MigrateGenerator;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\helper\Str;
|
use think\helper\Str;
|
||||||
@ -30,7 +31,11 @@ class Migration extends Factory
|
|||||||
|
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
if ($table->getName() == $tableName) {
|
if ($table->getName() == $tableName) {
|
||||||
file_put_contents($file, $migrateGenerator->getMigrationContent($table));
|
$content = $migrateGenerator->getMigrationContent($table);
|
||||||
|
$noPrefix = str_replace(Utils::tablePrefix(), '', $tableName);
|
||||||
|
$_content = str_replace($tableName, $noPrefix, $content, $count);
|
||||||
|
file_put_contents($file, $count == 1 ? $_content : $content);
|
||||||
|
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
throw new FailedException('migration generate failed');
|
throw new FailedException('migration generate failed');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user