← Back to all posts
Why I Split Categories Into Their Own Table
{"id":1,"name":"Tech","slug":"tech","created_at":"2026-09-10T01:46:36.000000Z","updated_at":"2026-09-10T01:46:36.000000Z"}

Why I Split Categories Into Their Own Table

By Nazif · 10 Sep 2026

In the first version of this blog, categories were just a plain text field on each post. It worked, but it meant no real structure, no way to browse by category, and no protection against typos creating duplicate categories like "tech" and "Tech" existing separately. Turning categories into their own table with a proper relationship changed that. Now each post links to a real category record, clicking a category shows only its posts, and deleting a category that still has posts attached is blocked until those posts are reassigned. It's a small structural change, but it made the whole site feel like a real content system instead of a static demo.