Skip to content

Commit

Permalink
chore: move to astro db (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
raae committed May 25, 2024
1 parent d832e7a commit 74eaaa6
Show file tree
Hide file tree
Showing 34 changed files with 864 additions and 1,813 deletions.
33 changes: 0 additions & 33 deletions .dockerignore

This file was deleted.

38 changes: 0 additions & 38 deletions Dockerfile

This file was deleted.

7 changes: 5 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { defineConfig } from "astro/config";
import node from "@astrojs/node";

import db from "@astrojs/db";

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: node({
mode: "standalone",
mode: "standalone"
}),
});
integrations: [db()]
});
42 changes: 42 additions & 0 deletions db/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { defineDb, defineTable, column } from "astro:db";

const Comment = defineTable({
columns: {
id: column.number({ primaryKey: true }),
author: column.text({ optional: true }),
content: column.text({ optional: true }),
},
});

const Playlist = defineTable({
columns: {
id: column.number({ primaryKey: true }),
name: column.text(),
description: column.text({ optional: true }),
createdBy: column.text({ optional: true }),
},
});

const Episode = defineTable({
columns: {
id: column.text({ primaryKey: true }),
title: column.text(),
description: column.text({ optional: true }),
audio: column.text(),
},
});

const PlaylistEpisode = defineTable({
columns: {
playlistId: column.number({
references: () => Playlist.columns.id,
}),
episodeId: column.text({
references: () => Episode.columns.id,
}),
},
});

export default defineDb({
tables: { Comment, Playlist, Episode, PlaylistEpisode },
});
75 changes: 75 additions & 0 deletions db/seed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { db, Comment, Playlist, Episode, PlaylistEpisode } from "astro:db";

