Add support for compound UNIQUE and PRIMARY KEY constraints#130
Open
brianc wants to merge 1 commit intogoodybag:masterfrom
Open
Add support for compound UNIQUE and PRIMARY KEY constraints#130brianc wants to merge 1 commit intogoodybag:masterfrom
UNIQUE and PRIMARY KEY constraints#130brianc wants to merge 1 commit intogoodybag:masterfrom
Conversation
75c9bf4 to
8ad15ab
Compare
Member
|
This is perfect! And it made me remember some things that will make it more robust. So, this lib needs to be refactored. There's too many concepts:
When I first wrote MoSQL, I thought there'd be a unified helper interface, but as time went on, I ended up with more and more specialized helpers. The Column Definition Helpers can assist us here: var columnDefs = require('../../lib/column-def-helpers');
...
return Object
.keys( constraints )
.filter( function( k ){
return columnDefs.has( k );
})
.map( function( k ){
return columnDefs.get( k ).fn( constraints[ k ], values, query );
})
.reduce( function( result, constraint ){
result.push( constraint );
return result;
}, [] )
.join(', ')I think that code would work I'm not sure. But my main point would be to use the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not 100% sure this is the correct approach or if all the formatting is okay. This is a first crack at adding table constraints to support natural keys.