© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
1 reply
Kallo

SQL_PARSE_ERROR with Turso + Drizzle

getting
SQL string could not be parsed: near MINUS, "None"
SQL string could not be parsed: near MINUS, "None"
when running a push in development with this schema:

import { sqliteTable, text, numeric, uniqueIndex, integer } from 'drizzle-orm/sqlite-core';
import { sql } from 'drizzle-orm';

export const blogPosts = sqliteTable(
    'blog-posts',
    {
        id: integer('id').primaryKey().notNull(),
        name: text('name').notNull(),
        headline: text('headline').notNull(),
        body: text('body').notNull(),
        createdAt: integer('created_at')
            .default(sql`(cast (unixepoch() as int))`)
            .notNull()
    },
    (table) => {
        return {
            idUnique: uniqueIndex('blog-posts_id_unique').on(table.id)
        };
    }
);

export const testProducts = sqliteTable(
    'test-products',
    {
        id: integer('id').primaryKey().notNull(),
        name: text('name').notNull(),
        strainType: text('strain_type').notNull(),
        thcContent: text('thc_content').notNull(),
        cbdContent: text('cbd_content').notNull(),
        img: text('img').notNull(),
        price: text('price').notNull(),
        description: text('description').notNull(),
        createdAt: integer('created_at')
            .default(sql`(cast (unixepoch() as int))`)
            .notNull(),
        rating: integer('rating').default(0).notNull()
    },
    (table) => {
        return {
            idUnique: uniqueIndex('test-products_id_unique').on(table.id)
        };
    }
);
import { sqliteTable, text, numeric, uniqueIndex, integer } from 'drizzle-orm/sqlite-core';
import { sql } from 'drizzle-orm';

export const blogPosts = sqliteTable(
    'blog-posts',
    {
        id: integer('id').primaryKey().notNull(),
        name: text('name').notNull(),
        headline: text('headline').notNull(),
        body: text('body').notNull(),
        createdAt: integer('created_at')
            .default(sql`(cast (unixepoch() as int))`)
            .notNull()
    },
    (table) => {
        return {
            idUnique: uniqueIndex('blog-posts_id_unique').on(table.id)
        };
    }
);

export const testProducts = sqliteTable(
    'test-products',
    {
        id: integer('id').primaryKey().notNull(),
        name: text('name').notNull(),
        strainType: text('strain_type').notNull(),
        thcContent: text('thc_content').notNull(),
        cbdContent: text('cbd_content').notNull(),
        img: text('img').notNull(),
        price: text('price').notNull(),
        description: text('description').notNull(),
        createdAt: integer('created_at')
            .default(sql`(cast (unixepoch() as int))`)
            .notNull(),
        rating: integer('rating').default(0).notNull()
    },
    (table) => {
        return {
            idUnique: uniqueIndex('test-products_id_unique').on(table.id)
        };
    }
);


I am adding the ratings column as an integer. Lets walk down the chain. When I add it as a new text column. It works. When I add it as an integer column with a default value and notNull, it gives me the warning that I am about to put null into a notNull column even though I have given it a default value, and then throws the error mentioned above.

If I do it without the notNull, it just gives the error mentioned above. Working with SvelteKit btw
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Error with drizzle (sql)
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle Migrate with Turso
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle + Turso + Embeddings?
Drizzle TeamDTDrizzle Team / help
2y ago
drizzle + turso config
Drizzle TeamDTDrizzle Team / help
2y ago