0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

wip: demo ready

This commit is contained in:
bholmesdev 2024-03-01 11:15:39 -05:00
parent aba33eef3a
commit 37585ce5cb
3 changed files with 16 additions and 22 deletions

View file

@ -1,5 +1,4 @@
import { defineDB, defineTable, column } from 'astro:db';
import { Themes } from './theme';
import { defineDB, defineTable, column, sql, NOW } from 'astro:db';
const Author = defineTable({
columns: {
@ -7,6 +6,20 @@ const Author = defineTable({
},
});
const Themes = defineTable({
columns: {
name: column.text(),
added: column.date({
default: sql`CURRENT_TIMESTAMP`,
}),
updated: column.date({
default: NOW,
}),
isDark: column.boolean({ default: sql`TRUE` }),
owner: column.text({ optional: true, default: sql`NULL` }),
},
});
export default defineDB({
tables: { Author, Themes },
});

View file

@ -1,8 +1,4 @@
import { db, Author } from 'astro:db';
import { Themes as ThemesConfig } from './theme';
import { asDrizzleTable } from '@astrojs/db/utils';
const Themes = asDrizzleTable('Themes', ThemesConfig);
import { db, Themes, Author } from 'astro:db';
await db
.insert(Themes)

View file

@ -1,15 +0,0 @@
import { defineTable, column, NOW, sql } from 'astro:db';
export const Themes = defineTable({
columns: {
name: column.text(),
added: column.date({
default: sql`CURRENT_TIMESTAMP`,
}),
updated: column.date({
default: NOW,
}),
isDark: column.boolean({ default: sql`TRUE` }),
owner: column.text({ optional: true, default: sql`NULL` }),
},
});