SQLite3::SQLException: table "categories" already exists: CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL code example

Example 1: SQLite3::SQLException: table "categories" already exists: CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL

class DropCategoriesTable < ActiveRecord::Migration
     def up
       drop_table :categories
     end

     def down
       raise ActiveRecord::IrreversibleMigration
     end
end

Example 2: SQLite3::SQLException: table "categories" already exists: CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL

rake db:drop
rake db:create
rake db:migrate

Tags:

Sql Example