Today's learning that I was worried about DB design

Introduction

I will briefly summarize the DB design I learned today.

Identifying necessary tables and columns

-The entity considers the timing when the data is registered. -Active Hash can be used for pull-down. -Columns using ActiveHash are integer type. Also, it is easy to understand if you add _id to the column name. -It is better to handle postal codes and telephone numbers as string type. -Use the data type for the date. -The column that can contain both numbers and characters is a string type. -Do not give column names that can be judged by table names. ex) In the users table, do not set the column name to user_name. It can be name.   ActiveHash ・ Describe the connection on the ER diagram. -Introduce gem'active_hash'.

association

-If there is a one-to-one relationship, describe has_one as the parent and belongs_to as the child. ・ The judgment of parent and child is that if the other cannot exist, the one that does not exist is the "child". ・ Think carefully about where to put the foreign key.

Recommended Posts

Today's learning that I was worried about DB design
About the matter that I was addicted to how to use hashmap
What I researched about Java learning
Summary of points I was worried about when migrating from java to kotlin
A site that was easy to understand when I was a beginner when I started learning Spring Boot