@@ -0,0 +1,16 | |||||
|
1 | class ChangeWikiContentsTextLimit < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | # Migrates MySQL databases only | |||
|
4 | # Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818) | |||
|
5 | # Not fixed in Rails 2.3.5 | |||
|
6 | if ActiveRecord::Base.connection.adapter_name =~ /mysql/i | |||
|
7 | max_size = 16.megabytes | |||
|
8 | change_column :wiki_contents, :text, :text, :limit => max_size | |||
|
9 | change_column :wiki_content_versions, :data, :binary, :limit => max_size | |||
|
10 | end | |||
|
11 | end | |||
|
12 | ||||
|
13 | def self.down | |||
|
14 | # no-op | |||
|
15 | end | |||
|
16 | end |
@@ -77,4 +77,12 class WikiContentTest < ActiveSupport::TestCase | |||||
77 | assert_kind_of String, version.text |
|
77 | assert_kind_of String, version.text | |
78 | end |
|
78 | end | |
79 | end |
|
79 | end | |
|
80 | ||||
|
81 | def test_large_text_should_not_be_truncated_to_64k | |||
|
82 | page = WikiPage.new(:wiki => @wiki, :title => "Big page") | |||
|
83 | page.content = WikiContent.new(:text => "a" * 500.kilobyte, :author => User.find(1)) | |||
|
84 | assert page.save | |||
|
85 | page.reload | |||
|
86 | assert_equal 500.kilobyte, page.content.text.size | |||
|
87 | end | |||
80 | end |
|
88 | end |
General Comments 0
You need to be logged in to leave comments.
Login now