From 37585ce5cb4cce8dcc750d8752e0eb02418b5c87 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Fri, 1 Mar 2024 11:15:39 -0500 Subject: [PATCH] wip: demo ready --- packages/db/test/fixtures/basics/db/config.ts | 17 +++++++++++++++-- packages/db/test/fixtures/basics/db/seed.ts | 6 +----- packages/db/test/fixtures/basics/db/theme.ts | 15 --------------- 3 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 packages/db/test/fixtures/basics/db/theme.ts diff --git a/packages/db/test/fixtures/basics/db/config.ts b/packages/db/test/fixtures/basics/db/config.ts index b2ed2066f1e1..60b0b2295d54 100644 --- a/packages/db/test/fixtures/basics/db/config.ts +++ b/packages/db/test/fixtures/basics/db/config.ts @@ -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 }, }); diff --git a/packages/db/test/fixtures/basics/db/seed.ts b/packages/db/test/fixtures/basics/db/seed.ts index c1b61e0996db..8f47092a9cb9 100644 --- a/packages/db/test/fixtures/basics/db/seed.ts +++ b/packages/db/test/fixtures/basics/db/seed.ts @@ -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) diff --git a/packages/db/test/fixtures/basics/db/theme.ts b/packages/db/test/fixtures/basics/db/theme.ts deleted file mode 100644 index d3b89b68c4b8..000000000000 --- a/packages/db/test/fixtures/basics/db/theme.ts +++ /dev/null @@ -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` }), - }, -});