search for: schemastat

Displaying 10 results from an estimated 10 matches for "schemastat".

2006 Aug 02
2
mangle ActiveRecord
Dear Gurus on Rails! How do I change the behaviour of one method in ActiveRecord::ConnectionAdapters::SchemaStatements ? Full story: I''d like to mangle ActiveRecord::ConnectionAdapters::SchemaStatements so when it creates a new sql table, it also (optionally) creates my created_at, deleted, key_id, session_id etc columns that I use on basically all tables. It would not be DRY to repeat this on all m...
2006 Apr 20
5
Using Migrations to convert join table to join model
...rhaps it was a mistake, but I made (license_id, user_group_id) the primary key. Now, after playing with has_many :through, I have discovered that, among other modifications, I really need to add an id column to the table and make it the primary key. However, I cannot figure out how to use the SchemaStatements to add the new column, set it to auto-increment, and then redefine the primary key to be the id column instead of the (license_id, user_group_id) columns. I could use the execute statement and use SQL directly, but I would prefer not to (one of the reasons behind migrations, I thought, wa...
2006 Apr 17
7
MySQL backticks and column names
...`log'' .../lib/active_record/connection_adapters/mysql_adapter.rb:185:in `execute'' .../lib/active_record/connection_adapters/abstract/schema_statements.r b:196:in `add_index'' Which led me to the conclusion that the problem was in the add_index method of the SchemaStatements module. I added this method to the MySQL connection adapter and changed: execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(", ")})" To: execute "CREATE #{index_type} INDEX `#{index_name}` ON #{table_name}...
2009 Sep 28
5
Multi-databases support
Hi, While I was hacking ovirt-server, I have found that it's currently restricted to Postgres DB. Even if I like postgres for serious work on a server, I really prefer to hack/dev locally on a Sqlite or MySQL DB. I have googled on rails in order to find a good answer for the "foreign key problem" which forces OVirt to stay on pg. I have found a plugin on this particular
2006 Apr 25
0
Migrate default now()
...amp, :null => false, :default => ''current_timestamp'' It is converted to: created_at timestamp NOT NULL DEFAULT ''current_timestamp'' It''s wrong. I try to fixed it: default_fix.rb: module ActiveRecord module ConnectionAdapters # :nodoc: module SchemaStatements def add_column_options!(sql, options) #:nodoc: unless options[:default].nil? if options[:default] == "now" sql << " DEFAULT #{now(options[:default], options[:column])}" else sql << " DEFAULT #{quote...
2006 Feb 19
3
multi-sql problem?
hi all, how to excute multi sql statement in rails #------------------------------------------------------- sql_1 = ''drop table if exists test'' sql_2 = ''create temporary table test select * from test_1'' sql_3=''select * from test'' #------------------------------------------------------- any ideas all regards -- Posted via
2005 Dec 16
3
ActiveRecord: manually setting :id
Hey everyone, I''m having a problem with ActiveRecord (outside of Rails) where it doesn''t allow me to set the value of the :id column. Since you''re probably not normally supposed to fiddle with the primary key, I''m guessing that this isn''t a bug, but is intentional. Is there any way to override it? The reason I need this is that I''m making a
2005 Dec 05
0
bug in bubbleshare's Active Record extensions?
...h'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 /usr/bin/rake:18:in `load'' /usr/bin/rake:18 The dispatch in method_missing is sending the message to the wrong module within the plugin (it should be to SchemaStatements, not AbstractAdapter). I''m at a loss as to how to fix that, as I''m still figuring out how ActiveRecord is wired internally. Anyone know how to fix? Thanks! F -- Posted via http://www.ruby-forum.com/.
2006 Jan 27
5
Before I write this myself, is there already an easier way?
Recently I''ve wanted to be able to take the data I''ve painstakingly defined in my fixture files and slurp it up into my development database so I can play with my website (locally, in development mode) with the same data I use in my tests. In a similar vein, I want to take the table definitions in the development_structure.sql file and use it to re-define my development
2010 Apr 20
13
why is ActiveRecord tying to select nonex ID column?
I''ve loaded (and updated) thousands of these MeteredUsage records. In the middle of a run, I suddenly get: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''id'' in ''where clause'': UPDATE `metered_usages` SET `cost` = 12603.46 WHERE `id` = NULL I can''t see anything that''s different about this particular record compared to