From 42e2e86a08a3aa3ea949ad302859adbf1e41ad6d Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Sat, 24 Nov 2007 16:36:44 +0000 Subject: [PATCH] ActionItem21: seems to be the definitive database schema for articles --- db/migrate/007_create_articles.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+), 0 deletions(-) create mode 100644 db/migrate/007_create_articles.rb diff --git a/db/migrate/007_create_articles.rb b/db/migrate/007_create_articles.rb new file mode 100644 index 0000000..0c4ae28 --- /dev/null +++ b/db/migrate/007_create_articles.rb @@ -0,0 +1,35 @@ +class CreateArticles < ActiveRecord::Migration + def self.up + create_table :articles do |t| + + # acts as filesystem + t.column :name, :string + t.column :slug, :string + t.column :path, :text, :default => '' + + # main data + t.column :body, :text + + # belongs to profile + t.column :profile_id, :integer + + # acts as tree + t.column :parent_id, :integer + + # keep track of timestamps + t.column :updated_on, :datetime + t.column :created_on, :datetime + + # versioning stuff + t.column :version, :integer + t.column :lock_version, :integer + end + + Article.create_versioned_table + end + + def self.down + Article.drop_versioned_table + drop_table :articles + end +end -- libgit2 0.21.2