I would like to prevent rename_column from working in certain circumstances, so I was trying to redefine rename_column. However, it seems that the adapter''s definition loads afterward and wipes out what I put in. I have successfully overridden add_column, so I am confident that I have the definition in the right module. Is there a way to force the database adapter to load, so I can override is (adapter-specific) rename_column? (I guess I might be able to override each database-specific rename_column, but I don''t like that solution.) Thanks, --Paul
Paul Lynch wrote:> I would like to prevent rename_column from working in certain > circumstances, so I was trying to redefine rename_column.[...] Can I ask what you''re trying to accomplish here? In general, it seems to me that preventing something like this from working will probably be confusing to anyone maintaining the code. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Some of the tables in our system hold data entered by users of the web site. I am trying to stop one of us (developers) from shooting ourselves in the foot by accidentally modifying those tables in a way that would lose data. My plan is to capture calls to table change commands, record some of them (e.g. add_column) so that they can be played back later on the production database, and prohibit others (e.g. remove_column). On Jun 11, 4:28 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- s.net> wrote:> Paul Lynch wrote: > > I would like to prevent rename_column from working in certain > > circumstances, so I was trying to redefine rename_column. > > [...] > > Can I ask what you''re trying to accomplish here? In general, it seems > to me that preventing something like this from working will probably be > confusing to anyone maintaining the code. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.
Paul Lynch wrote:> Some of the tables in our system hold data entered by users of the web > site. I am trying to stop one of us (developers) from shooting > ourselves in the foot by accidentally modifying those tables in a way > that would lose data.This is almost certainly a bad idea. You should not be sandboxing the developers -- they should have full access to change what needs to be changed. If you can''t trust your developers to use that access wisely, fire them. If the data is that important, back it up. If developers really shouldn''t have that level of access to the DB at all, then don''t grant those privileges to the relevant DB user. But hackish solutions like what you''re talking about will just make the developers'' lives harder for no good reason. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAgh/B2vN+C6A@public.gmane.org -- Posted via http://www.ruby-forum.com/.