mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
tiny code improvement in sqlite3 adapter:
- remove unused method `supports_add_column?` - change additional restriction method to `valid_alter_table_type?` - fix code style
This commit is contained in:
parent
2a843b3538
commit
5e4a99821d
1 changed files with 2 additions and 6 deletions
|
@ -179,10 +179,6 @@ module ActiveRecord
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def supports_add_column?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
def supports_views?
|
def supports_views?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -451,12 +447,12 @@ module ActiveRecord
|
||||||
|
|
||||||
# See: http://www.sqlite.org/lang_altertable.html
|
# See: http://www.sqlite.org/lang_altertable.html
|
||||||
# SQLite has an additional restriction on the ALTER TABLE statement
|
# SQLite has an additional restriction on the ALTER TABLE statement
|
||||||
def valid_alter_table_options( type, options)
|
def valid_alter_table_type?(type)
|
||||||
type.to_sym != :primary_key
|
type.to_sym != :primary_key
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_column(table_name, column_name, type, options = {}) #:nodoc:
|
def add_column(table_name, column_name, type, options = {}) #:nodoc:
|
||||||
if supports_add_column? && valid_alter_table_options( type, options )
|
if valid_alter_table_type?(type)
|
||||||
super(table_name, column_name, type, options)
|
super(table_name, column_name, type, options)
|
||||||
else
|
else
|
||||||
alter_table(table_name) do |definition|
|
alter_table(table_name) do |definition|
|
||||||
|
|
Loading…
Reference in a new issue