DHAMODHARAN N
2013-Jan-08 07:00 UTC
Single table inheritance introduce on mid of development.
Hi Folks, 1. I converting existing model to STI 2. Existing model CtctContact 3. ctct_contacts rename as contacts and add column called type in table. 4. In model modified base class(CtctContact < Contact) during migration it''s show contacts table not found like that. Any idea how to fix. Thanks, Dhamodharan.N -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jan-08 09:40 UTC
Re: Single table inheritance introduce on mid of development.
On 8 January 2013 07:00, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Folks, > > 1. I converting existing model to STI > 2. Existing model CtctContact > 3. ctct_contacts rename as contacts and add column called type in table. > 4. In model modified base class(CtctContact < Contact) during migration it''s > show contacts table not found like that.Do you mean that it is the migration to change the table name and add the type column that is failing? Show us the failing code (just the section that is failing) and the exact error message and stack trace. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
DHAMODHARAN N
2013-Jan-08 11:34 UTC
Re: Single table inheritance introduce on mid of development.
Hi Colin Law, Existin code ctct_contact.rb => class CtctContact < Contact After changes ctct_contact.rb => class CtctContact < ActiveRecord::Base Above changes works fine for me but we cant proceed with that changes right? Trace : -- add_index(:ctct_contacts, [:ctct_account_id, :email_address], {:unique=>true}) -> 0.0732s rake aborted! An error has occurred, this and all later migrations canceled: PG::Error: ERROR: relation "contacts" does not exist LINE 4: WHERE a.attrelid = ''"contacts"''::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = ''"contacts"''::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `async_exec'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `exec_no_cache'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:664:in `block in exec_query'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/instrumentation/active_record.rb:32:in `block in log_with_newrelic_instrumentation'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/instrumentation/active_record.rb:29:in `log_with_newrelic_instrumentation'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `exec_query'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1276:in `column_definitions'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:859:in `columns'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `yield'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `default'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in `columns'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:237:in `columns_hash'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/base.rb:455:in `relation'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/scoping/named.rb:37:in `scoped'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/querying.rb:5:in `find'' /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:14:in `block in obfuscate_current_contacts'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'' /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:13:in `obfuscate_current_contacts'' /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in `change'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block (2 levels) in migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block in migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:389:in `migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in `migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `call'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `block in ddl_transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `ddl_transaction'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:719:in `block in migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `each'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:570:in `up'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:551:in `migrate'' /home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'' On Tue, Jan 8, 2013 at 3:10 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 8 January 2013 07:00, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Folks, > > > > 1. I converting existing model to STI > > 2. Existing model CtctContact > > 3. ctct_contacts rename as contacts and add column called type in table. > > 4. In model modified base class(CtctContact < Contact) during migration > it''s > > show contacts table not found like that. > > Do you mean that it is the migration to change the table name and add > the type column that is failing? > Show us the failing code (just the section that is failing) and the > exact error message and stack trace. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jan-08 11:43 UTC
Re: Single table inheritance introduce on mid of development.
On 8 January 2013 11:34, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Colin Law, > > Existin code ctct_contact.rb => class CtctContact < Contact > > After changes ctct_contact.rb => class CtctContact < ActiveRecord::Base > > Above changes works fine for me but we cant proceed with that changes right?I don''t understand what you mean. I thought you were moving /to/ STI, not away from it.> > > Trace : > > -- add_index(:ctct_contacts, [:ctct_account_id, :email_address], > {:unique=>true}) > -> 0.0732s > rake aborted! > An error has occurred, this and all later migrations canceled: > > PG::Error: ERROR: relation "contacts" does not existShow us the whole migration code please. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
DHAMODHARAN N
2013-Jan-08 12:33 UTC
Re: Single table inheritance introduce on mid of development.
Migration1: class RenameTableForMailchimp < ActiveRecord::Migration def change rename_table :ctct_contacts, :contacts end end Migration2: class AddTypeColumnForMailchimp < ActiveRecord::Migration def change add_column :contacts, :type, :string end end On Tue, Jan 8, 2013 at 5:13 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 8 January 2013 11:34, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Colin Law, > > > > Existin code ctct_contact.rb => class CtctContact < Contact > > > > After changes ctct_contact.rb => class CtctContact < ActiveRecord::Base > > > > Above changes works fine for me but we cant proceed with that changes > right? > > I don''t understand what you mean. I thought you were moving /to/ STI, > not away from it. > > > > > > > Trace : > > > > -- add_index(:ctct_contacts, [:ctct_account_id, :email_address], > > {:unique=>true}) > > -> 0.0732s > > rake aborted! > > An error has occurred, this and all later migrations canceled: > > > > PG::Error: ERROR: relation "contacts" does not exist > > Show us the whole migration code please. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jan-08 13:28 UTC
Re: Single table inheritance introduce on mid of development.
On 8 January 2013 12:33, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Migration1: > class RenameTableForMailchimp < ActiveRecord::Migration > def change > rename_table :ctct_contacts, :contacts > end > end > > Migration2: > class AddTypeColumnForMailchimp < ActiveRecord::Migration > def change > add_column :contacts, :type, :string > end > endPlease don''t top post, it makes it difficult to follow the thread. Insert your replies inline at appropriate points. The error you showed came from /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in `change'' so it might be helpful to show that migration. I presume the migrations above ran successfully and that you have checked in the database that the table has been renamed and the type column added ok. Colin> > > On Tue, Jan 8, 2013 at 5:13 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 8 January 2013 11:34, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Hi Colin Law, >> > >> > Existin code ctct_contact.rb => class CtctContact < Contact >> > >> > After changes ctct_contact.rb => class CtctContact < ActiveRecord::Base >> > >> > Above changes works fine for me but we cant proceed with that changes >> > right? >> >> I don''t understand what you mean. I thought you were moving /to/ STI, >> not away from it. >> >> > >> > >> > Trace : >> > >> > -- add_index(:ctct_contacts, [:ctct_account_id, :email_address], >> > {:unique=>true}) >> > -> 0.0732s >> > rake aborted! >> > An error has occurred, this and all later migrations canceled: >> > >> > PG::Error: ERROR: relation "contacts" does not exist >> >> Show us the whole migration code please. >> >> Colin >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
DHAMODHARAN N
2013-Jan-08 14:03 UTC
Re: Single table inheritance introduce on mid of development.
On Tue, Jan 8, 2013 at 6:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 8 January 2013 12:33, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Migration1: > > class RenameTableForMailchimp < ActiveRecord::Migration > > def change > > rename_table :ctct_contacts, :contacts > > end > > end > > > > Migration2: > > class AddTypeColumnForMailchimp < ActiveRecord::Migration > > def change > > add_column :contacts, :type, :string > > end > > end > > Please don''t top post, it makes it difficult to follow the thread. > Insert your replies inline at appropriate points. > > The error you showed came from > > /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in > `change'' so it might be helpful to show that migration. I presume the > migrations above ran successfully and that you have checked in the > database that the table has been renamed and the type column added ok. > >Thanks Lot Colin Law, Cause of issue is in that migration have data migration script(like invoking CtctContact model) but current code CtctContact base class Contact so it try to search contact table. Colin> > > > > > > > > On Tue, Jan 8, 2013 at 5:13 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 8 January 2013 11:34, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > Hi Colin Law, > >> > > >> > Existin code ctct_contact.rb => class CtctContact < Contact > >> > > >> > After changes ctct_contact.rb => class CtctContact < > ActiveRecord::Base > >> > > >> > Above changes works fine for me but we cant proceed with that changes > >> > right? > >> > >> I don''t understand what you mean. I thought you were moving /to/ STI, > >> not away from it. > >> > >> > > >> > > >> > Trace : > >> > > >> > -- add_index(:ctct_contacts, [:ctct_account_id, :email_address], > >> > {:unique=>true}) > >> > -> 0.0732s > >> > rake aborted! > >> > An error has occurred, this and all later migrations canceled: > >> > > >> > PG::Error: ERROR: relation "contacts" does not exist > >> > >> Show us the whole migration code please. > >> > >> Colin > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Ruby on Rails: Talk" group. > >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> To unsubscribe from this group, send email to > >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jan-08 14:11 UTC
Re: Single table inheritance introduce on mid of development.
On 8 January 2013 14:03, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Tue, Jan 8, 2013 at 6:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 8 January 2013 12:33, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Migration1: >> > class RenameTableForMailchimp < ActiveRecord::Migration >> > def change >> > rename_table :ctct_contacts, :contacts >> > end >> > end >> > >> > Migration2: >> > class AddTypeColumnForMailchimp < ActiveRecord::Migration >> > def change >> > add_column :contacts, :type, :string >> > end >> > end >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your replies inline at appropriate points. >> >> The error you showed came from >> >> /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in >> `change'' so it might be helpful to show that migration. I presume the >> migrations above ran successfully and that you have checked in the >> database that the table has been renamed and the type column added ok. >> > > Thanks Lot Colin Law, > > Cause of issue is in that migration have data migration script(like > invoking CtctContact model) but current code CtctContact base class Contact > so it try to search contact table.Sorry, I still don''t know what you mean as you still have not posted the code that is generating the error. If you still have a problem post the full code of the migration rb file and the full error that you are seeing when you run rake db:migrate. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
DHAMODHARAN N
2013-Jan-08 14:35 UTC
Re: Single table inheritance introduce on mid of development.
On Tue, Jan 8, 2013 at 7:41 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 8 January 2013 14:03, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > On Tue, Jan 8, 2013 at 6:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 8 January 2013 12:33, DHAMODHARAN N <dhamsoft-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > Migration1: > >> > class RenameTableForMailchimp < ActiveRecord::Migration > >> > def change > >> > rename_table :ctct_contacts, :contacts > >> > end > >> > end > >> > > >> > Migration2: > >> > class AddTypeColumnForMailchimp < ActiveRecord::Migration > >> > def change > >> > add_column :contacts, :type, :string > >> > end > >> > end > >> > >> Please don''t top post, it makes it difficult to follow the thread. > >> Insert your replies inline at appropriate points. > >> > >> The error you showed came from > >> > >> > /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in > >> `change'' so it might be helpful to show that migration. I presume the > >> migrations above ran successfully and that you have checked in the > >> database that the table has been renamed and the type column added ok. > >> > > > > Thanks Lot Colin Law, > > > > Cause of issue is in that migration have data migration script(like > > invoking CtctContact model) but current code CtctContact base class > Contact > > so it try to search contact table. > > Sorry, I still don''t know what you mean as you still have not posted > the code that is generating the error. If you still have a problem > post the full code of the migration rb file and the full error that > you are seeing when you run rake db:migrate. > > Colin >sample code: def change add_index :ctct_contacts, [:ctct_account_id, :email_address], :unique => true obfuscate_current_contacts end def obfuscate_current_contacts CtctContact.transaction do CtctContact.find(:all).each do |c| #some code with c object end end end Problem solved commenting obfuscate_current_contacts method invoking. Cause of issue we are invoking current code base CtctContact base class Contact so its seeking contacts table. But our table rename migration later. Thanks, Dhamodharan> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.