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:
parent
aba33eef3a
commit
37585ce5cb
3 changed files with 16 additions and 22 deletions
17
packages/db/test/fixtures/basics/db/config.ts
vendored
17
packages/db/test/fixtures/basics/db/config.ts
vendored
|
@ -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 },
|
||||
});
|
||||
|
|
6
packages/db/test/fixtures/basics/db/seed.ts
vendored
6
packages/db/test/fixtures/basics/db/seed.ts
vendored
|
@ -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)
|
||||
|
|
15
packages/db/test/fixtures/basics/db/theme.ts
vendored
15
packages/db/test/fixtures/basics/db/theme.ts
vendored
|
@ -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` }),
|
||||
},
|
||||
});
|
Loading…
Reference in a new issue