Sha256: e76fce37ecb85686825ad35127bb20fdf0279702a935a78129f0b053983f71d4
Contents?: true
Size: 763 Bytes
Versions: 2
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true module AR module UUID module Schema def create_table(table_name, **options, &block) override_id = !options.key?(:id) options[:id] = false if override_id prefix = options.delete(:prefix) || table_name default_function = proc do AR::UUID.default_function_with_prefix(prefix) end super(table_name, **options) do |t| if override_id t.primary_key :id, :text, default: default_function end instance_exec(t, &block) end end def add_reference(table_name, ref_name, **options) options[:type] ||= "text" super end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ar-sqlite-uuid-0.0.2 | lib/ar/uuid/schema.rb |
ar-sqlite-uuid-0.0.1 | lib/ar/uuid/schema.rb |