This project sets up the backend for a blogging platform.
The database schema includes the following tables:
onboarding
users
categories
blogs
tags
blog_tags
blog_categories
featured_stories
profiles
user_posts
user_followers
comments
blog_likes
sessions
- PostgreSQL
- SQLc
-
Clone the Repository
git clone https://github.com/codermuss/musarchive.git cd musarchive
-
Create the Database
Create a new database in PostgreSQL.
CREATE DATABASE musarchive;
-
Run Migrations
Use the provided SQL scripts to create the necessary tables and relationships.
make migrateup
-
Install SQLc
Follow the installation instructions from the SQLc documentation.
-
Generate SQLc Code
Generate the type-safe database query code.
sqlc generate
The project includes predefined SQL queries for each table, such as:
-
Onboarding
- Insert:
InsertOnboarding
- Select:
GetOnboarding
- Update:
UpdateOnboarding
- Delete:
DeleteOnboarding
- Insert:
-
Users
- Insert:
InsertUser
- Select:
GetUser
- Update:
UpdateUser
- Delete:
DeleteUser
- Insert:
-
Categories
- Insert:
InsertCategory
- Select:
GetCategory
- Update:
UpdateCategory
- Delete:
DeleteCategory
- Insert:
-
Blogs
- Insert:
InsertBlog
- Select:
GetBlog
- Update:
UpdateBlog
- Delete:
DeleteBlog
- Insert:
-
And many more for other tables...
Feel free to fork this repository and make contributions. Pull requests are welcome!