Open rktyt opened 3 months ago
drizzle-orm
0.32.0
drizzle-kit
0.23.0
import { mysqlTable, varchar, char, } from 'drizzle-orm/mysql-core' import { sql } from 'drizzle-orm' export const test = mysqlTable('test', { nameKana: varchar('name_kana', { length: 50 }).notNull(), japaneseSyllabary: char('japanese_syllabary', { length: 1 }) .generatedAlwaysAs(() => sql`SUBSTRING(name_kana, 1, 1)`, { mode: 'stored', }) .notNull(), })
The result of generating SQL using drizzle-kit generate from the above schema is as follows.
drizzle-kit generate
CREATE TABLE `test` ( `name_kana` varchar(50) NOT NULL, `japanese_syllabary` char(1) NOT NULL GENERATED ALWAYS AS (SUBSTRING(name_kana, 1, 1)) STORED );
This is a SQL syntax error. "NOT NULL" is in the wrong position.
The correct SQL is the following
CREATE TABLE `test` ( `name_kana` varchar(50) NOT NULL, `japanese_syllabary` char(1) GENERATED ALWAYS AS (SUBSTRING(name_kana, 1, 1)) STORED NOT NULL );
No response
fixing that, thanks!
What version of
drizzle-orm
are you using?0.32.0
What version of
drizzle-kit
are you using?0.23.0
Describe the Bug
The result of generating SQL using
drizzle-kit generate
from the above schema is as follows.This is a SQL syntax error. "NOT NULL" is in the wrong position.
Expected behavior
The correct SQL is the following
Environment & setup
No response