mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 17:37:23 +08:00
fix migration file error
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Install;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class InitData extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install:init_data';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Initialize data.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
$this->call('db:seed');
|
||||
});
|
||||
$this->info("[INIT DATA] success.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Install;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Migrate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install:migrate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Migrate tables.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
$this->call('migrate');
|
||||
});
|
||||
$this->info("[MIGRATE TABLE] success.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,13 @@ class CreatePostsTable extends Migration
|
||||
$table->unsignedMediumInteger('topicid')->default(0);
|
||||
$table->unsignedMediumInteger('userid')->default(0)->index('userid');
|
||||
$table->dateTime('added')->nullable()->index('added');
|
||||
$table->text('body')->nullable()->index('body');
|
||||
$table->text('body')->nullable();
|
||||
$table->text('ori_body')->nullable();
|
||||
$table->unsignedMediumInteger('editedby')->default(0);
|
||||
$table->dateTime('editdate')->nullable();
|
||||
$table->index(['topicid', 'id'], 'topicid_id');
|
||||
});
|
||||
\Illuminate\Support\Facades\DB::statement('alter table posts add fulltext body(body)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,10 +20,11 @@ class CreateTorrentsCustomFieldValuesTable extends Migration
|
||||
$table->integer('id', true);
|
||||
$table->integer('torrent_id')->default(0)->index('idx_torrent_id');
|
||||
$table->integer('custom_field_id')->default(0)->index('idx_field_id');
|
||||
$table->mediumText('custom_field_value')->nullable()->index('idx_field_value');
|
||||
$table->mediumText('custom_field_value')->nullable();
|
||||
$table->dateTime('created_at');
|
||||
$table->dateTime('updated_at');
|
||||
});
|
||||
\Illuminate\Support\Facades\DB::statement('alter table torrents_custom_field_values add index(custom_field_value(191))');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,6 @@ class CreateTorrentsTable extends Migration
|
||||
}
|
||||
Schema::create('torrents', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
$table->binary('info_hash')->unique('info_hash');
|
||||
$table->string('name')->default('')->index('name');
|
||||
$table->string('filename')->default('');
|
||||
$table->string('save_as')->default('');
|
||||
@@ -65,6 +64,8 @@ class CreateTorrentsTable extends Migration
|
||||
$table->index(['category', 'visible', 'banned'], 'category_visible_banned');
|
||||
$table->index(['visible', 'banned', 'pos_state', 'id'], 'visible_banned_pos_id');
|
||||
});
|
||||
$sql = 'alter table torrents add column `info_hash` binary(20) NOT NULL after id, add unique info_hash(`info_hash`)';
|
||||
\Illuminate\Support\Facades\DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($currentStep == 3) {
|
||||
if (!WITH_LARAVEL) {
|
||||
throw new \RuntimeException('Laravel is not avaliable.');
|
||||
}
|
||||
$command = "php " . ROOT_PATH . "artisan install:migrate";
|
||||
$command = "php " . ROOT_PATH . "artisan migrate";
|
||||
$result = exec($command, $output, $result_code);
|
||||
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||
$install->doLog("output: " . json_encode($output));
|
||||
@@ -127,7 +127,7 @@ if ($currentStep == 4) {
|
||||
$install->saveSettings($settings);
|
||||
// $install->importInitialData();
|
||||
//use seed
|
||||
$command = "php " . ROOT_PATH . "artisan install:init_data";
|
||||
$command = "php " . ROOT_PATH . "artisan db:seed";
|
||||
$result = exec($command, $output, $result_code);
|
||||
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||
$install->doLog("output: " . json_encode($output));
|
||||
|
||||
@@ -91,7 +91,7 @@ if ($currentStep == 3) {
|
||||
while ($isPost) {
|
||||
try {
|
||||
sql_query('SET sql_mode=(SELECT REPLACE(@@sql_mode,"NO_ZERO_DATE", ""))');
|
||||
$command = "php " . ROOT_PATH . "artisan install:migrate";
|
||||
$command = "php " . ROOT_PATH . "artisan migrate";
|
||||
$result = exec($command, $output, $result_code);
|
||||
$update->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||
$update->doLog("output: " . json_encode($output));
|
||||
|
||||
Reference in New Issue
Block a user