[SOLVED] How to add new column?

Hello! Any ideas how to add a new column to an existing table? What I did so far: 1. Updated the schema to add a new column:
website: text('website')
website: text('website')
2. Generated migration files, and it did create the correct SQL statement, but for some reason I don't understand, it is not applicable:
/*
SQLite does not support "Set default to column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3

Due to that we don't generate migration automatically and it has to be done manually
*/--> statement-breakpoint
ALTER TABLE sfdc_opportunities ADD `website` text;
/*
SQLite does not support "Set default to column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3

Due to that we don't generate migration automatically and it has to be done manually
*/--> statement-breakpoint
ALTER TABLE sfdc_opportunities ADD `website` text;
3. Running the migration fails with:
RangeError: The supplied SQL string contains no statements
at Database.prepare
RangeError: The supplied SQL string contains no statements
at Database.prepare
I'm using '@libsql/client' connected to Turso.
3 Replies
Angelelz
Angelelz13mo ago
Based on this https://sqlite.org/lang_altertable.html#alter_table_add_column I think you should be safe to delete the first part of your migration up to statement-breakpoint and run it again
hugo
hugoOP13mo ago
Thanks @Angelelz ! Removing --> statement-breakpoint made it possible to be applied. Wondering why is this the default behavior since adding a column is the most basic use case for a migration...
Angelelz
Angelelz13mo ago
I have no idea, maybe out of abundance of caution? Maybe an old version of SQL had problems with it?
Want results from more Discord servers?
Add your server