Backend Database - shibotsu/obs-clone GitHub Wiki
🗃️ Database Schema
This document describes the database structure used in the backend of the project. It includes details about the tables, their relationships, and any important considerations for managing the database.
🛠️ Technology
- SQLite (local development)
- Laravel Migrations for schema management
- DBeaver for database GUI
- Eloquent ORM used in code
🧩 Tables Overview
📄 Users
Stores information about registered users.
Columns:
id
(Primary Key): Unique identifier for the user.username
(String): The user's chosen username.email
(String): The user's email address.password
(String): The hashed password.birthday
(Date): The user's date of birth.number_of_followers
(BigInteger): The number of followers for a specific user.profile_picture
(String): The path to the user's profile picture.created_at
(Timestamp): When the user was created.updated_at
(Timestamp): When the user was last updated.email_verified_at
(Timestamp): When the email was verified.remember_token
(String): Token for "remember me" functionality.
📄 Follows
Stores information about user follow relationships.
Columns:
id
(Primary Key): Unique identifier for the follow record.follower_id
(Foreign Key): ID of the user who is following.following_id
(Foreign Key): ID of the user being followed.created_at
(Timestamp): When the follow record was created.updated_at
(Timestamp): When the follow record was last updated.
Notes:
- The combination of
follower_id
andfollowing_id
must be unique to prevent a user from following the same person twice.
Relationships:
follower_id
andfollowing_id
referenceusers(id)
— Many-to-Many: users can follow multiple users.
🔁 Migrations
Use Laravel migrations to manage the database schema. Here are the most important commands:
php artisan migrate
php artisan migrate:fresh