bellycard / napa

A simple framework for building APIs with Grape
Other
329 stars 72 forks source link

for activerecord >= 4, import the db rake tasks #256

Closed ashtonthomas closed 7 years ago

ashtonthomas commented 8 years ago

@bellycard/platform

ActiveRecord 4 introduced a better way to use db tasks outside of rails

Perhaps we should just import these?

These:

rake db:create              # Create the database
rake db:drop                # Delete the database
rake db:migrate             # Migrate the database through scripts in db/migrate
rake db:reset               # Create the test database
rake db:rollback            # Rollback to a previous migration
rake db:schema:dump         # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load         # Load a schema.rb file into the database
rake db:seed                # Load the seed data from db/seeds.rb

Become:

rake db:create              # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config)
rake db:drop                # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config)
rake db:fixtures:load       # Load fixtures into the current environment's database
rake db:migrate             # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:status      # Display status of migrations
rake db:rollback            # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear  # Clear a db/schema_cache.dump file
rake db:schema:cache:dump   # Create a db/schema_cache.dump file
rake db:schema:dump         # Create a db/schema.rb file that is portable against any DB supported by AR
rake db:schema:load         # Load a schema.rb file into the database
rake db:seed                # Load the seed data from db/seeds.rb
rake db:setup               # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)
rake db:structure:dump      # Dump the database structure to db/structure.sql
rake db:version             # Retrieves the current schema version number