"Take you from scratch, develop a reading station" chapter III, database table structure

Source: Internet
Author: User

The entire project has only four sheets

book-Book master table, record details of books, including categories, author descriptions, etc.

type-category table, Book category management

menu-Catalogue Chapter Table

properties-Configuration Table

Book table is the master table of Books

Code: Used in the book Code record, it can be considered that the field can determine the book unique

TYPEID: association type table primary key ID, identifying book category

Title: Title

Author: author

Lastmenuid: Latest Chapters directory, associating menu table primary Key ID

Description: Book description

Originalurl (OBSOLETE)

Imageuri: Picture address, this address is relative address. Record the file name of the book display picture

Createtime: Book Entry time

UpdateTime: Last Update time

Roottypeid: main category Id,tpye table primary key ID, details see type table record

Menunum: Number of book catalogs

TextSize: How many words are there in the current book

Menu Chapter Table:

Description: Chapter Name

Prevmenuid: Previous Chapter ID (menu table primary key ID)

Nextmenuid: Next section ID (menu table primary key ID)

BOOKID: Library ID (Book table primary key ID)

Contenturi: Body address (This is the address that the body file is stored on the server)

Createtime: Chapter Entry Time

Code: Chapter code (no specific action)

Mversion: Chapter Versioning (prevents duplicate entry)

The Type table is the book category table:

Description: Category description

Level: Category

ParentID: Owning parent category

Categories are established as described above, Level 1 is the main category, and the sub-category under Lever is 2. The parentid of the subcategory associates the primary key ID of the parent category. The main category has no parent category, i.e. ParentID is 0

One thing to mention here is that the parent class primary key *100 is incremented as the primary key ID of the subcategory. The ID of the parent category is 1 if ID 101

Properties table for configuration purposes, consider the next version of the program is placed in the configuration in the properties.

Now this table has only one configuration

PKey: For the program to read the value of the corresponding pvalue, on the homepage to do the marquee display

The table creation script is given here for your reference:

SETForeign_key_checks=0;-- ------------------------------Table structure for book-- ----------------------------DROP TABLE IF EXISTS' book ';CREATE TABLE' book ' (' ID ')int( One) not NULLAuto_increment COMMENT'Book Master Table', ' Code 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'Book code (default book directory address, also book file retention directory)', ' typeId 'int( One)DEFAULT NULLCOMMENT'category', ' title 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'title', ' author 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'author', ' Lastmenuid 'int( One)DEFAULT '0'COMMENT'latest Chapter Directory ID', ' description 'varchar( -) COLLATE Utf8_binDEFAULT NULLCOMMENT'Introduction Description', ' Originalurl 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'is obsolete', ' Imageuri 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'Image Address', ' Createtime 'timestamp NULL DEFAULT NULLCOMMENT'creation Time', ' UpdateTime 'timestamp NULL DEFAULT NULLCOMMENT'Update Time', ' Roottypeid 'int( One)DEFAULT NULLCOMMENT'main category', ' Menunum 'int( One)DEFAULT '0'COMMENT'Total Chapters',  `textSize`bigint( -)DEFAULT '0'COMMENT'novel word Count',  PRIMARY KEY(' id '),UNIQUE KEY' index_title ' (' Code ') USING BTREE,KEY' fk_mxn08ipa84r1evyt2cnn7jkpi ' (' typeId ', ' Roottypeid '),KEY' fk_6ji3nbliycexuj771dlqn25s3 ' (' Lastmenuid ')) ENGINE=InnoDB auto_increment= A DEFAULTCHARSET=UTF8 COLLATE=Utf8_bin;-- ------------------------------Table structure for menu-- ----------------------------DROP TABLE IF EXISTS' menu ';CREATE TABLE' menu ' (' id ' )int( One) not NULLauto_increment, ' description 'varchar( -) COLLATE Utf8_binDEFAULT NULLCOMMENT'Description', ' Prevmenuid 'int( One)DEFAULT '0'COMMENT'Previous Chapter ID', ' Nextmenuid 'int( One)DEFAULT '0'COMMENT'Next Chapter ID', ' bookId 'int( One)DEFAULT NULLCOMMENT'Book ID', ' Contenturi 'varchar( -) COLLATE Utf8_binDEFAULT NULLCOMMENT'Text Path', ' Createtime 'timestamp NULL DEFAULT NULLCOMMENT'creation Time', ' Code 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'encode (do index)', ' mversion 'varchar( $) COLLATE Utf8_binDEFAULT NULL,  PRIMARY KEY(' id '),UNIQUE KEY' mvserion ' (' mversion ') USING BTREE,KEY' fk_c6rhyxr26doitte59912cid6v ' (' bookId '),CONSTRAINT' Menu_ibfk_1 'FOREIGN KEY(' BookId ')REFERENCES' book ' (' ID ')) ENGINE=InnoDB auto_increment=231 DEFAULTCHARSET=UTF8 COLLATE=Utf8_bin;-- ------------------------------Table structure for properties-- ----------------------------DROP TABLE IF EXISTS' Properties ';CREATE TABLE' Properties ' (' ID ' )int( One) not NULLauto_increment, ' PKey 'varchar( $) COLLATE Utf8_bin not NULL, ' PValue 'varchar( the) COLLATE Utf8_bin not NULL, ' description 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'Description',  PRIMARY KEY(' id ')) ENGINE=InnoDB auto_increment=2 DEFAULTCHARSET=UTF8 COLLATE=Utf8_bin;-- ------------------------------Table structure for type-- ----------------------------DROP TABLE IF EXISTS' type ';CREATE TABLE' type ' (' ID ' )int( One) not NULLauto_increment, ' description 'varchar( $) COLLATE Utf8_binDEFAULT NULLCOMMENT'Category Description',  ` Level`int( One)DEFAULT NULLCOMMENT'Category Level', ' ParentID 'int( One) unsignedDEFAULT '0'COMMENT'parent category',  PRIMARY KEY(' id ')) ENGINE=InnoDB auto_increment=702 DEFAULTCHARSET=UTF8 COLLATE=Utf8_bin;

"Take you from scratch, develop a reading station" chapter III, database table structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.