Commit 5ecd62749480049e71a3ad67441bd6d32cc5a616

Authored by AntonioTerceiro
1 parent fae4fffe

ActionItem7: fixing migration ordering



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@207 3f533792-8f58-4932-b0fe-aaf55b0a4547
db/migrate/008_add_comatose_support.rb 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +module Comatose
  2 + class Page < ActiveRecord::Base
  3 + set_table_name 'comatose_pages'
  4 + acts_as_versioned :if_changed => [:title, :slug, :keywords, :body]
  5 + end
  6 +end
  7 +
  8 +class AddComatoseSupport < ActiveRecord::Migration
  9 +
  10 + # Schema for Comatose version 0.7+
  11 + def self.up
  12 + create_table :comatose_pages do |t|
  13 + t.column "parent_id", :integer
  14 + t.column "full_path", :text, :default => ''
  15 + t.column "title", :string, :limit => 255
  16 + t.column "slug", :string, :limit => 255
  17 + t.column "keywords", :string, :limit => 255
  18 + t.column "body", :text
  19 + t.column "filter_type", :string, :limit => 25, :default => "Textile"
  20 + t.column "author", :string, :limit => 255
  21 + t.column "position", :integer, :default => 0
  22 + t.column "version", :integer
  23 + t.column "updated_on", :datetime
  24 + t.column "created_on", :datetime
  25 + end
  26 + Comatose::Page.create_versioned_table
  27 + puts "Creating the default 'Home Page'..."
  28 + Comatose::Page.create( :title=>'Home Page', :body=>"h1. Welcome\n\nYour content goes here...", :author=>'System' )
  29 + end
  30 +
  31 + def self.down
  32 + Comatose::Page.drop_versioned_table
  33 + drop_table :comatose_pages
  34 + end
  35 +
  36 +end
db/migrate/009_add_comatose_support.rb
@@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
1 -module Comatose  
2 - class Page < ActiveRecord::Base  
3 - set_table_name 'comatose_pages'  
4 - acts_as_versioned :if_changed => [:title, :slug, :keywords, :body]  
5 - end  
6 -end  
7 -  
8 -class AddComatoseSupport < ActiveRecord::Migration  
9 -  
10 - # Schema for Comatose version 0.7+  
11 - def self.up  
12 - create_table :comatose_pages do |t|  
13 - t.column "parent_id", :integer  
14 - t.column "full_path", :text, :default => ''  
15 - t.column "title", :string, :limit => 255  
16 - t.column "slug", :string, :limit => 255  
17 - t.column "keywords", :string, :limit => 255  
18 - t.column "body", :text  
19 - t.column "filter_type", :string, :limit => 25, :default => "Textile"  
20 - t.column "author", :string, :limit => 255  
21 - t.column "position", :integer, :default => 0  
22 - t.column "version", :integer  
23 - t.column "updated_on", :datetime  
24 - t.column "created_on", :datetime  
25 - end  
26 - Comatose::Page.create_versioned_table  
27 - puts "Creating the default 'Home Page'..."  
28 - Comatose::Page.create( :title=>'Home Page', :body=>"h1. Welcome\n\nYour content goes here...", :author=>'System' )  
29 - end  
30 -  
31 - def self.down  
32 - Comatose::Page.drop_versioned_table  
33 - drop_table :comatose_pages  
34 - end  
35 -  
36 -end