dimanche 26 novembre 2017

migrate is not running

I made a model called user and in the timestamp_create_users.rb ( where timestamp = long number ) I have the following:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|

      t.integer :userNum, :limit => 7
      t.string :username, :limit => 32
      t.string :fname, :limit => 40
      t.string :surname, :limit => 40
      t.string :email, :limit => 50
      t.string :kNum, :limit => 8
      t.string :password, :limit => 80
      t.boolean :isTeacher, :default => false
      t.timestamps null: false

    end
  end
end

The problem is that it gives me a long error message and here the head of it:

rake db:migrate

== 20171126181930 CreateUsers: migrating ======================================
-- create_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "userNum" integer(7), "username" varchar(32), "fname" varchar(40), "surname" varchar(40), "email" varchar(50), "kNum" varchar(8), "password" varchar(80), "isTeacher" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 

and the user.rb ( inside the model ) is empty. What am I doing wrong ?

Thanks for your time

Aucun commentaire:

Enregistrer un commentaire