D
Daniel Sheppard
I know what I'm about to describe is a rails issue - I've raised a rails
ticket (#6768) - I'm raising it here because I think sqlite3-ruby is the
most likely culprit.
I can reproduce the bug on two windows systems using both
sqlite3-ruby-1.1.0.1-mswin32 (_why's sqlite3 install) and the default
sqlite3-ruby-1.1.0-mswin32 gem. Cannot reproduce on gentoo system with
the sqlite3-ruby-1.1.0 gem
Running this migration in rails against an sqlite3 database:
class CreateTestModels < ActiveRecord::Migration
def self.up
create_table :test_models do |t|
t.column :test, :string
end
rename_column :test_models, :test, :test2
rename_column :test_models, :test2, :test3
end
def self.down
drop_table :test_models
end
end
results in the following schema for a sqlite3 database:
CREATE TABLE schema_info (version integer);
CREATE TABLE test_models ("id" INTEGER PRIMARY KEY NOT NULL, "test3"
varchar(255) DEFAULT '''''''''''''''''''''''''''''');
Note the default value - each rename_column (or anything else that uses
the duplicate and rename mechanism) results in the default value being
escaped.
Looking at the rails codebase, when the call is made to look up the
table schema with PRAGMA table_info(#{table_name}), the windows gem
appears to be returning an escaped string for the default value for a
column (rails then passes this escaped value back in the creation,
escaping it first, hence the cascade of quotes).
sqlite guys?
ticket (#6768) - I'm raising it here because I think sqlite3-ruby is the
most likely culprit.
I can reproduce the bug on two windows systems using both
sqlite3-ruby-1.1.0.1-mswin32 (_why's sqlite3 install) and the default
sqlite3-ruby-1.1.0-mswin32 gem. Cannot reproduce on gentoo system with
the sqlite3-ruby-1.1.0 gem
Running this migration in rails against an sqlite3 database:
class CreateTestModels < ActiveRecord::Migration
def self.up
create_table :test_models do |t|
t.column :test, :string
end
rename_column :test_models, :test, :test2
rename_column :test_models, :test2, :test3
end
def self.down
drop_table :test_models
end
end
results in the following schema for a sqlite3 database:
CREATE TABLE schema_info (version integer);
CREATE TABLE test_models ("id" INTEGER PRIMARY KEY NOT NULL, "test3"
varchar(255) DEFAULT '''''''''''''''''''''''''''''');
Note the default value - each rename_column (or anything else that uses
the duplicate and rename mechanism) results in the default value being
escaped.
Looking at the rails codebase, when the call is made to look up the
table schema with PRAGMA table_info(#{table_name}), the windows gem
appears to be returning an escaped string for the default value for a
column (rails then passes this escaped value back in the creation,
escaping it first, hence the cascade of quotes).
sqlite guys?