Optional columns when inserting
See original GitHub issueI noticed nullable columns are still required to specify when inserting. For example:
export class Test {
id = new UuidColumn().primaryKey().notNull();
name = new TextColumn();
createdAt = new TimestampWithTimeZoneColumn().notNull().default(new Now());
}
// ...
db.insertInto(db.test).values({
name: null,
createdAt: null,
})
here name: null
is required even though it’s nullable and createdAt: null
is required even though it has a default.
Is this a limitation that you ran into? Or just haven’t gotten around to making them optional in JS-land too? I can write a PR if it’s possible.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Optional columns in SQL Server insert statement based on ...
It lists all columns and the values as such: insert into TABLE_NAME (name, rating, link) values (@name, @rating, ...
Read more >Specifying optional properties for columns
You can specify optional properties for the columns that you define when creating a table. The optional column properties are described in the...
Read more >Optional fields in SQL server INSERT - Help
In one of my applications, I am inserting variables into a SQL server table. Some of these parameters are optional and thus sometimes...
Read more >Insert or delete rows and columns
Select any cell within the column, then go to Home > Insert > Insert Sheet Columns or Delete Sheet Columns. Alternatively, right-click the...
Read more >Inserting Rows with NULL Column Values - InterBase
In these cases, a NULL value should be assigned to those columns when the row is inserted. There are three ways to assign...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Tests are passing again. I’ll close this now as I consider this resolved. I’ll try to get a release ready in the next few days. There is still some work left on the cli and the generator.
I’m working on something which solves this.