0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/db/CHANGELOG.md
Houston (Bot) 9ddd6387a7
[ci] release (#11086)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-22 09:40:11 +02:00

28 KiB
Raw Blame History

@astrojs/db

0.11.4

Patch Changes

  • #11032 b78e83f Thanks @itsMapleLeaf! - Adds support for multiple Astro Studio workspaces (aka “Teams”) to the Astro DB CLI

    Users who are members of a team workspace in Astro Studio can now choose between those and their personal workspace when runnning 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

  • #10882 cf58d1e Thanks @delucis! - Improves the typing of the asDrizzleTable() utility

    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

  • #10589 ed1031ba29af9a8a89ab386d772a228ba1414b4d Thanks @column.text(),! - Update the table indexes configuration to allow generated index names. The indexes object syntax is now deprecated in favor of an array.

    Migration

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

    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

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

  • #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! - Introduce astro build --remote to build with a remote database connection. Running astro 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 providing astro:db configuration and seed files, using the new astro:db:setup hook.

    To get TypeScript support for the astro:db:setup hook, wrap your integration object in the defineDbIntegration() 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 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 Astros 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.

    // 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 with db.batch(). This includes an internal bump to Drizzle v0.29.

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