ich mache meine ersten Versuch mit RoR und habe folgendes Problem:
Ich führe meine Migrations-Datei mit folgendem Inhalt auf einer MySQL-Datenbank aus:
- Code: Alles auswählen
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.integer :id
t.string :username, :size => 100
t.string :password, :size => 100
t.string :email, :size => 100
t.timestamps
end
end
def self.down
drop_table :users
end
end
Dabei erhalte ich folgende Fehlermeldung von Rake:
- Code: Alles auswählen
>rake db:migrate
(in D:/InstantRails/rails_apps/EHA)
== 1 CreateUsers: migrating ===================================================rake aborted!
-- create_table(:users)
Mysql::Error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(11), `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL' at line 1: CREATE TABLE `users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY(11), `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL) ENGINE=InnoDB
(See full trace by running task with --trace)
>
Das Problem ist
- Code: Alles auswählen
`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY(11),

