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

feat(config): Add migrations.tableIdType #3721

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dengfuping
Copy link

@dengfuping dengfuping commented Dec 9, 2024

Background

Solution

  • Considering that serial datatype is widely used in drizzle source code and tests, replacing serial with bigint AUTO_INCREMENT directly mayby result in large impact and incompatible change for exists projects.
  • So adding migrations.tableIdType config maybe a better solution.

Usage

// drizzle.config.ts
 import { defineConfig } from "drizzle-kit";

 export default defineConfig({
   migrations: {
+    tableIdTable: 'bigint AUTO_INCREMENT', 
   },
 });
  • create table sql for __drizzle_migrations:
 create table if not exists `__drizzle_migrations` (
-  id serial primary key,
+  id bigint AUTO_INCREMENT primary key,
   hash text not null,
   created_at bigint
 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant