8000 GitHub - activestylus/minirecord_test: Debugging auto-generated columns from Mini_record gem
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

activestylus/minirecord_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing MiniRecord

This is an app which debugs mini_record with mysql2 driver. All debugging is done in rails console

$ rails console
Loading development environment (Rails 3.1.3)
ruby-1.9.3-p0 :001 > Post.auto_upgrade!
   (43.7ms)  CREATE TABLE `posts` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `created_at` datetime, `updated_at` datetime, `author_id` int(11)) ENGINE=InnoDB
   (149.5ms)  CREATE INDEX `index_posts_on_author_id` ON `posts` (`author_id`)

ruby-1.9.3-p0 :001 > exit

So far so good. Let's re-initialize and try that again.

$ rails console
Loading development environment (Rails 3.1.3)
ruby-1.9.3-p0 :001 > Post.auto_upgrade!
   (50.9ms)  ALTER TABLE `posts` DROP `author_id`
   (206.3ms)  ALTER TABLE `posts` ADD `author_id` int(11)
   (119.6ms)  CREATE INDEX `index_posts_on_author_id` ON `posts` (`author_id`)
 => nil

As you can see the foreign key field is dropped, nuking any association data before recreating the same field again.

About

Debugging auto-generated columns from Mini_record gem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0