Skip to content

Conversation

@ThomasCode92
Copy link
Owner

@ThomasCode92 ThomasCode92 commented Jun 2, 2025

✨ Pull Request Overview

  • πŸ”§ Database Tables Initialized
    The correct tables (for folders and files) have been set up and committed to SingleStore.
  • πŸ“‹ Next Step
    Connect the UI to the database.

πŸ—ƒοΈ Seeding the Database

To seed the database, add a dedicated page with a form that should trigger a server action to populating the database with mock data.

βš™οΈ What It Does

  1. πŸ“ Insert Folders
    Populates the folders table using mock folder data. Each folder receives:

    • A unique id
    • A parent folder (null for the root)
  2. πŸ“„ Insert Files
    Populates the files table with mock file entries, each including:

    • name, size, and url
    • A parent folder ID

🧩 Server Action Logic

"use server";

await db.insert(folders).values(
  mockFolders.map((folder, idx) => ({
    id: idx + 1,
    name: folder.name,
    parent: idx !== 0 ? 1 : null,
  })),
);

await db.insert(files).values(
  mockFiles.map((file, idx) => ({
    id: idx + 1,
    name: file.name,
    size: 5000,
    url: file.url,
    parent: (idx % 3) + 1,
  })),
);

@netlify
Copy link

netlify bot commented Jun 2, 2025

βœ… Deploy Preview for t4s-drive-tutorial ready!

Name Link
πŸ”¨ Latest commit 01daa4c
πŸ” Latest deploy log https://app.netlify.com/projects/t4s-drive-tutorial/deploys/683de31c36dd5700084fddc8
😎 Deploy Preview https://deploy-preview-3--t4s-drive-tutorial.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ThomasCode92 ThomasCode92 self-assigned this Jun 2, 2025
@ThomasCode92 ThomasCode92 merged commit 18ea426 into main Jun 2, 2025
5 checks passed
@ThomasCode92 ThomasCode92 deleted the db-schema-tables branch June 2, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants