mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07: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('topicid')->default(0);
|
||||||
$table->unsignedMediumInteger('userid')->default(0)->index('userid');
|
$table->unsignedMediumInteger('userid')->default(0)->index('userid');
|
||||||
$table->dateTime('added')->nullable()->index('added');
|
$table->dateTime('added')->nullable()->index('added');
|
||||||
$table->text('body')->nullable()->index('body');
|
$table->text('body')->nullable();
|
||||||
$table->text('ori_body')->nullable();
|
$table->text('ori_body')->nullable();
|
||||||
$table->unsignedMediumInteger('editedby')->default(0);
|
$table->unsignedMediumInteger('editedby')->default(0);
|
||||||
$table->dateTime('editdate')->nullable();
|
$table->dateTime('editdate')->nullable();
|
||||||
$table->index(['topicid', 'id'], 'topicid_id');
|
$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('id', true);
|
||||||
$table->integer('torrent_id')->default(0)->index('idx_torrent_id');
|
$table->integer('torrent_id')->default(0)->index('idx_torrent_id');
|
||||||
$table->integer('custom_field_id')->default(0)->index('idx_field_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('created_at');
|
||||||
$table->dateTime('updated_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) {
|
Schema::create('torrents', function (Blueprint $table) {
|
||||||
$table->mediumIncrements('id');
|
$table->mediumIncrements('id');
|
||||||
$table->binary('info_hash')->unique('info_hash');
|
|
||||||
$table->string('name')->default('')->index('name');
|
$table->string('name')->default('')->index('name');
|
||||||
$table->string('filename')->default('');
|
$table->string('filename')->default('');
|
||||||
$table->string('save_as')->default('');
|
$table->string('save_as')->default('');
|
||||||
@@ -65,6 +64,8 @@ class CreateTorrentsTable extends Migration
|
|||||||
$table->index(['category', 'visible', 'banned'], 'category_visible_banned');
|
$table->index(['category', 'visible', 'banned'], 'category_visible_banned');
|
||||||
$table->index(['visible', 'banned', 'pos_state', 'id'], 'visible_banned_pos_id');
|
$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) {
|
if (!WITH_LARAVEL) {
|
||||||
throw new \RuntimeException('Laravel is not avaliable.');
|
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);
|
$result = exec($command, $output, $result_code);
|
||||||
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||||
$install->doLog("output: " . json_encode($output));
|
$install->doLog("output: " . json_encode($output));
|
||||||
@@ -127,7 +127,7 @@ if ($currentStep == 4) {
|
|||||||
$install->saveSettings($settings);
|
$install->saveSettings($settings);
|
||||||
// $install->importInitialData();
|
// $install->importInitialData();
|
||||||
//use seed
|
//use seed
|
||||||
$command = "php " . ROOT_PATH . "artisan install:init_data";
|
$command = "php " . ROOT_PATH . "artisan db:seed";
|
||||||
$result = exec($command, $output, $result_code);
|
$result = exec($command, $output, $result_code);
|
||||||
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||||
$install->doLog("output: " . json_encode($output));
|
$install->doLog("output: " . json_encode($output));
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ if ($currentStep == 3) {
|
|||||||
while ($isPost) {
|
while ($isPost) {
|
||||||
try {
|
try {
|
||||||
sql_query('SET sql_mode=(SELECT REPLACE(@@sql_mode,"NO_ZERO_DATE", ""))');
|
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);
|
$result = exec($command, $output, $result_code);
|
||||||
$update->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
$update->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||||
$update->doLog("output: " . json_encode($output));
|
$update->doLog("output: " . json_encode($output));
|
||||||
|
|||||||
Reference in New Issue
Block a user