#What is the storage location for Astro DB in the project on local?

3 messages · Page 1 of 1 (latest)

past tusk
#

What is the storage location for Astro DB in the project on local?

radiant nymphBOT
#

Hi @past tusk. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro DB is a fully-managed SQL database designed for the Astro ecosystem. When you run astro dev, a local database is created using LibSQL to manage your data without the need for Docker or a network connection. The database configuration is stored in a db/config.ts file in your project. Here is an example of how it looks:

import { defineDb } from 'astro:db';
export default defineDb({  tables: { },})

You can define tables in this configuration file. For example, to configure a Comment table with required text columns for author and body, you would do:

import { defineDb, defineTable, column } from 'astro:db';
const Comment = defineTable({  columns: {    author: column.text(),    body: column.text(),  }})
export default defineDb({  tables: { Comment },})

Astro DB is added to your project using the astro add db command. If you prefer, you can also install @astrojs/db manually.

For more information, refer to the Astro DB guide (https://docs.astro.build/en/guides/astro-db/).

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: