delay
delay
Explore posts from servers
DTDrizzle Team
Created by delay on 3/2/2024 in #help
Drizzle migrations failing to push to Turso
I am trying to get drizzle migrations to work with Turso. If I make any changes to my tables, they always fail. So if I remove the provider in the example below. This is the error message I receive when pushing a migration to turso.
LibsqlError: SQLITE_UNKNOWN: SQLite error: table users has 6 columns but 5 values were supplied
at mapHranaError {
code: 'SQLITE_UNKNOWN',
rawCode: undefined,
[cause]: [ResponseError: SQLite error: table users has 6 columns but 5 values were supplied] {
code: 'SQLITE_UNKNOWN',
proto: {
message: 'SQLite error: table users has 6 columns but 5 values were supplied',
code: 'SQLITE_UNKNOWN'
}
}
}
LibsqlError: SQLITE_UNKNOWN: SQLite error: table users has 6 columns but 5 values were supplied
at mapHranaError {
code: 'SQLITE_UNKNOWN',
rawCode: undefined,
[cause]: [ResponseError: SQLite error: table users has 6 columns but 5 values were supplied] {
code: 'SQLITE_UNKNOWN',
proto: {
message: 'SQLite error: table users has 6 columns but 5 values were supplied',
code: 'SQLITE_UNKNOWN'
}
}
}
drizzle schema.
export const userTable = sqliteTable('users', {
id: text('id').notNull().primaryKey(),
provider: text('provider').notNull().default('email'),
providerId: text('provider_id').notNull().default(''),
email: text('email').notNull().unique(),
firstName: text('first_name'),
lastName: text('last_name')
});
export const userTable = sqliteTable('users', {
id: text('id').notNull().primaryKey(),
provider: text('provider').notNull().default('email'),
providerId: text('provider_id').notNull().default(''),
email: text('email').notNull().unique(),
firstName: text('first_name'),
lastName: text('last_name')
});
CREATE TABLE `sessions` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`expires_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`provider` text DEFAULT 'email' NOT NULL,
`provider_id` text DEFAULT '' NOT NULL,
`email` text NOT NULL,
`first_name` text,
`last_name` text,
`role` text DEFAULT 'USER' NOT NULL,
`token` text,
`receive_email` integer DEFAULT true NOT NULL,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);
CREATE TABLE `sessions` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`expires_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`provider` text DEFAULT 'email' NOT NULL,
`provider_id` text DEFAULT '' NOT NULL,
`email` text NOT NULL,
`first_name` text,
`last_name` text,
`role` text DEFAULT 'USER' NOT NULL,
`token` text,
`receive_email` integer DEFAULT true NOT NULL,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);
ALTER TABLE `users` DROP COLUMN `provider`;
ALTER TABLE `users` DROP COLUMN `provider`;
drizzle-kit generate:sqlite --config drizzle.config.ts
drizzle-kit push:sqlite --config drizzle.config.ts
drizzle-kit generate:sqlite --config drizzle.config.ts
drizzle-kit push:sqlite --config drizzle.config.ts
1 replies