Sha256: de918586468c8b1a2eafc58f94383186329e362e36311aca9dea7de332bc0ade
Contents?: true
Size: 728 Bytes
Versions: 10
Compression:
Stored size: 728 Bytes
Contents
require 'jdbc_common' require 'db/postgres' class CreateUrls < ActiveRecord::Migration def self.up create_table 'urls', :id => false do |t| t.text :uhash, :null => false t.text :url, :null => false end execute "ALTER TABLE urls ADD PRIMARY KEY (uhash)" end def self.down drop_table 'urls' end end class Url < ActiveRecord::Base self.primary_key = :uhash #Shouldn't be needed: set_sequence_name nil end class PostgresNonSeqPKey < Test::Unit::TestCase def setup CreateUrls.up end def teardown CreateUrls.down end def test_create url = Url.create! do |u| u.uhash = 'uhash' u.url = 'http://url' end assert_equal( 'uhash', url.uhash ) end end
Version data entries
10 entries across 10 versions & 3 rubygems