Commit 42e2e86a08a3aa3ea949ad302859adbf1e41ad6d
1 parent
f83ac4db
Exists in
master
and in
23 other branches
ActionItem21: seems to be the definitive database schema for articles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@938 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
35 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +class CreateArticles < ActiveRecord::Migration | ||
| 2 | + def self.up | ||
| 3 | + create_table :articles do |t| | ||
| 4 | + | ||
| 5 | + # acts as filesystem | ||
| 6 | + t.column :name, :string | ||
| 7 | + t.column :slug, :string | ||
| 8 | + t.column :path, :text, :default => '' | ||
| 9 | + | ||
| 10 | + # main data | ||
| 11 | + t.column :body, :text | ||
| 12 | + | ||
| 13 | + # belongs to profile | ||
| 14 | + t.column :profile_id, :integer | ||
| 15 | + | ||
| 16 | + # acts as tree | ||
| 17 | + t.column :parent_id, :integer | ||
| 18 | + | ||
| 19 | + # keep track of timestamps | ||
| 20 | + t.column :updated_on, :datetime | ||
| 21 | + t.column :created_on, :datetime | ||
| 22 | + | ||
| 23 | + # versioning stuff | ||
| 24 | + t.column :version, :integer | ||
| 25 | + t.column :lock_version, :integer | ||
| 26 | + end | ||
| 27 | + | ||
| 28 | + Article.create_versioned_table | ||
| 29 | + end | ||
| 30 | + | ||
| 31 | + def self.down | ||
| 32 | + Article.drop_versioned_table | ||
| 33 | + drop_table :articles | ||
| 34 | + end | ||
| 35 | +end |