Help understanding "--> statement-breakpoint"

Sorry for maybe such a "beginner" question, but im pretty new to database management and have a question around an "issue" im running in to trying to create migrations for my project w/ drizzle So looking at the docs (https://orm.drizzle.team/kit-docs/conf#sql-breakpoints), I see that drizzle will automatically insert these comment breakpoints into any generated migration files as some dialects (sqlite/libsql/turso in my case) needs them in order to have multiple DDL statements (https://www.javatpoint.com/ddl-commands-in-sql) in the same migration file. Cool. This (somewhat) makes sense and so far things seem to work just fine. The issue im running into is creating a "custom" migration file, and doing some INSERT commands. If I try to run the following, instead of seeing both rows added to the table, only 1 will be:
-- Custom SQL migration file, put you code below! --

INSERT INTO `some_table` VALUES (1, "foo");
INSERT INTO `some_table` VALUES (2, "bar");
-- Custom SQL migration file, put you code below! --

INSERT INTO `some_table` VALUES (1, "foo");
INSERT INTO `some_table` VALUES (2, "bar");
However if I add the breakpoint comment like the generated migrations, both entries get added when I run the migration:
-- Custom SQL migration file, put you code below! --

INSERT INTO `some_table` VALUES (1, "foo");--> statement-breakpoint
INSERT INTO `some_table` VALUES (2, "bar");
-- Custom SQL migration file, put you code below! --

INSERT INTO `some_table` VALUES (1, "foo");--> statement-breakpoint
INSERT INTO `some_table` VALUES (2, "bar");
It was my understanding that these breakpoints are only needed for DDL commands, but im trying to do DML commands (https://www.javatpoint.com/dml-commands-in-sql). Is this a bug or am I just misunderstanding some fundamental part since im still pretty new to all this? Also, is there something special about --> statement-breakpoint? Like, I tried googling that to get more info on what it does but nothing really came up. Is it a special "drizzle" string? Hopefully my questions makes sense. It took me forever to realize why I kept getting errors and running into problems so maybe this will help others as well.
www.javatpoint.com
DDL Commands in SQL - javatpoint
DDL Commands in SQL with sql, tutorial, examples, insert, update, delete, select, join, database, table, join etc, SQL CAST Function, SQL Formatter.
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
2 Replies
Angelelz
Angelelz12mo ago
@Andrew Sherman I think drizzle kit uses the statement breakpoints to divide somewhat like String.split() would do in JavaScript. But I might me wrong
Isaiah Smith
Isaiah SmithOP12mo ago
Ok, cool. That sort of makes sense. If thats the case though, I'm wondering if maybe the docs should be updated to say you may need them for DML commands as well? I imagine others have/may run into this hiccup if they ever run the drizzle-kit generate:sqlite --custom command?
Want results from more Discord servers?
Add your server