Giter Site home page Giter Site logo

sequel_tools's People

Contributors

janko avatar rosenfeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sequel_tools's Issues

Configuring with standard database options

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).

No existing migrations are applied - cannot rollback

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}]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.