فهرست منبع

单词表迁移

visuddhinanda 4 سال پیش
والد
کامیت
775a9933b5

+ 3 - 0
db/postgresql/migrations/2021-11-20-091303_bookword/down.sql

@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+DROP INDEX IF EXISTS bookword_wordindex;
+DROP TABLE bookword;

+ 13 - 0
db/postgresql/migrations/2021-11-20-091303_bookword/up.sql

@@ -0,0 +1,13 @@
+-- Your SQL goes here
+
+CREATE TABLE bookword 
+(
+	id SERIAL PRIMARY KEY,
+	book INTEGER  NOT NULL, 
+	wordindex INTEGER  NOT NULL, 
+	count INTEGER NOT NULL,
+    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+-- 索引:
+CREATE INDEX bookword_wordindex ON bookword (wordindex);

+ 3 - 0
db/postgresql/migrations/2021-11-20-093640_books/down.sql

@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+
+DROP TABLE books;

+ 10 - 0
db/postgresql/migrations/2021-11-20-093640_books/up.sql

@@ -0,0 +1,10 @@
+-- Your SQL goes here
+
+CREATE TABLE books 
+(
+	id SERIAL PRIMARY KEY,
+	book INTEGER, 
+	paragraph INTEGER, 
+	title TEXT,
+    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+);

+ 4 - 0
db/postgresql/migrations/2021-11-20-221521_word/down.sql

@@ -0,0 +1,4 @@
+-- This file should undo anything in `up.sql`
+DROP INDEX IF EXISTS word_book_paragraph ;
+DROP INDEX IF EXISTS ord_wordindex ;
+DROP TABLE word ;

+ 19 - 0
db/postgresql/migrations/2021-11-20-221521_word/up.sql

@@ -0,0 +1,19 @@
+-- Your SQL goes here
+-- 表:word
+CREATE TABLE word 
+(
+	id SERIAL PRIMARY KEY, 
+	sn INTEGER NOT NULL , 
+	book INTEGER NOT NULL, 
+	paragraph INTEGER NOT NULL, 
+	wordindex INTEGER NOT NULL, 
+	bold INTEGER NOT NULL  DEFAULT (0), 
+	weight INTEGER  NOT NULL  DEFAULT (1),
+	created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+-- 索引:pali
+CREATE INDEX word_book_paragraph ON word (book, paragraph);
+
+-- 索引:wordindex1
+CREATE INDEX word_wordindex ON word (wordindex);

+ 4 - 0
db/postgresql/migrations/2021-11-20-222858_wordindex/down.sql

@@ -0,0 +1,4 @@
+-- This file should undo anything in `up.sql`
+DROP INDEX IF EXISTS wordindex_worden ;
+DROP INDEX IF EXISTS wordindex_word ;
+DROP TABLE wordindex ;

+ 20 - 0
db/postgresql/migrations/2021-11-20-222858_wordindex/up.sql

@@ -0,0 +1,20 @@
+-- Your SQL goes here
+
+-- 表:wordindex
+CREATE TABLE wordindex 
+(
+	id SERIAL PRIMARY KEY, 
+	word TEXT NOT NULL UNIQUE, 
+	word_en TEXT  NOT NULL, 
+	count INTEGER NOT NULL DEFAULT (0), 
+	normal INTEGER NOT NULL DEFAULT (0), 
+	bold INTEGER NOT NULL DEFAULT (0), 
+	is_base INTEGER NOT NULL DEFAULT (0), 
+	len INTEGER NOT NULL DEFAULT (0), 
+	final INTEGER,
+	created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+-- 索引:
+CREATE INDEX wordindex_worden ON wordindex (word_en);
+CREATE INDEX wordindex_word ON wordindex (word);