Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cyber Security Cards › Revision Cards

Database Schema

Database Schema The tables for the reels app: users, posts and likes. Store only the S3 key , like videos/2026/09/abc.mp4 , in the database. Make a fresh presigned link each time a page loads. Saving the full presigned URL in the database. After about 20 minutes every video says Access Denied .

Database Schema The tables for the reels app: users, posts and likes. Store only the S3 key , like videos/2026/09/abc.mp4 , in the database. Make a fresh presigned link each time a page loads. Saving the full presigned URL in the database. After about 20 minutes every video says Access Denied .
Database Schema · Download PNG
Read card text

What this card says

What it is

The tables for the reels app: users, posts and likes.

Key design point

Store only the S3 key, like videos/2026/09/abc.mp4, in the database.

Make a fresh presigned link each time a page loads.

Common mistake

Saving the full presigned URL in the database. After about 20 minutes every video says Access Denied.

Design choiceReason
Video file in S3, only s3_key in MySQLDatabases are bad at storing large files; S3 is cheap and…
password_hash column, VARCHAR(255)Stores bcrypt/argon2 hashes, never plain passwords
likes composite primary key (user_id, post_id)The database itself prevents double likes
ON DELETE CASCADEDeleting a user removes their posts and likes – no orphan…
CHECK on post_typeA video post without a key, or a text post without text, is…

Learn more in the lesson: 16.4 Database Schema

See all Ravi Sir's Cyber Security Cards