aboutsummaryrefslogtreecommitdiff

@astrojs/db

0.15.0

Minor Changes

0.14.14

Patch Changes

  • #13772 83193d4 Thanks @Adammatthiesen! - Fix options parsing for the libsql client connection to ensure that proper values are being set when adding URLSearchParams to the ASTRO_DB_REMOTE_URL

  • #13783 1609044 Thanks @Adammatthiesen! - Modify Database type to allow transactions to be properly typed now that Astro Studio has sunset.

0.14.13

Patch Changes

0.14.12

Patch Changes

0.14.11

Patch Changes

0.14.10

Patch Changes

0.14.9

Patch Changes

0.14.8

Patch Changes

  • #13343 a001a75 Thanks @dreyfus92! - Fix Astro DB seed failing when project path contains spaces. This resolves by properly decoding URL pathnames that contain encoded spaces (%20) before passing them to Vite's ssrLoadModule.

  • Updated dependencies []:

  • @astrojs/studio@0.1.4

0.14.7

Patch Changes

  • #13314 797a948 Thanks @jlebras! - Expose ilike function from drizzle-orm

  • Updated dependencies []:

  • @astrojs/studio@0.1.4

0.14.6

Patch Changes

0.14.5

Patch Changes

0.14.4

Patch Changes

0.14.1

Patch Changes

  • #12628 348c71e Thanks @ascorbic! - Fixes a bug that caused an error to be logged about invalid entrypoints

  • Updated dependencies []:

  • @astrojs/studio@0.1.2

0.14.0

Minor Changes

  • #12008 5608338 Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

Starting from this release, no breaking changes will be introduced unless absolutely necessary.

To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.

Patch Changes

0.14.0-beta.2

Patch Changes

0.14.0-beta.1

Minor Changes

  • #12008 5608338 Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

Starting from this release, no breaking changes will be introduced unless absolutely necessary.

To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.

Patch Changes

  • Updated dependencies []:
  • @astrojs/studio@0.1.1

0.14.3

Patch Changes

  • #11435 f32a7a8 Thanks @haivuw! - Fixes a bug where astro:db:seed couldn't access to the environment variable ASTRO_DATABASE_FILE

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.14.2

Patch Changes

  • #12118 f47b347 Thanks @Namchee! - Removes the strip-ansi dependency in favor of the native Node API

  • #12089 6e06e6e Thanks @Fryuni! - Fixes initial schema push for local file and in-memory libSQL DB

  • #12089 6e06e6e Thanks @Fryuni! - Fixes relative local libSQL db URL

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.14.1

Patch Changes

  • #11894 cc820c5 Thanks @Fryuni! - Fixes mixed environment variable for app token when using DB commands with libSQL remote.

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.14.0

Minor Changes

  • #11385 d6611e8 Thanks @Fryuni! - Adds support for connecting Astro DB to any remote LibSQL server. This allows Astro DB to be used with self-hosting and air-gapped deployments.

To connect Astro DB to a remote LibSQL server instead of Studio, set the following environment variables:

  • ASTRO_DB_REMOTE_URL: the connection URL to your LibSQL server
  • ASTRO_DB_APP_TOKEN: the auth token to your LibSQL server

Details of the LibSQL connection can be configured using the connection URL. For example, memory:?syncUrl=libsql%3A%2F%2Fdb-server.example.com would create an in-memory embedded replica for the LibSQL DB on libsql://db-server.example.com.

For more details, please visit the Astro DB documentation

Patch Changes

  • Updated dependencies []:
  • @astrojs/studio@0.1.1

0.13.2

Patch Changes

  • #11744 b677429 Thanks @bluwy! - Disables the WebSocket server when creating a Vite server for loading config files

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.13.1

Patch Changes

  • #11733 391324d Thanks @bluwy! - Reverts back to yargs-parser package for CLI argument parsing

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.13.0

Minor Changes

The generated .d.ts file is now at a new location:

diff - .astro/db-types.d.ts + .astro/integrations/astro_db/db.d.ts

The following line can now be removed from src/env.d.ts:

diff - /// <reference path="../.astro/db-types.d.ts" />

Patch Changes

  • #11645 849e4c6 Thanks @bluwy! - Refactors internally to use node:util parseArgs instead of yargs-parser

  • Updated dependencies []:

  • @astrojs/studio@0.1.1

0.12.0

Minor Changes

Astro integration hooks can now be extended and as such @astrojs/db no longer needs to declare it's own integration type. Using AstroIntegration will have the same type.

If you were using the AstroDbIntegration type, apply this change to your integration code:

```diff - import { defineDbIntegration, type AstroDbIntegration } from '@astrojs/db/utils'; + import { defineDbIntegration } from '@astrojs/db/utils'; import type { AstroIntegration } from 'astro';

  • export default (): AstroDbIntegration => {
  • export default (): AstroIntegration => { return defineDbIntegration({ name: 'your-integration', hooks: {}, }); } ```

