0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-24 22:46:02 -05:00
astro/packages/db/test/fixtures/glob/astro.config.ts
2024-02-26 18:27:22 -05:00

27 lines
546 B
TypeScript

import db, { defineTable, column } from '@astrojs/db';
import { defineConfig } from 'astro/config';
import { asJson, createGlob } from './utils';
const Quote = defineTable({
columns: {
author: column.text(),
body: column.text(),
file: column.text({ unique: true }),
},
});
export default defineConfig({
db: {
tables: { Quote },
data({ seed, ...ctx }) {
if (ctx.mode === 'dev') {
const glob = createGlob(ctx);
glob('quotes/*.json', {
into: Quote,
parse: asJson,
});
}
},
},
integrations: [db()],
});