SQLite3でvarchar型に最大文字数制限ないのね
Railsのmigration機能を色々試していて。
class ChangeBooks < ActiveRecord::Migration def self.up change_column :books, :publish, :string, :limit => 15 end def self.down change_column :books, :publish, :string, :limit => 255 end end
こんなmigrationファイルを定義してみました。
publish列のvarchar文字制限を255から15にしてみたのですが。
いくらやっても、15文字以上入っちゃいます。
どうやらSQLiteは、文字制限などは一切課さないそうだ。
Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric values.
http://www.sqlite.org/datatype3.html
まあ、軽い用途ですね、ほんとに。