General Rights Management Design chapter (ii)--Database design

Source: Internet
Author: User
Tags datetime

After we have cleared up the object relationship, let's proceed to the design of the database. When modeling a database, the relationship between N and N is generally required to include an association table to indicate the relationship between the two. Preliminary estimate, this system needs at least 10 tables, namely: Permission table, user table, Role table, Group table, User Rights association table, User Role Association table, Role Rights Association table, Group Rights Association table, Group Role Association table, User Group Association table. Of course, it may also lead to some related tables. Let's draw the tables in the PowerDesigner.

The tables and their relationships are as follows:

1. User table

User table (TUser)
Field name Field Type Note
Record identification tu_id bigint PK, NOT NULL
Affiliated organizations to_id bigint FK, NOT NULL
Login account Login_name VARCHAR (64) NOT NULL
User password Password VARCHAR (64) NOT NULL
User name Vsername VARCHAR (64) NOT NULL
Mobile phone number Mobile varchar (20)
E-Mail Email VARCHAR (64)
Creation time Gen_time Datetime NOT NULL
Logon time Login_time Datetime
Last logon time Last_login_time Datetime
Number of Logins Count bigint NOT NULL

2. Role table

not null
Field name field type Note
role ID tr_id bigint pk, NOT null
parent role ID parent_tr_id bigint not null
role_name varchar ()
Create time gen_time datetime not null
role description desc Ription varchar  

Related Article

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.