jenseng / hair_trigger

Happy database triggers for ActiveRecord
MIT License
770 stars 94 forks source link

Triggers at the beginning of schema, before tables created #70

Open sportsbook123 opened 6 years ago

sportsbook123 commented 6 years ago

When I dump a schema for a DB with some triggers on some tables, them triggers are added at the top of the schema.rb file before the table definitions. When trying to load the schema it throws errors for the missing tables.

Any way around this? Basically need to be able to specify triggers should go last in the schema file.

jenseng commented 5 years ago

Hi @sportsbook123, I haven't seen this issue before. The triggers are added at the very end of the schema dumping code by extending the trailer method (which normally just outputs the end)

Anything unusual happening in your environment or other details you could provide, e.g. rails version, Gemfile, whether you use multiple dbs, etc.?