Pārlūkot izejas kodu

:construction: migrate WordIndex

visuddhinanda 4 gadi atpakaļ
vecāks
revīzija
fce6befdf8

+ 11 - 0
app/Models/WordIndex.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+class WordIndex extends Model
+{
+    use HasFactory;
+}

+ 39 - 0
database/migrations/2021_12_29_021525_create_word_indices_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateWordIndicesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('word_indices', function (Blueprint $table) {
+            $table->id();
+            $table->string('word',1024)->unique();
+            $table->string('word_en',1024)->index();
+            $table->integer('count')->default(0);
+            $table->integer('normal')->default(0);
+            $table->integer('bold')->default(0);
+            $table->integer('is_base')->default(0);
+            $table->integer('len')->default(0);
+            $table->integer('final');
+			$table->timestamp('created_at')->useCurrent();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('word_indices');
+    }
+}

+ 1 - 1
public/app/config.sample.php

@@ -132,7 +132,7 @@ define("_TABLE_WORD_", "word_lists");
 
 //PostgreSQL
 define("_FILE_DB_WORD_INDEX_", _DB_ENGIN_.":host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";");
-define("_TABLE_WORD_INDEX_", "word_indexs");
+define("_TABLE_WORD_INDEX_", "word_indices");
 
 //单词索引=92万词+单词索引
 //sqlite