Просмотр исходного кода

:construction: migrate WordList

visuddhinanda 4 лет назад
Родитель
Сommit
d5f247d0b4

+ 11 - 0
app/Models/WordList.php

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

+ 40 - 0
database/migrations/2021_12_29_020248_create_word_lists_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateWordListsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('word_lists', function (Blueprint $table) {
+            $table->id();
+            $table->integer('sn')->unique();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('wordindex')->index();
+            $table->integer('bold')->default(0);
+            $table->integer('weight')->default(1);
+			$table->timestamp('created_at')->useCurrent();
+
+            $table->index(["book", "paragraph"]);
+
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('word_lists');
+    }
+}

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

@@ -120,7 +120,7 @@ define("_TABLE_BOOK_WORD_", "book_words");
 //define("_TABLE_WORD_", "word");
 
 define("_FILE_DB_PALI_INDEX_", _DB_ENGIN_.":host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";");
-define("_TABLE_WORD_", "words");
+define("_TABLE_WORD_", "word_lists");
 
 /*
 92万词