Git Product home page Git Product logo

ghost_adapter's Introduction

Ghost Adapter

ghost

Gem GitHub Actions Workflow Hippocratic License gh-ost version

A tiny, very configurable ActiveRecord adapter built for running gh-ost migrations. When not running migrations, it'll stay the heck out of the way.

Installation

First, you'll need to install gh-ost. You can find the latest release here. You can check the allowed version range in the version checker (current range: [>= 1.1.0, < 2]). Once you've got that installed, install the gem!

Add this line to your application's Gemfile:

gem 'ghost_adapter'

And then execute:

$ bundle install

Usage

Connect with ActiveRecord

Configure your ActiveRecord connection to use mysql2_ghost as the adapter in whichever environments you'd like to use gh-ost.

For a standard rails project, in config/database.yml set adapter: mysql2_ghost.

For usage with DATABASE_URL, only a very tiny modification is necessary. The URL should be like: mysql2-ghost:// (notice the - instead of _). This is because the scheme of a URI must be either alphanumeric or one of [-, ., +] (more details)

Configuration

You can configure ghost_adapter with (nearly) all of the arguments allowed gh-ost in the command line. The arguments are up to date as of gh-ost version 1.1.0.

Read more about configuration methods in the docs.

Running Migrations

Since most database activity isn't a migration, we default to just using the Mysql2Adapter. No need to be executing a bunch of extra logic per query when you're only getting any value for migrations.

To enable the ghost adapter, you have two options. First (recommended) is to use the provided rails generator:

rails g ghost_adapter:install

This does everything you need. All migrations will run through gh-ost and otherwise the adapter will be ignored.

Alternatively, you can enable (or disable) gh-ost migrations with an environment variable.

GHOST_MIGRATE=1 rake db:...

If you have used the rails generator, you can set the variable to a falsey value and it will override the behavior not to use gh-ost.

  • "truthy" values: [1, t, true, y, yes]
  • "falsey" values: [0, f, false, n, no]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wetransfer/ghost_adapter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct. Please add your name to the CONTRIBUTORS.md

License

The gem is available as open source under the terms of the Hippocratic License.

Code of Conduct

Everyone interacting in the Ghost Adapter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.


Illustration by Icons 8 from Icons8

ghost_adapter's People

Contributors

acroos avatar choncou avatar dependabot[bot] avatar depfu[bot] avatar grdw avatar

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.