question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional columns when inserting

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
martijndehcommented, Jan 26, 2020

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.

1reaction
martijndehcommented, Jan 18, 2020

I’m working on something which solves this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found