Create user table
Let's create a user table. A user table is a database table that stores user information. After creating the temporary registration user table, let's create the user table.
What is a user table?
A user table is a database table that stores user information. You need the following fields:
The table name is "user".
Field | Table field name | Type | Constraint |
---|---|---|---|
Row ID | id | 32-bit integer | Primary key, auto-increment |
User ID | code | String | Non-null, unique |
Hashed password | password_crypted | string | non-null |
Email address | String | Non-null |
If there are other input items on the membership registration form such as name, address, phone number, desired conditions, etc., that field is also required.
Create user table with mysql
Let's create a user table with mysql.
create table user ( id int primary key auto_increment, code varchar (150) not null default'', password_crypted varchar (150) not null default'', mail varchar (150) not null default'', unique (mail), unique (code) ) ENGINE = InnoDB CHARSET = utf8mb4;
If utf8mb4 is not supported, replace it with utf8.
Field description
The fields are the same as the temporary registration user table except for the token, so please refer to the article Creating a temporary registration user table.