Repository is archived
No commit activity in last 3 years
No release in over 3 years
Provide tools to create and manage database triggers through Rails project. Based on Yacine Petitprez's rails_db_views gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0
~> 1.2.3
 Project Readme

THIS GEM IS NOW OBSOLETE!

Unless all you ever need is triggers this gem is obsoleted with the release of https://github.com/neongrau/rails_db_objects where you can manage not only triggers but also views, functions, stored procedures, assemblies or basically do anything with plain custom SQL that does not fit into regular migrations.

THIS GEM IS NOW OBSOLETE!

rails_db_triggers

Manage db triggers in Rails

Blatantly copied from https://github.com/anykeyh/rails_db_views as the basis

Exactly like Yacine's gem for managing views, this gem will handle creating and dropping triggers that reside in /db/triggers/*.sql files. The name part of the .sql file will serve as the trigger name. Whenever rake db:migrate or rake db:rollback is called all triggers will be dropped and (re-)created afterwards. To delete a trigger just save the .sql file empty and it will be deleted next time you run migrations and be skippedduring trigger creation.

How to use

Just add rails_db_triggers to your Gemfile:

gem 'rails_db_triggers'

Configurate paths & extensions

You can add/remove new paths in the initializers of Rails:

Rails.configure do |config|
  config.rails_db_triggers[:triggers_path] += %w( /some/view/path ) # defaults to /db/triggers
  config.rails_db_triggers[:triggers_ext] = "*.dbtrigger" #Using custom extensions to override default ".sql" extension.
  config.rails_db_triggers[:triggers_dbschema] = [] # if you don't need prefixes - defaults to ['dbo']
end

Licensing

MIT

Ralf.