untrack schema and any new migrations in test_app

This commit is contained in:
cowboycoded 2011-02-12 08:10:45 -05:00
parent ea27abcd3b
commit 5a8871f02f
5 changed files with 3 additions and 91 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
Gemfile.lock
/test_app/db/migrate/20
/test_app/db/schema.rb

View File

@ -1,7 +1,7 @@
PATH
remote: /rails_plugins/mine/impressionist
specs:
impressionist (0.2.0)
impressionist (0.2.1)
GEM
remote: http://rubygems.org/

View File

@ -1,27 +0,0 @@
class CreateImpressionsTable < ActiveRecord::Migration
def self.up
create_table :impressions, :force => true do |t|
t.string :impressionable_type
t.integer :impressionable_id
t.integer :user_id
t.string :controller_name
t.string :action_name
t.string :view_name
t.string :request_hash
t.string :ip_address
t.string :message
t.timestamps
end
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false
add_index :impressions, :user_id
end
def self.down
remove_index :impressions, :name => :poly_index
remove_index :impressions, :name => :controlleraction_index
remove_index :impressions, :user_id
drop_table :impressions
end
end

View File

@ -1,45 +0,0 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110212032114) do
create_table "articles", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "impressions", :force => true do |t|
t.string "impressionable_type"
t.integer "impressionable_id"
t.integer "user_id"
t.string "controller_name"
t.string "action_name"
t.string "view_name"
t.string "request_hash"
t.string "ip_address"
t.string "message"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "impressions", ["controller_name", "action_name", "request_hash", "ip_address"], :name => "controlleraction_index"
add_index "impressions", ["impressionable_type", "impressionable_id", "request_hash", "ip_address"], :name => "poly_index"
add_index "impressions", ["user_id"], :name => "index_impressions_on_user_id"
create_table "posts", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
end

View File

@ -1,18 +0,0 @@
require 'spec_helper'
require 'systemu'
describe Impressionist do
it "should delete existing migration and generate the migration file" do
migrations_dir = "#{Rails.root}/db/migrate"
impressions_migration = Dir.entries(migrations_dir).grep(/impressions/)[0]
File.delete("#{migrations_dir}/#{impressions_migration}") unless impressions_migration.blank?
generator_output = systemu("rails g impressionist")[1]
migration_name = generator_output.split("migrate/")[1].strip
Dir.entries(migrations_dir).include?(migration_name).should be true
end
it "should run the migration created in the previous spec" do
migrate_output = systemu("rake db:migrate")
migrate_output[1].include?("CreateImpressionsTable: migrated").should be true
end
end