MCPcopy Create free account
hub / github.com/9d8dev/directory / seed

Function seed

db/seed.ts:4–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { bookmarks, categories } from "./schema";
3
4async function seed() {
5 console.log("🌱 Seeding database...");
6
7 // Create categories
8 console.log("Creating categories...");
9 const categoryData = [
10 {
11 id: "development",
12 name: "Development",
13 description: "Programming and development resources",
14 slug: "development",
15 color: "#0ea5e9",
16 icon: "💻"
17 },
18 {
19 id: "design",
20 name: "Design",
21 description: "Design tools and inspiration",
22 slug: "design",
23 color: "#f43f5e",
24 icon: "🎨"
25 },
26 {
27 id: "productivity",
28 name: "Productivity",
29 description: "Tools and resources for getting things done",
30 slug: "productivity",
31 color: "#22c55e",
32 icon: "⚡"
33 },
34 {
35 id: "learning",
36 name: "Learning",
37 description: "Educational resources and tutorials",
38 slug: "learning",
39 color: "#8b5cf6",
40 icon: "📚"
41 }
42 ];
43
44 const createdCategories = await Promise.all(
45 categoryData.map(async (category) => {
46 const [result] = await db.insert(categories).values(category).returning();
47 return result;
48 })
49 );
50
51 console.log(`Created ${createdCategories.length} categories`);
52
53 // Create bookmarks
54 console.log("Creating bookmarks...");
55 const bookmarkData = [
56 {
57 url: "https://github.com",
58 title: "GitHub",
59 slug: "github",
60 description: "Where the world builds software",
61 categoryId: createdCategories[0].id,

Callers 1

seed.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected