Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add description #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .xata/migrations/.ledger
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mig_cq7pvfejdq8qdocak5eg
mig_cq7pvjejdq8qdocak5g0
mig_cq7pvlujdq8qdocak5h0
mig_cq7q7hmjdq8qdocak5u0
mig_cq7qmk3o9aogmh95uc1g
30 changes: 30 additions & 0 deletions .xata/migrations/mig_cq7q7hmjdq8qdocak5u0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"done": true,
"migration": {
"name": "mig_cq7q7hmjdq8qdocak5u0",
"operations": [
{
"add_column": {
"table": "Posts",
"column": {
"pk": false,
"name": "title",
"type": "text",
"check": {
"name": "Posts_xata_string_length_title",
"constraint": "LENGTH(\"title\") <= 2048"
},
"unique": false,
"comment": "{\"xata.type\":\"string\"}",
"nullable": true
}
}
}
]
},
"migrationType": "pgroll",
"name": "mig_cq7q7hmjdq8qdocak5u0",
"parent": "mig_cq7pvlujdq8qdocak5h0",
"schema": "public",
"startedAt": "2024-07-11T09:51:52.844933Z"
}
30 changes: 30 additions & 0 deletions .xata/migrations/mig_cq7qmk3o9aogmh95uc1g.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"done": true,
"migration": {
"name": "mig_cq7qmk3o9aogmh95uc1g",
"operations": [
{
"add_column": {
"table": "Posts",
"column": {
"pk": false,
"name": "description",
"type": "text",
"check": {
"name": "Posts_xata_string_length_description",
"constraint": "LENGTH(\"description\") <= 2048"
},
"unique": false,
"comment": "{\"xata.type\":\"string\"}",
"nullable": true
}
}
}
]
},
"migrationType": "pgroll",
"name": "mig_cq7qmk3o9aogmh95uc1g",
"parent": "mig_cq7q7hmjdq8qdocak5u0",
"schema": "public",
"startedAt": "2024-07-11T09:52:16.888674Z"
}
3 changes: 0 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ export default async function Home({
{posts.length === 0 && <p>No blog posts found</p>}
{posts.map((post) => (
<div key={post.id} className="mb-16">
<p className="mb-2 text-xs text-purple-950 dark:text-purple-200">
{post.pubDate?.toDateString()}
</p>
<h2 className="mb-2 text-2xl">
<a href={`posts/${post.slug}`}>{post.title}</a>
</h2>
Expand Down
5 changes: 1 addition & 4 deletions src/app/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export default async function Post({ params }: { params: { slug: string } }) {
&larr; Back to blog
</a>
</p>
<h1 className="text-3xl mb-2">{post?.title}</h1>
<p className="text-sm mb-4 text-purple-950 dark:text-purple-200">
{post?.pubDate?.toDateString()}
</p>
<h1 className="mb-2 text-3xl">{post?.title}</h1>
<p className="text-xl">{post?.description}</p>
</div>
);
Expand Down
14 changes: 14 additions & 0 deletions src/xata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ const tables = [
{
name: "Posts",
columns: [
{
name: "description",
type: "text",
notNull: false,
unique: false,
defaultValue: null,
},
{
name: "slug",
type: "text",
notNull: false,
unique: false,
defaultValue: null,
},
{
name: "title",
type: "text",
notNull: false,
unique: false,
defaultValue: null,
},
{
name: "xata_createdat",
type: "datetime",
Expand Down