| #-- |
| # ENH R1 database sessions (ActiveRecordStore instead of sessions stored in a flat file |
| #++ |
| # |
| #--###################################################################### |
| # Copyright (c) 2006 LogicaCMG |
| # |
| # All rights reserved. This program and the accompanying materials |
| # are made available under the terms of the Eclipse Public License v1.0 |
| # which accompanies this distribution, and is available at |
| # http://www.eclipse.org/legal/epl-v10.html |
| # |
| # Contributors: |
| # |
| # Onno van der Straaten:: initial implementation |
| #++###################################################################### |
| # EPF_Wiki_Copyright[link:files/COPYRIGHT.html] |
| |
| class Initial < ActiveRecord::Migration |
| def self.up |
| create_table "baselines", :force => true do |t| |
| t.column "baseline", :string, :limit => 250, :default => "", :null => false |
| t.column "buildid", :string, :limit => 250, :default => "", :null => false |
| t.column "description", :text |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "baselines", ["baseline"], :name => "baseline", :unique => true |
| |
| create_table "baselines_pages", :id => false, :force => true do |t| |
| t.column "baseline_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "page_id", :integer, :limit => 10 |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "baselines_pages", ["baseline_id", "page_id"], :name => "baselines_pages_baseline_id_index", :unique => true |
| |
| create_table "baselines_sites", :id => false, :force => true do |t| |
| t.column "site_id", :integer, :limit => 10 |
| t.column "baseline_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "baselines_sites", ["site_id", "baseline_id"], :name => "baselines_sites_site_id_index", :unique => true |
| |
| create_table "checkouts", :force => true do |t| |
| t.column "user_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "site_id", :integer, :limit => 10 |
| t.column "page_id", :integer, :limit => 10 |
| t.column "version_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "baseline_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "checkouts", ["user_id"], :name => "checkouts_user_id_index" |
| add_index "checkouts", ["page_id"], :name => "checkouts_page_id_index" |
| add_index "checkouts", ["version_id"], :name => "checkouts_version_id_index" |
| add_index "checkouts", ["baseline_id"], :name => "checkouts_baseline_id_index" |
| add_index "checkouts", ["site_id"], :name => "checkouts_site_id_index" |
| |
| create_table "comments", :force => true do |t| |
| t.column "text", :text |
| t.column "ip_address", :string, :limit => 500 |
| t.column "done", :string, :limit => 1, :default => "N", :null => false |
| t.column "user_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "page_id", :integer, :limit => 10 |
| t.column "site_id", :integer, :limit => 10 |
| t.column "version_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "baseline_id", :integer, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "reviewer_id", :integer |
| t.column "user_id_markdone", :integer |
| t.column "user_id_marktodo", :integer |
| end |
| |
| add_index "comments", ["page_id"], :name => "comments_page_id_index" |
| add_index "comments", ["site_id"], :name => "comments_site_id_index" |
| add_index "comments", ["user_id"], :name => "comments_user_id_index" |
| add_index "comments", ["version_id"], :name => "comments_version_id_index" |
| add_index "comments", ["baseline_id"], :name => "comments_baseline_id_index" |
| |
| create_table "difference_analyses", :force => true do |t| |
| t.column "site_id", :integer, :limit => 10 |
| t.column "site_id_from", :integer, :limit => 10 |
| t.column "baseline_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "baseline_id_from", :integer, :limit => 10, :default => 0, :null => false |
| t.column "difference_analysis_items_count", :integer, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "analyzed_on", :datetime |
| end |
| |
| add_index "difference_analyses", ["site_id"], :name => "difference_analyses_site_id_index" |
| add_index "difference_analyses", ["site_id_from"], :name => "difference_analyses_site_id_from_index" |
| add_index "difference_analyses", ["baseline_id_from"], :name => "difference_analyses_baseline_id_from_index" |
| add_index "difference_analyses", ["baseline_id"], :name => "difference_analyses_baseline_id_index" |
| |
| create_table "difference_analysis_items", :force => true do |t| |
| t.column "difference_analysis_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "page_id", :integer, :limit => 10 |
| t.column "result", :string, :limit => 500, :default => "", :null => false |
| t.column "diff", :text |
| t.column "diff_html", :text |
| end |
| |
| add_index "difference_analysis_items", ["page_id"], :name => "difference_analysis_items_page_id_index" |
| add_index "difference_analysis_items", ["difference_analysis_id"], :name => "difference_analysis_items_difference_analysis_id_index" |
| |
| create_table "notifications", :force => true do |t| |
| t.column "page_id", :integer, :limit => 10 |
| t.column "site_id", :integer, :limit => 10 |
| t.column "user_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "notification_type", :string, :limit => 50, :default => "", :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "notifications", ["page_id"], :name => "notifications_page_id_index" |
| add_index "notifications", ["site_id"], :name => "notifications_site_id_index" |
| add_index "notifications", ["user_id"], :name => "notifications_user_id_index" |
| |
| create_table "pages", :force => true do |t| |
| t.column "rel_path", :string, :limit => 767, :default => "", :null => false |
| t.column "presentation_name", :string, :limit => 500, :default => "", :null => false |
| t.column "content_type", :string, :limit => 100, :default => "", :null => false |
| t.column "filename", :string, :limit => 250, :default => "", :null => false |
| t.column "versions_count", :integer, :default => 0, :null => false |
| t.column "comments_count", :integer, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "body_tag", :string, :limit => 1000 |
| t.column "treebrowser_tag", :string, :limit => 1000 |
| t.column "copyright_tag", :string, :limit => 1000 |
| t.column "text", :text |
| end |
| |
| add_index "pages", ["rel_path"], :name => "pages_rel_path_index", :unique => true |
| |
| create_table "pages_sites", :id => false, :force => true do |t| |
| t.column "site_id", :integer, :limit => 10 |
| t.column "page_id", :integer, :limit => 10 |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| end |
| |
| add_index "pages_sites", ["site_id", "page_id"], :name => "pages_sites_site_id_index", :unique => true |
| |
| create_table "sites", :force => true do |t| |
| t.column "title", :string, :limit => 40, :default => "", :null => false |
| t.column "description", :text |
| t.column "site_type", :string, :limit => 1 |
| t.column "baseline_id", :integer, :limit => 10 |
| t.column "site_id_baseline_process", :integer, :limit => 10 |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "html_files_count", :integer |
| t.column "wikifiable_files_count", :integer |
| t.column "user_id", :integer |
| t.column "content_scanned_on", :datetime |
| t.column "folder", :string, :limit => 200, :default => "", :null => false |
| end |
| |
| add_index "sites", ["baseline_id"], :name => "sites_baseline_id_index" |
| add_index "sites", ["site_id_baseline_process"], :name => "sites_site_id_baseline_process_index" |
| add_index "sites", ["user_id"], :name => "sites_user_id_index" |
| |
| create_table "users", :force => true do |t| |
| t.column "email", :string, :limit => 250, :default => "", :null => false |
| t.column "name", :string, :limit => 50, :default => "", :null => false |
| t.column "ip_address", :string, :limit => 20, :default => "", :null => false |
| t.column "hashed_password", :string, :limit => 40 |
| t.column "hashed_password_new", :string, :limit => 40 |
| t.column "admin", :string, :limit => 1, :default => "N", :null => false |
| t.column "notify_daily", :integer, :limit => 1, :default => 0, :null => false |
| t.column "notify_weekly", :integer, :limit => 1, :default => 0, :null => false |
| t.column "notify_monthly", :integer, :limit => 1, :default => 0, :null => false |
| t.column "site_id", :integer, :limit => 10 |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "http_user_agent", :string, :limit => 250 |
| t.column "logon_count", :integer, :limit => 5, :default => 0 |
| t.column "logon_using_cookie_count", :integer, :limit => 5, :default => 0 |
| t.column "last_logon", :datetime |
| t.column "confirmed_on", :datetime |
| end |
| |
| add_index "users", ["email"], :name => "users_email_index", :unique => true |
| add_index "users", ["site_id"], :name => "users_site_id_index" |
| |
| create_table "versions", :force => true do |t| |
| t.column "version", :integer, :limit => 3, :default => 0, :null => false |
| t.column "note", :text |
| t.column "done", :string, :limit => 1, :default => "N", :null => false |
| t.column "user_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "page_id", :integer, :limit => 10 |
| t.column "site_id", :integer, :limit => 10 |
| t.column "version_id", :integer, :limit => 10 |
| t.column "baseline_id", :integer, :limit => 10, :default => 0, :null => false |
| t.column "created_on", :datetime |
| t.column "updated_on", :datetime |
| t.column "reviewer_id", :integer |
| t.column "user_id_markdone", :integer |
| t.column "user_id_marktodo", :integer |
| t.column "rel_path", :string, :limit => 1000, :default => "", :null => false |
| end |
| |
| add_index "versions", ["version", "site_id", "page_id", "baseline_id"], :name => "versions_version_index", :unique => true |
| add_index "versions", ["user_id"], :name => "versions_user_id_index" |
| add_index "versions", ["page_id"], :name => "versions_page_id_index" |
| add_index "versions", ["site_id"], :name => "versions_site_id_index" |
| add_index "versions", ["version_id"], :name => "versions_version_id_index" |
| add_index "versions", ["baseline_id"], :name => "versions_baseline_id_index" |
| add_index "versions", ["reviewer_id"], :name => "versions_reviewer_id_index" |
| end |
| |
| def self.down |
| drop_table "baselines_pages" |
| drop_table "baselines_sites" |
| drop_table "checkouts" |
| drop_table "comments" |
| drop_table "difference_analyses" |
| drop_table "difference_analysis_items" |
| drop_table "notifications" |
| drop_table "pages" |
| drop_table "pages_sites" |
| drop_table "sites" |
| drop_table "users" |
| drop_table "versions" |
| end |
| end |