Hi all!
I hope somebody can help me. I have very little hair left, and it is decreasing more rapidly the longer I have this problem
I am connecting to a MS SQL Server 9.0.2047 from Fedora 7 linux, using freetds, unixodbc and rubyodbc. Most things work fine, just not the following:
I have a schema/migration like this:
create_table "users", :force => true do |t|   t.column "username", :string, :limit => 50, :null => false   t.column "password", :string, :limit => 50, :null => false   t.column "enabled", :boolean, :null => false   t.column "firstName", :string, :limit => 50   t.column "lastName", :string, :limit => 50   t.column "email", :string, :limit => 50   t.column "userService", :integer   t.column "accessProfile_id", :integer   t.column "salted_password", :string, :limit => 40   t.column "salt", :string, :limit => 40   t.column "security_token", :string, :limit => 40   t.column "token_expiry", :datetime   t.column "deleted", :boolean, :default => false, :null => false   t.column "verified", :boolean, :default => false end
When I run db:schema:load using the sqlserver adapter I get the following DDL (just added newlines for readability):
DROP TABLE users CREATE TABLE users ( Â Â [id] int NOT NULL IDENTITY(1, 1) PRIMARY KEY, Â Â [username] varchar(50) NOT NULL, Â Â [password] varchar(50) NOT NULL, Â Â [enabled] bit NOT NULL, Â Â [firstName] varchar(50) DEFAULT NULL, Â Â [lastName] varchar(50) DEFAULT NULL, Â Â [email] varchar(50) DEFAULT NULL, Â Â [userService] integer DEFAULT NULL, Â Â [accessProfile_id] integer DEFAULT NULL, Â Â [salted_password] varchar(40) DEFAULT NULL, Â Â [salt] varchar(40) DEFAULT NULL, Â Â [security_token] varchar(40) DEFAULT NULL, Â Â [token_expiry] datetime DEFAULT NULL, Â Â [deleted] bit DEFAULT 0 NOT NULL, Â Â [verified] bit DEFAULT 0 )
Running this using the SQL Server Management Studio gives the wanted result. Running the same DDL using a migration script either using the migration statements above or using an "execute" call, gives the wrong result. A dump of the table after running using ActiveRecord looks like this:
/****** Object: Table [dbo].[users] Script Date: 10/22/2007 13:03:30 ******/ CREATE TABLE [dbo].[users]( Â Â [id] [int] IDENTITY(1,1) NOT NULL, Â Â [username] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, Â Â [password] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, Â Â [enabled] [bit] NOT NULL, Â Â [firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [email] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [userService] [int] NOT NULL DEFAULT (NULL), Â Â [accessProfile_id] [int] NOT NULL DEFAULT (NULL), Â Â [salted_password] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [salt] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [security_token] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (NULL), Â Â [token_expiry] [datetime] NOT NULL DEFAULT (NULL), Â Â [deleted] [bit] NOT NULL DEFAULT ((0)), Â Â [verified] [bit] NOT NULL DEFAULT ((0)), PRIMARY KEY CLUSTERED ( Â Â [id] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]