lib/active_record/connection_adapters/rails_41.rb
# See also TableDefinition#column for details on how to create columns.
See also TableDefinition#column for details on how to create columns.
See also TableDefinition#column for details on how to create columns .
def create_table(table_name, options = {})
        td = create_table_definition table_name, options[:temporary], options[:options]
        unless options[:id] == false
          pk = options.fetch(:primary_key) {
            Base.get_primary_key table_name.to_s.singularize
          }
          td.primary_key pk, options.fetch(:id, :primary_key), options
        end
        yield td if block_given?
        if options[:force] && table_exists?(table_name)
          drop_table(table_name, options)
        end
        hsh = td.columns.map { |c|  {"name"=> c[:name], "type"=> type_to_sql(c[:type]) }  }
        @table_body = {  "tableReference"=> {
                            "projectId"=> @config[:project],
                            "datasetId"=> @config[:database],
                            "tableId"=> td.name},
                          "schema"=> [fields: hsh]
                      }
        res = BigBroda::Table.create(@config[:project], @config[:database], @table_body )
        raise res["error"]["errors"].map{|o| "[#{o['domain']}]: #{o['reason']} #{o['message']}" }.join(", ") if res["error"].present?
      end
def create_table ( table_name , options = { } ) td = create_table_definition table_name , options [ :temporary ] , options [ :options ] unless options [ :id ] == false pk = options . fetch ( :primary_key ) { Base . get_primary_key table_name . to_s . singularize } td . primary_key pk , options . fetch ( :id , :primary_key ) , options end yield td if block_given? if options [ :force ] && table_exists? ( table_name ) drop_table ( table_name , options ) end hsh = td . columns . map { | c | { "name" => c [ :name ] , "type" => type_to_sql ( c [ :type ] ) } } @table_body = { "tableReference" => { "projectId" => @config [ :project ] , "datasetId" => @config [ :database ] , "tableId" => td . name } , "schema" => [ fields : hsh ] } res = BigBroda :: Table . create ( @config [ :project ] , @config [ :database ] , @table_body ) raise res [ "error" ] [ "errors" ] . map { | o | "[#{o['domain']}]: #{o['reason']} #{o['message']}" } . join ( ", " ) if res [ "error" ] . present? end
See also TableDefinition#column for details on how to create columns.
See also TableDefinition#column for details on how to create columns .
table_name
<not_specific>
options
<not_specific>