New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NULLS NOT DISTINCT
#6054
base: master
Are you sure you want to change the base?
Add NULLS NOT DISTINCT
#6054
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -345,14 +345,19 @@ class TableCompiler_MySQL extends TableCompiler { | |||||
unique(columns, indexName) { | ||||||
let storageEngineIndexType; | ||||||
let deferrable; | ||||||
let nullsNotDistinct; | ||||||
if (isObject(indexName)) { | ||||||
({ indexName, deferrable, storageEngineIndexType } = indexName); | ||||||
({ indexName, deferrable, storageEngineIndexType, nullsNotDistinct } = | ||||||
indexName); | ||||||
} | ||||||
if (deferrable && deferrable !== 'not deferrable') { | ||||||
this.client.logger.warn( | ||||||
`mysql: unique index \`${indexName}\` will not be deferrable ${deferrable} because mysql does not support deferred constraints.` | ||||||
); | ||||||
} | ||||||
if (nullsNotDistinct !== undefined) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allow null as well
Suggested change
|
||||||
throw new Error('mysql cannot make unique with nullsNotDistinct option'); | ||||||
} | ||||||
indexName = indexName | ||||||
? this.formatter.wrap(indexName) | ||||||
: this._indexCommand('unique', this.tableNameRaw, columns); | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -156,8 +156,12 @@ class TableCompiler_Oracle extends TableCompiler { | |||||
|
||||||
unique(columns, indexName) { | ||||||
let deferrable; | ||||||
let nullsNotDistinct; | ||||||
if (isObject(indexName)) { | ||||||
({ indexName, deferrable } = indexName); | ||||||
({ indexName, deferrable, nullsNotDistinct } = indexName); | ||||||
} | ||||||
if (nullsNotDistinct !== undefined) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allow null as well
Suggested change
|
||||||
throw new Error('oracle cannot make unique with nullsNotDistinct option'); | ||||||
} | ||||||
deferrable = deferrable ? ` deferrable initially ${deferrable}` : ''; | ||||||
indexName = indexName | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -133,8 +133,14 @@ class TableCompiler_SQLite3 extends TableCompiler { | |||||
unique(columns, indexName) { | ||||||
let deferrable; | ||||||
let predicate; | ||||||
let nullsNotDistinct; | ||||||
if (isObject(indexName)) { | ||||||
({ indexName, deferrable, predicate } = indexName); | ||||||
({ indexName, deferrable, predicate, nullsNotDistinct } = indexName); | ||||||
} | ||||||
if (nullsNotDistinct !== undefined) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allow null as well
Suggested change
|
||||||
throw new Error( | ||||||
'sqlite3 cannot make unique with nullsNotDistinct option' | ||||||
); | ||||||
} | ||||||
if (deferrable && deferrable !== 'not deferrable') { | ||||||
this.client.logger.warn( | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow null as well