Sha256: 09ae013a9c456c6cf97f321106af85f2a7849be6d2d627a2dc610a7caa6eb44e

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

ActiveRecord::Base.establish_connection(
  :adapter=>'sqlite3',
  :dbfile=> File.join(File.dirname(__FILE__),'..','spec','db','test.db')
)
# define a migration
class TestSchema < ActiveRecord::Migration
  def self.up
    create_table :items do |t|
      t.string :title
      t.string :slug
      t.string :permalink
      t.boolean :published
      t.integer :category_id
      t.timestamps
    end
  end

  def self.down
    drop_table :items
  end
end


namespace :db do
  desc "Create test schema"
  task :create => :destroy do
    # run the migration
    TestSchema.migrate(:up)
  end
  
  desc "Destroy test schema"
  task :destroy do
    TestSchema.migrate(:down)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ismasan-sluggable_finder-2.0.0 tasks/db.rake
ismasan-sluggable_finder-2.0.1 tasks/db.rake
ismasan-sluggable_finder-2.0.2 tasks/db.rake