Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jougene/30f329853b00a45d7eb2081526acf594 to your computer and use it in GitHub Desktop.
Save jougene/30f329853b00a45d7eb2081526acf594 to your computer and use it in GitHub Desktop.
// PATCH
if (column.default !== undefined) {
expression_1 += this.connection.driver.normalizeDefault(column);
} else {
// sqlite
if (_this.connection.driver instanceof AbstractSqliteDriver_1.AbstractSqliteDriver) {
expression_1 += "NULL"
// not sqlite
} else {
expression_1 += "DEFAULT";
}
}
if (this.connection.driver instanceof AbstractSqliteDriver) { // unfortunately sqlite does not support DEFAULT expression in INSERT queries
if (column.default !== undefined) { // try to use default defined in the column
expression += this.connection.driver.normalizeDefault(column);
} else {
expression += "NULL"; // otherwise simply use NULL and pray if column is nullable
}
} else {
expression += "DEFAULT";
}
if (_this.connection.driver instanceof AbstractSqliteDriver_1.AbstractSqliteDriver) { // unfortunately sqlite does not support DEFAULT expression in INSERT queries
if (column.default !== undefined) { // try to use default defined in the column
expression_1 += _this.connection.driver.normalizeDefault(column);
}
else {
expression_1 += "NULL"; // otherwise simply use NULL and pray if column is nullable
}
}
else {
expression_1 += "DEFAULT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment