Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update dependency drizzle-kit to v0.21.2 #730

Merged
merged 1 commit into from May 18, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 6, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
drizzle-kit 0.20.17 -> 0.21.2 age adoption passing confidence

Release Notes

drizzle-team/drizzle-kit-mirror (drizzle-kit)

v0.21.2

Compare Source

Bug fixes

A list of regressions after 0.21.0 that were fixed (there are more, and those should be fixed in the next patch releases):

  • SQLite generate and push were not detecting new columns added.
  • Timestamps with precision in Postgres were always detected as a change on push
  • Unique constraints for PostgreSQL were not generated and pushed
  • When adding columns to SQLite, table name was not escaped

Tickets that were closed

  • πŸ› [BUG]:"drizzle-kit generate" doesn't generate a migration file when a column is added - 2307
  • πŸ› [BUG]: Unique constraint is not added to the change - 2302
  • πŸ› [bug]: drizzle-kit push is not detecting changes correctly (Turso) - #​397

v0.21.1

Compare Source

v0.21.0

Compare Source

Breaking changes

❗ Snapshots Upgrade

All PostgreSQL and SQLite-generated snapshots will be upgraded to version 6. You will be prompted to upgrade them by running drizzle-kit up

❗ Removing :dialect from drizzle-kit cli commands

You can now just use commands, like:

  • drizzle-kit generate
  • drizzle-kit push
  • etc.

without specifying dialect. This param is moved to drizzle.config.ts

❗ drizzle.config update
  • dialect is now mandatory; specify which database dialect you are connecting to. Options include mysql, postgresql, or sqlite.
  • driver has become optional and will have a specific driver, each with a different configuration of dbCredentials. Available drivers are:
    • aws-data-api
    • turso
    • d1-http - currently WIP
    • expo
  • url - a unified parameter for the previously existing connectionString and uri.
  • migrations - a new object parameter to specify a custom table and schema for the migrate command:
    • table - the custom table where drizzle will store migrations.
    • schema - the custom schema where drizzle will store migrations (Postgres only).

Usage examples for all new and updated commands

import { defineConfig } from "drizzle-kit"

export default defineConfig({
    dialect: "sqlite", // "postgresql" | "mysql"
    driver: "turso"
    dbCredentials: {
        url: ""
    },
    migration: {
        table: "migrations",
        schema: "public"
    }
})

Drizzle driver selection follows the current strategy:

If a driver is specified, use this driver for querying.

If no driver is specified:

  • For postgresql dialect, Drizzle will:

    • Check if the pg driver is installed and use it.
    • If not, try to find the postgres driver and use it.
    • If still not found, try to find @vercel/postgres.
    • Then try @neondatabase/serverless.
    • If nothing is found, an error will be thrown.
  • For mysql dialect, Drizzle will:

    • Check if the mysql2 driver is installed and use it.
    • If not, try to find @planetscale/database and use it.
    • If nothing is found, an error will be thrown.
  • For sqlite dialect, Drizzle will:

    • Check if the @libsql/client driver is installed and use it.
    • If not, try to find better-sqlite3 and use it.
    • If nothing is found, an error will be thrown
❗ MySQL schemas/database are no longer supported by drizzle-kit

Drizzle Kit won't handle any schema changes for additional schemas/databases in your drizzle schema file

New Features

πŸŽ‰ Pull relations

Drizzle will now pull relations from the database by extracting foreign key information and translating it into a relations object. You can view the relations.ts file in the out folder after introspection is complete

For more info about relations, please check the docs

πŸŽ‰ Custom name for generated migrations

To specify a name for your migration you should use --name <name>

Usage

drizzle-kit generate --name init_db
πŸŽ‰ New command migrate

You can now apply generated migrations to your database directly from drizzle-kit

Usage

drizzle-kit migrate

By default, drizzle-kit will store migration data entries in the __drizzle_migrations table and, in the case of PostgreSQL, in a drizzle schema. If you want to change this, you will need to specify the modifications in drizzle.config.ts.

import { defineConfig } from "drizzle-kit"

export default defineConfig({
    migrations: {
        table: "migrations",
        schema: "public"
    }
})

How to migrate from 0.20.18 to 0.21.0

1. Remove all :dialect prefixes from your Drizzle-Kit commands.

Example: Change drizzle-kit push:mysql to drizzle-kit push.

2. Update your drizzle.config.ts file:
  • Add dialect to drizzle.config.ts. It is now mandatory and can be 'postgresql', 'mysql', or 'sqlite'.
  • Add driver to drizzle.config.ts ONLY if you are using aws-data-api, turso, d1-http(WIP), or expo. Otherwise, you can remove the driver from drizzle.config.ts.
  • If you were using connectionString or uri in dbCredentials, you should now use url.
import { defineConfig } from "drizzle-kit"

export default defineConfig({
    dialect: "sqlite", // "postgresql" | "mysql"
    driver: "turso" // optional and used only if `aws-data-api`, `turso`, `d1-http`(WIP) or `expo` are used
    dbCredentials: {
        url: ""
    }
})
3. If you are using PostgreSQL and had migrations generated in your project, please run drizzle-kit up so Drizzle can upgrade all the snapshots to version 6.

v0.20.18

Compare Source


Configuration

πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

πŸ”• Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label May 6, 2024
Copy link
Contributor Author

renovate bot commented May 6, 2024

Branch automerge failure

This PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.


  • Branch has one or more failed status checks

Copy link

vercel bot commented May 6, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
zws ⬜️ Ignored (Inspect) Visit Preview May 17, 2024 7:19pm

@renovate renovate bot force-pushed the renovate/drizzle-kit-0.x branch from f231365 to b55ce03 Compare May 9, 2024 16:32
@renovate renovate bot changed the title build(deps): update dependency drizzle-kit to v0.20.18 build(deps): update dependency drizzle-kit to v0.21.0 May 9, 2024
@renovate renovate bot force-pushed the renovate/drizzle-kit-0.x branch from b55ce03 to 0e4642e Compare May 10, 2024 20:18
@renovate renovate bot changed the title build(deps): update dependency drizzle-kit to v0.21.0 build(deps): update dependency drizzle-kit to v0.21.1 May 10, 2024
@renovate renovate bot force-pushed the renovate/drizzle-kit-0.x branch from 0e4642e to fdd5be6 Compare May 14, 2024 23:27
@renovate renovate bot changed the title build(deps): update dependency drizzle-kit to v0.21.1 build(deps): update dependency drizzle-kit to v0.21.2 May 14, 2024
@renovate renovate bot force-pushed the renovate/drizzle-kit-0.x branch from fdd5be6 to afe458e Compare May 17, 2024 09:18
@renovate renovate bot force-pushed the renovate/drizzle-kit-0.x branch from afe458e to 1e9aa39 Compare May 17, 2024 19:19
@renovate renovate bot merged commit 1fa40b7 into main May 18, 2024
4 checks passed
@renovate renovate bot deleted the renovate/drizzle-kit-0.x branch May 18, 2024 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Development

Successfully merging this pull request may close these issues.

None yet

0 participants