Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Commit

Permalink
Better support for alternative primary keys
Browse files Browse the repository at this point in the history
  • Loading branch information
awreece committed Nov 13, 2017
1 parent 6f59435 commit b910e3e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mosql/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def create_table(db, spec, clobber, parent_table=nil, parent_pk_type = nil)
keys << meta[:parent_fkey]
keytypes << parent_pk_type
end
primary_key keys
primary_key keys unless meta[:no_primary_key]
end

spec[:subtables].each do |subspec|
Expand Down Expand Up @@ -441,8 +441,8 @@ def collections_for_mongo_db(db)
def primary_sql_keys_for_schema(schema)
keys = []
if schema[:meta][:composite_key]
keys = schema[:meta][:composite_key]
else
keys = schema[:meta][:composite_key].map{ |k| k.to_sym }
elsif not schema[:meta][:no_primary_key]
keys << schema[:columns].find {|c| c[:source] == '_id'}[:name]
end
if schema[:meta][:parent_fkey]
Expand Down

0 comments on commit b910e3e

Please sign in to comment.