export default async function () {
await db.insert(Comment).values([
{ author: "Queen", content: "Hope you like Astro DB!" },
{ author: "Captain", content: "Enjoy!" },
]);

await db.insert(Playlist).values([
{
id: 1,
name: "Queen's Playlist",
description: "Hope you like Astro DB!",
createdBy: "Queen",
},
{ id: 2, name: "Captain's Playlist", createdBy: "Captain Ola" },
]);

await db.insert(Episode).values([
{
id: "7afc54fd90c24aabb7aaae7b989828f6",
title: "607: Astro Launches an Integrated Database",
description:
"<h2>Show Description</h2><p>Fred K. Schott stops by to talk about Astro announcement of Astro DB. The pluses and minuses of it, and whether you have to always use the database with Astro DB. We get into how to seed your database, upgrading the database, and the almost weirdly generous pricing model.</p>\n" +
`<p><a href="https://shoptalkshow.com/607/" style="background: #ca6533; color: black; padding: 8px 20px; text-decoration: none;">Listen on Website &rarr;</a></p><h2>Guests</h2><h3>Fred K. Schott</h3><p><a href="https://github.com/FredKSchott">Guest's Main URL</a> • <a href="https://twitter.com/fredkschott">Guest's Twitter</a></p><p><p>Co-creator of Astro.</p>\n` +
"</p><h2>Links</h2><ul>\n" +
'<li><a href="https://astro.build/blog/astro-db-deep-dive/">Astro DB: A Deep Dive | Astro</a></li>\n' +
'<li><a href="https://astro.build/db/">Astro DB</a></li>\n' +
'<li><a href="https://astro.build/blog/astro-db-deep-dive/">Astro DB: A Deep Dive | Astro</a></li>\n' +
'<li><a href="https://github.com/tursodatabase/libsql">tursodatabase/libsql: libSQL is a fork of SQLite that is both Open Source, and Open Contributions.</a></li>\n' +
'<li><a href="https://stackblitz.com/">StackBlitz | Instant Dev Environments | Click. Code. Done.</a></li>\n' +
'<li><a href="https://schema.org/">Schema.org - Schema.org</a></li>\n' +
'<li><a href="https://twitter.com/BHolmesDev/status/1767972934855905576">Ben Holmes on X: "Astro built a database platform. How does it work?</a></li>\n' +
'<li><a href="https://clerk.com/">Clerk</a></li>\n' +
'<li><a href="https://lucia-auth.com/">Lucia documentation</a></li>\n' +
'<li><a href="https://planetscale.com/blog/planetscale-forever">PlanetScale forever</a></li>\n' +
'<li><a href="https://www.youtube.com/watch?v=h5SiumTDRIU">Astro DB Just Released</a></li>\n' +
"</ul><h2>Sponsors</h2>",
audio:
"https://www.listennotes.com/e/p/7afc54fd90c24aabb7aaae7b989828f6/",
},
{
id: "af0ece984ab24e01aa9ef0b914794f83",
title: "#23 - Tailwind V4, Layoffs, Do It Anyways, Astro DB",
description:
"<p>Lots has happened this week! New alpha preview of Tailwind V4, more very unexpected layoffs of great people, Jason Lengstorf kicked off the &quot;Do It Anyways&quot; movements, and Astro launched a database!</p>\n" +
"<p><br /></p>\n" +
"<p><strong>Website: </strong>https://navbar.tech</p>\n" +
"<p><strong>Pro Tailwind</strong>: https://www.protailwind.com/</p>\n" +
"<p><br /></p>\n" +
"<p><strong>Build a Twitter Clone with the Next.js App Router and Supabase</strong> (free egghead course): https://egghead.io/courses/build-a-twitter-clone-with-the-next-js-app-router-and-supabase-19bebadb</p>\n" +
"<p><br /></p>\n" +
"<p>Want more NavBar? 🍔🍫</p>\n" +
"<p>🐦 Twitter - https://twitter.com/the_navbar</p>\n" +
"<p>🎥 YouTube - https://www.youtube.com/channel/UCmZK0v8TNlCbizOkbIxQwmw</p>\n" +
"<p>Enjoy these podcasts? Simon and Jon create lots of content 👇</p>\n" +
"<p><strong>Simon</strong></p>\n" +
"<p>🐦 Twitter - https://twitter.com/simonswiss</p>\n" +
"<p>🎥 YouTube - https://www.youtube.com/c/Simonswissdev</p>\n" +
"<p>🥚 egghead - https://egghead.io/q/resources-by-simon-vrachliotis</p>\n" +
"<p><strong>Jon</strong></p>\n" +
"<p>🐦 Twitter - https://twitter.com/jonmeyers_io</p>\n" +
"<p>🎥 YouTube - https://www.youtube.com/c/jonmeyers</p>\n" +
"<p>🥚 egghead - https://egghead.io/q/resources-by-jon-meyers</p>",
audio:
"https://www.listennotes.com/e/p/af0ece984ab24e01aa9ef0b914794f83/",
},
]);

await db.insert(PlaylistEpisode).values([
{ playlistId: 1, episodeId: "7afc54fd90c24aabb7aaae7b989828f6" },
{ playlistId: 2, episodeId: "7afc54fd90c24aabb7aaae7b989828f6" },
{ playlistId: 2, episodeId: "af0ece984ab24e01aa9ef0b914794f83" },
]);
}
14 changes: 0 additions & 14 deletions docker-compose.yml

This file was deleted.

14 changes: 0 additions & 14 deletions drizzle.config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions drizzle/0000_flaky_micromax.sql

This file was deleted.

6 changes: 0 additions & 6 deletions drizzle/0001_worthless_mindworm.sql

This file was deleted.

6 changes: 0 additions & 6 deletions drizzle/0002_gray_omega_red.sql

This file was deleted.

3 changes: 0 additions & 3 deletions drizzle/0002_lumpy_galactus.sql

This file was deleted.

9 changes: 0 additions & 9 deletions drizzle/0003_mushy_marvel_apes.sql

This file was deleted.

7 changes: 0 additions & 7 deletions drizzle/0004_cool_spitfire.sql

This file was deleted.

44 changes: 0 additions & 44 deletions drizzle/meta/0000_snapshot.json

This file was deleted.

Loading

0 comments on commit 74eaaa6

Please sign in to comment.