0.0
No commit activity in last 3 years
No release in over 3 years
Declare a table structure like an ActiveRecord migration and run 'force_schema!' whenever you want. For when you don't need up and down migrations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

force_schema¶ ↑

class Car < ActiveRecord::Base
  set_primary_key :name
  force_schema do
    string   'name'       # Nissan Altima, will automatically be indexed because it's the primary key
    string   'make_name'  # Nissan
    string   'model_name' # Altime
    float    'fuel_efficiency_city'
    string   'fuel_efficiency_city_units'
    float    'fuel_efficiency_highway'
    string   'fuel_efficiency_highway_units'
    integer  'year'
    datetime 'released_at'
    date     'released_on'
    index    ['name', 'make_name']
  end
end

Warning: data loss¶ ↑

If you call Car.force_schema!, it may destroy data by adding, removing, or changing the type of columns. No attempt is made to preserve data.

What it synchronizes¶ ↑

  • adds missing columns

  • adds missing indexes

  • removes unrecognized columns

  • removes unrecognized indexes

  • changes the type of columns if it doesn’t match what you asked for

  • changes the columns indexed if they don’t match what you asked for

  • makes sure default value is synced up

Supported databases¶ ↑

  • MySQL is tested

  • SQLite is tested

  • Postgres is not supported

History¶ ↑

Extracted from github.com/seamusabshere/data_miner. In production use at carbon.brighterplanet.com and data.brighterplanet.com.

Copyright 2011 Seamus Abshere