Skip to content

Commit 30e1abb

Browse files
committed
feat: Add in database
1 parent b2ad1dc commit 30e1abb

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE posts;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE TABLE posts (
2+
id integer primary key,
3+
title varchar not null,
4+
slug varchar not null,
5+
content text not null
6+
)

database/migrations/00002_add base data.down.sql

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO posts (title, slug, content) VALUES (
2+
"My First Post!",
3+
"2025-my-first-post",
4+
"This is my first post. I hope you enjoy it, and it's the start of something beeg."
5+
)

database/queries/posts.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- name: ListPosts :many
2+
SELECT * FROM posts ORDER BY id DESC;
3+
4+
-- name: InsertPost :exec
5+
INSERT INTO posts (title, slug, content) VALUES (
6+
?, ?, ?
7+
);

0 commit comments

Comments
 (0)