Sha256: 4af4b8c00b6a17820220311c454b5ff404340f8fdeafd26e82e31b9400ad20f5
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
namespace :ez do desc "Generate models.yml if it doesn't exist yet." task :generate_yml do File.open("db/models.yml", "w") do |f| f.puts <<-EOS # Example table for a typical Book model. # # Book: # - title: string # - price: integer # - author: string # - summary: text # - hardcover: boolean # # Follow the syntax exactly (colons and spacing are important). # Column type choices are: string, text, integer, and boolean. # You can have as many models as you want in this file. EOS end end desc "Reset the database schema and data from scratch." task :reset_tables => ['db:drop', :tables] do end desc "Attempts to update the database schema and model files with minimal data loss." task :tables => :environment do if File.exists?('db/models.yml') EZ::DomainModeler.update_tables Rake::Task["db:schema:dump"].invoke else emit_help_page Rake::Task["generate_yml"].invoke end end def emit_help_page puts "To get started, edit the db/models.yml file to describe your table schema." end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ez-0.6.4 | lib/tasks/ez_tasks.rake |
ez-0.6.3 | lib/tasks/ez_tasks.rake |
ez-0.6.2 | lib/tasks/ez_tasks.rake |