- Add @astrojs/db integration - Define Guestbook schema in db/config.ts - Add seed data for development - Update db.ts to use astro:db - Add guestbook section to homepage with form - Update env vars to use ASTRO_DB_REMOTE_URL
16 lines
412 B
TypeScript
16 lines
412 B
TypeScript
import { defineDb, defineTable, column } from 'astro:db';
|
|
|
|
const Guestbook = defineTable({
|
|
columns: {
|
|
id: column.number({ primaryKey: true }),
|
|
name: column.text(),
|
|
message: column.text(),
|
|
url: column.text({ optional: true }),
|
|
createdAt: column.date({ default: new Date() }),
|
|
approved: column.boolean({ default: false }),
|
|
},
|
|
});
|
|
|
|
export default defineDb({
|
|
tables: { Guestbook },
|
|
});
|