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

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stripe-archive/mosql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b910e3e3569f0f3c93d49f630196c8af8b9077bf
Choose a base ref
..
head repository: stripe-archive/mosql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8f7c22fe42e4d39182cb5d32e282786bfde98ef4
Choose a head ref
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/mosql/schema.rb
7 changes: 4 additions & 3 deletions lib/mosql/schema.rb
Original file line number Diff line number Diff line change
@@ -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 unless meta[:no_primary_key]
primary_key keys
end

spec[:subtables].each do |subspec|
@@ -253,8 +253,9 @@ def sanity_check_type(v, type)
(v.is_a? Integer and not type.end_with?('int')) or
(not v.nil? and not v.is_a? Integer and type.end_with?('int') and v.modulo(1) != 0)
false
else
true
end
true
end

def transform_primitive(v, type)
@@ -442,7 +443,7 @@ def primary_sql_keys_for_schema(schema)
keys = []
if schema[:meta][:composite_key]
keys = schema[:meta][:composite_key].map{ |k| k.to_sym }
elsif not schema[:meta][:no_primary_key]
else
keys << schema[:columns].find {|c| c[:source] == '_id'}[:name]
end
if schema[:meta][:parent_fkey]