forked from rails/rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Postgresql doesn't accepts limits on text columns.
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
activerecord/test/cases/adapters/postgresql/sql_types_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require "cases/helper" | ||
|
||
class SqlTypesTest < ActiveRecord::TestCase | ||
def test_binary_types | ||
assert_equal 'bytea', type_to_sql(:binary, 100_000) | ||
assert_raise ActiveRecord::ActiveRecordError do | ||
type_to_sql :binary, 4294967295 | ||
end | ||
assert_equal 'text', type_to_sql(:text, 100_000) | ||
assert_raise ActiveRecord::ActiveRecordError do | ||
type_to_sql :text, 4294967295 | ||
end | ||
end | ||
|
||
def type_to_sql(*args) | ||
ActiveRecord::Base.connection.type_to_sql(*args) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters