008_add_comatose_support.rb
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Comatose
class Page < ActiveRecord::Base
set_table_name 'comatose_pages'
acts_as_versioned :if_changed => [:title, :slug, :keywords, :body]
end
end
class AddComatoseSupport < ActiveRecord::Migration
# Schema for Comatose version 0.7+
def self.up
create_table :comatose_pages do |t|
t.column "parent_id", :integer
t.column "full_path", :text, :default => ''
t.column "title", :string, :limit => 255
t.column "slug", :string, :limit => 255
t.column "keywords", :string, :limit => 255
t.column "body", :text
t.column "filter_type", :string, :limit => 25, :default => "[No Filter]"
t.column "author", :string, :limit => 255
t.column "position", :integer, :default => 0
t.column "version", :integer
t.column "updated_on", :datetime
t.column "created_on", :datetime
# added for STI in noosfero
t.column 'type', :string
end
Comatose::Page.create_versioned_table
puts "Creating the default 'Home Page'..."
Comatose::Page.create!( :title=>'Home Page', :body=>"h1. Welcome\n\nYour content goes here...", :author=>'System' )
end
def self.down
Comatose::Page.drop_versioned_table
drop_table :comatose_pages
end
end