This project sets up the backend for a blogging platform.
The database schema includes the following tables:
onboardinguserscategoriesblogstagsblog_tagsblog_categoriesfeatured_storiesprofilesuser_postsuser_followerscommentsblog_likessessions
- 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!
