Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
8 KiB
@astrojs/db
0.7.1
Patch Changes
- #10378
41dca1e413c2f1e38f0326bd6241ccbf9b8ee0e4
Thanks @FredKSchott! - Handle new schema API response format
0.7.0
Minor Changes
0.7.0
Breaking Changes
- The seed file now requires an
export default async function()
wrapper defineDB
has been renamed todefineDb
Minor Changes
-
#10334
bad9b583a267e239ba52237d45a89063ea277200
Thanks @delucis! - Changes the seed file format to require exporting a default function instead of running seed code at the top level.To migrate a seed file, wrap your existing code in a default function export:
// db/seed.ts import { db, Table } from 'astro:db'; + export default async function() { await db.insert(Table).values({ foo: 'bar' }); + }
-
#10352
06fe94e29de97290cb41c4f862ab88f48cda3d4a
Thanks @bholmesdev! - Introduceastro build --remote
to build with a remote database connection. Runningastro build
plain will use a local database file, and--remote
will authenticate with a studio app token. -
#10321
2e4958c8a75dc9836efcc7dd272fb8ed4187c000
Thanks @delucis! - Adds support for integrations providingastro:db
configuration and seed files, using the newastro:db:setup
hook.To get TypeScript support for the
astro:db:setup
hook, wrap your integration object in thedefineDbIntegration()
utility:import { defineDbIntegration } from '@astrojs/db/utils'; export default function MyDbIntegration() { return defineDbIntegration({ name: 'my-astro-db-powered-integration', hooks: { 'astro:db:setup': ({ extendDb }) => { extendDb({ configEntrypoint: '@astronaut/my-package/config', seedEntrypoint: '@astronaut/my-package/seed', }); }, }, }); }
Use the
extendDb
method to register additionalastro:db
config and seed files.Integration config and seed files follow the same format as their user-defined equivalents. However, often while working on integrations, you may not be able to benefit from Astro’s generated table types exported from
astro:db
. For full type safety and autocompletion support, use theasDrizzleTable()
utility to wrap your table definitions in the seed file.// config.ts import { defineTable, column } from 'astro:db'; export const Pets = defineTable({ columns: { name: column.text(), age: column.number(), }, });
// seed.ts import { asDrizzleTable } from '@astrojs/db/utils'; import { db } from 'astro:db'; import { Pets } from './config'; export default async function () { // Convert the Pets table into a format ready for querying. const typeSafePets = asDrizzleTable('Pets', Pets); await db.insert(typeSafePets).values([ { name: 'Palomita', age: 7 }, { name: 'Pan', age: 3.5 }, ]); }
-
#10361
988aad6705e5ee129cf3a28da80aca4229052bb3
Thanks @bholmesdev! - Add support for batch queries withdb.batch()
. This includes an internal bump to Drizzle v0.29.
Patch Changes
-
#10357
5a9dab286f3f436f3dce18f3b13a2cd9b774a8ef
Thanks @bholmesdev! - Fix runtime export error when building with the node adapter -
#10348
9f422e9bd338c1f6deee8f727143bf801a6b1651
Thanks @matthewp! - RenameexperimentalVersion
toversion
-
#10364
3f27e096283b6b477c4a66d0a7df52feaa3f4233
Thanks @delucis! - Renames the Astro DBdefineDB()
helper todefineDb()
0.6.5
Patch Changes
- #10350
393ad9b2aa9fde45eb14b8b01ff3526063772452
Thanks @Fryuni! - Includes./virtual.d.ts
file that was previously unpublished
0.6.4
Patch Changes
- #10342
a2e9b2b936666b2a4779feb00dcb8ff0ab82c2ec
Thanks @matthewp! - Fixes @astrojs/db loading TS in the fixtures
0.6.3
Patch Changes
- #10340
a60861c960bf3d24af9b2784b5b333855c968731
Thanks @bholmesdev! - Ensureastro:db
types exist in yourdb/config.ts
before running type generation.
0.6.2
Patch Changes
- #10336
f2e60a96754ed1d86001fe4d5d3a0c0ef657408d
Thanks @FredKSchott! - Add back confirmation handling on verify and push
0.6.1
Patch Changes
- #10315
78ddfadbf9cc5a12a9bd25eab64ec8ec1bd8617d
Thanks @bholmesdev! - Fix type definitions forastro:db
0.6.0
Minor Changes
- #10312
93ec9e264a1dbdff61233289418612f558508135
Thanks @FredKSchott! - Revamp migrations system
Patch Changes
- #10313
cb00c8b6927242369debe92ad2bc7e791616696a
Thanks @FredKSchott! - Fix bad package.json types
0.5.0
Minor Changes
- #10280
3488be9b59d1cb65325b0e087c33bcd74aaa4926
Thanks @bholmesdev! - Finalize db API to a shared db/ directory.
0.4.1
Patch Changes
-
#10223
aa45eb9fa60b254e859750d9cef671daa605b213
Thanks @bholmesdev! - Fix: use correct remote database url during production builds -
#10207
5d4ff093a21c072553b2cac6c799d3efa3cb84c0
Thanks @bholmesdev! - Improve error messaging when seeding invalid data.
0.4.0
Minor Changes
f85ace2e66370e522b5a4e9b54c578a02298fe0e
Thanks @matthewp! - @astrojs/db prerelease