Forum: Typo plugins that alter the database

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matt R. (Guest)
on 2006-03-25 19:53
(Received via mailing list)
I've been working on a plugin that uses the ruby feed_tools module to
create a little mini-planet in the sidebar.  This is actually the
blog plugin that I've always wanted, and thanks to ruby, rails and
typo, I was able to code it up relatively easily.

	However, feed tools uses a database feed cache to store feeds, so
that it doesn't fetch the feeds every time the page loads.  On my
development database, I have added a cached_feeds table.  So now I'm
worried that if I make the same alterations to my production db,
It'll strand my typo install at whatever rev I'm at, without being
able to upgrade.

Is there any way I can incorporate my database changes so that it'll
co-operate with the rails migration process nicely.

I just installed the database migration by hand like this, on r946

mattrose@venice:~/rails/typo$ script/generate migration
       exists  db/migrate
       create  db/migrate/041_add_feed_tools_tables.rb

and edited db/migrate/041_add_feed_tools_tables.rb to look like this

mattrose@venice:~/rails/typo$ cat db/migrate/
class AddFeedToolsTables < ActiveRecord::Migration
   def self.up
     create_table :cached_feeds do |t|
       t.column :href, :string
       t.column :title, :string
       t.column :link, :string
       t.column :feed_data, :text
       t.column :feed_data_type, :string
       t.column :http_headers, :text
       t.column :last_retrieved, :datetime

   def self.down
     drop_table :cached_feeds

Now when I try to log in, I get an error updating the db

To fix it I have to issue:

mv db/migrate/041_add_feed_tools_tables.rb db/migrate/

and then my update proceeds.

Now I can go ahead and install the sidebar plugin

Now, that you know what I'm doing, can anyone tell me how to

a)  Make this process easier?
b) Make sure it co-operates with later db migrations


This topic is locked and can not be replied to.