Patch Changes

  • Updated dependencies []:
  • @astrojs/studio@0.1.1

0.11.7

Patch Changes

  • #11331 f1b78a4 Thanks @bluwy! - Relaxes exports condition to allow importing ESM from CJS

  • Updated dependencies [f1b78a4]:

  • @astrojs/studio@0.1.1

0.11.6

Patch Changes

  • #11262 9b03023 Thanks @nezouse! - Import type Database from correct file

  • Updated dependencies []:

  • @astrojs/studio@0.1.0

0.11.5

Patch Changes

  • #11216 29463df Thanks @OliverSpeir! - Export type Database from @astrojs/db/runtime

  • Updated dependencies []:

  • @astrojs/studio@0.1.0

0.11.4

Patch Changes

Users who are members of a team workspace in Astro Studio can now choose between those and their personal workspace when running astro db link.

  • #11091 e14ce57 Thanks @matthewp! - Fix inconsistent result type using raw SQL

  • Updated dependencies []:

  • @astrojs/studio@0.1.0

0.11.3

Patch Changes

0.11.2

Patch Changes

  • #11027 eb1d9a4 Thanks @bholmesdev! - Fix isDbError() returning false for remote database errors. Astro will now return a LibsqlError in development and production.

0.11.1

Patch Changes

0.11.0

Minor Changes

  • #10919 44bafa9 Thanks @bholmesdev! - - Fix duplicate table recreations when you start your dev server.
  • Remove eager re-seeding when updating your seed file in development. Seeding still runs on dev server startup for SQLite inspector tools.

0.10.7

Patch Changes

Fixes a type error when passing the output of defineTable() to the utility and returns a more detailed type inferred from the columns of the passed table config.

  • #10918 ca605f4 Thanks @matthewp! - Provide a better error message when app token is missing in CI

  • #10925 a0c77fc Thanks @Princesseuh! - Fixes ASTRO_DATABASE_FILE not correctly resolving relative paths (e.g. ASTRO_DATABASE_FILE=./api/database.db

0.10.6

Patch Changes

  • #10816 8e6eb62 Thanks @bholmesdev! - Add astro login support from online editors like Stackblitz and GitHub Codespaces

0.10.5

Patch Changes

0.10.4

Patch Changes

0.10.3

Patch Changes

0.10.2

Patch Changes

0.10.1

Patch Changes

0.10.0

Minor Changes

0.9.11

Patch Changes

0.9.10

Patch Changes

0.9.9

Patch Changes

0.9.8

Patch Changes

## Migration

You can update your indexes configuration object to an array like so:

```diff import { defineDb, defineTable, column } from 'astro:db';

const Comment = defineTable({ columns: { postId: column.number(),

  body: column.text(),
},
  • indexes: {
  • postIdIdx: { on: 'postId' },
  • authorPostIdIdx: { on: ['author, postId'], unique: true },
  • },
  • indexes: [
  • { on: 'postId' / 'name' is optional / },
  • { on: ['author, postId'], unique: true },
  • ] }) ```

This example will generate indexes with the names Comment_postId_idx and Comment_author_postId_idx, respectively. You can specify a name manually by adding the name attribute to a given object. This name will be global, so ensure index names do not conflict between tables.

0.9.7

Patch Changes

0.9.6

Patch Changes

When running the build astro build without the --remote, either require a DATABASE_FILE variable be defined, which means you are going expert-mode and having your own database, or error suggesting to use the --remote flag.

0.9.5

Patch Changes

0.9.4

Patch Changes

0.9.3

Patch Changes

0.9.2

Patch Changes

0.9.1

Patch Changes

0.9.0

Minor Changes

Patch Changes

0.8.8

Patch Changes

0.8.7

Patch Changes

0.8.6

Patch Changes

0.8.5

Patch Changes

0.8.4

Patch Changes

0.8.3

Patch Changes

0.8.2

Patch Changes

0.8.1

Patch Changes

0.8.0

Minor Changes

Patch Changes

0.7.2

Patch Changes

0.7.1

Patch Changes

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 to defineDb

Minor Changes

To migrate a seed file, wrap your existing code in a default function export:

```diff // db/seed.ts import { db, Table } from 'astro:db';

To get TypeScript support for the astro:db:setup hook, wrap your integration object in the defineDbIntegration() utility:

```js 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 additional astro: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 the asDrizzleTable() utility to wrap your table definitions in the seed file.

```js // config.ts import { defineTable, column } from 'astro:db';

export const Pets = defineTable({ columns: { name: column.text(), age: column.number(), }, }); ```

```js // 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 },
]);

} ```

Patch Changes

0.6.5

Patch Changes

0.6.4

Patch Changes

0.6.3

Patch Changes

0.6.2

Patch Changes

0.6.1

Patch Changes

0.6.0

Minor Changes

Patch Changes

0.5.0

Minor Changes

0.4.1

Patch Changes

0.4.0

Minor Changes