rosenfeld / sequel_tools Goto Github PK
View Code? Open in Web Editor NEWTools to help with managing database operations with Sequel through Rake tasks
License: MIT License
Tools to help with managing database operations with Sequel through Rake tasks
License: MIT License
Hi. Ca you push v0.1.6 to Rubygems? Thank you)
Currently the database is configured via the top-level :dbname
, :dbadapter
, :username
, :password
etc. options. What do you think that instead of that there is a single :database
option which would allow configuring the database with the standard Sequel.connect
options?
SequelTools.base_config(
database: {
adapter: "postgres",
database: "mydb",
# ...
}
)
# or
SequelTools.base_config(
database: "postgres:///mydb"
)
I think that would make it more friendly, because the users wouldn't need to remember how these options are named in SequelTools. And the same option could also be re-used for passing a connection string instead of a hash of options should the user prefer it (e.g. it might be convenient when the user has a $DATABASE_URL
environment variable, e.g. when using Heroku).
When running
bundle exec rake db:rollback
getting
No existing migrations are applied - cannot rollback
My Rakefile
base_config = {
project_root: Dir.pwd,
dbadapter: 'postgres',
# dbname: 'liberty_bell_development',
dbname: dbname,
# username: 'postgres',
username: username,
# password: 'postgres',
password: password,
# default log_level is nil, in which mode the executed actions such as
# starting/finishing a migration in a given direction or creating and
# dropping the database are not logged to standard output.
log_level: :info,
# Default options:
sql_log_level: :debug,
dump_schema_on_migrate: false, # it's a good idea to enable it for the reference environment
pg_dump: 'pg_dump', # command used to run pg_dump
# pg_dump: 'psql', # command used to run psql when calling rake db:shell if adapter is postgres
migrations_location: 'db/migrations',
schema_location: 'db/migrations/schema.sql',
seeds_location: 'db/seeds.rb',
# for tasks such as creating the database:
# when nil, defaults to the value of the :dbadapter config.
# This is the database we should connect to before executing "create database dbname"
# maintenancedb: :default,
migrations_table: "schema_migrations",
# allow other tables data to be included in the dump file generated by rake db:schema_dump
# extra_tables_in_dump: nil
# for example, if you want to keep migrations from ActiveRecord in the dump file, while using
# another table for Sequel migrations:
# migrations_table: 'sequel_schema_migrations',
# extra_tables_in_dump: ['schema_migrations']
}
namespace 'db' do
SequelTools.inject_rake_tasks base_config.merge(dump_schema_on_migrate: true), self
end
rake db:create db:migrate db:drop
all work.
Database has a table schema_migrations it shows
[{:version=>5}]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.