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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/generators/gluttonberg/blog/templates/blog_migration.rb', line 2
def self.up
create_table :gb_blogs do |t|
t.string :name, :null => false
t.string :slug, :null => false
t.text :description
t.integer :user_id, :null => false
t.column :state , :string
t.boolean :moderation_required, :default => true
t.string :seo_title
t.text :seo_keywords
t.text :seo_description
t.integer :fb_icon_id
t.string :previous_slug
t.datetime :published_at
t.timestamps
end
create_table :gb_articles do |t|
t.string :slug, :null => false
t.integer :blog_id, :null => false
t.integer :user_id, :null => false
t.integer :author_id, :null => false
t.column :state , :string t.column :disable_comments , :boolean , :default => false
t.datetime :published_at
t.string :previous_slug
t.timestamps
end
create_table :gb_comments do |t|
t.text :body
t.string :author_name
t.string :author_email
t.string :author_website
t.references :commentable, :polymorphic => true
t.integer :author_id
t.boolean :moderation_required, :default => true
t.boolean :approved, :default => false
t.datetime :notification_sent_at
t.timestamps
end
create_table :gb_comment_subscriptions do |t|
t.integer :article_id
t.string :author_name
t.string :author_email
t.string :reference_hash
t.timestamps
end
create_table :gb_article_localizations do |t|
t.string :title, :null => false
t.text :excerpt
t.text :body
t.integer :featured_image_id
t.column :article_id, :integer
t.column :locale_id, :integer
t.column :version, :integer
t.string :seo_title
t.text :seo_keywords
t.text :seo_description
t.integer :fb_icon_id
t.timestamps
end
begin
Gluttonberg::Blog.create_versioned_table
rescue => e
puts e
end
begin
Gluttonberg::ArticleLocalization.create_versioned_table
rescue => e
puts e
end
end
|