diff --git a/db/migrate/007_add_comatose_support.rb b/db/migrate/007_add_comatose_support.rb new file mode 100644 index 0000000..2a39602 --- /dev/null +++ b/db/migrate/007_add_comatose_support.rb @@ -0,0 +1,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 diff --git a/db/migrate/008_add_comatose_support.rb b/db/migrate/008_add_comatose_support.rb deleted file mode 100644 index 2a39602..0000000 --- a/db/migrate/008_add_comatose_support.rb +++ /dev/null @@ -1,40 +0,0 @@ -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 diff --git a/db/migrate/008_create_organization_infos.rb b/db/migrate/008_create_organization_infos.rb new file mode 100644 index 0000000..20419da --- /dev/null +++ b/db/migrate/008_create_organization_infos.rb @@ -0,0 +1,18 @@ +class CreateOrganizationInfos < ActiveRecord::Migration + def self.up + create_table :organization_infos do |t| + t.column :organization_id, :integer + t.column :contact_person, :string + t.column :acronym, :string + t.column :foundation_year, :integer, :limit => 4 + t.column :legal_form, :string + t.column :economic_activity, :string + t.column :management_information, :string + t.column :validated, :boolean, :default => false + end + end + + def self.down + drop_table :organization_infos + end +end diff --git a/db/migrate/009_create_friendships.rb b/db/migrate/009_create_friendships.rb new file mode 100644 index 0000000..32ce15e --- /dev/null +++ b/db/migrate/009_create_friendships.rb @@ -0,0 +1,13 @@ +class CreateFriendships < ActiveRecord::Migration + def self.up + create_table :friendships do |t| + t.column :person_id, :integer + t.column :friend_id, :integer + t.column :created_at, :datetime + end + end + + def self.down + drop_table :friendships + end +end diff --git a/db/migrate/010_create_organization_infos.rb b/db/migrate/010_create_organization_infos.rb deleted file mode 100644 index 20419da..0000000 --- a/db/migrate/010_create_organization_infos.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateOrganizationInfos < ActiveRecord::Migration - def self.up - create_table :organization_infos do |t| - t.column :organization_id, :integer - t.column :contact_person, :string - t.column :acronym, :string - t.column :foundation_year, :integer, :limit => 4 - t.column :legal_form, :string - t.column :economic_activity, :string - t.column :management_information, :string - t.column :validated, :boolean, :default => false - end - end - - def self.down - drop_table :organization_infos - end -end diff --git a/db/migrate/010_create_person_infos.rb b/db/migrate/010_create_person_infos.rb new file mode 100644 index 0000000..79a56b2 --- /dev/null +++ b/db/migrate/010_create_person_infos.rb @@ -0,0 +1,16 @@ +class CreatePersonInfos < ActiveRecord::Migration + def self.up + create_table :person_infos do |t| + t.column :name, :string + t.column :photo, :text + t.column :address, :text + t.column :contact_information, :text + + t.column :person_id, :integer + end + end + + def self.down + drop_table :person_infos + end +end diff --git a/db/migrate/011_create_categories.rb b/db/migrate/011_create_categories.rb new file mode 100644 index 0000000..9dc8b37 --- /dev/null +++ b/db/migrate/011_create_categories.rb @@ -0,0 +1,19 @@ +class CreateCategories < ActiveRecord::Migration + def self.up + create_table :categories do |t| + t.column :name, :string + t.column :slug, :string + t.column :path, :text, :default => '' + + t.column :display_color, :integer + + t.column :environment_id, :integer + t.column :parent_id, :integer + t.column :type, :string + end + end + + def self.down + drop_table :categories + end +end diff --git a/db/migrate/011_create_friendships.rb b/db/migrate/011_create_friendships.rb deleted file mode 100644 index 32ce15e..0000000 --- a/db/migrate/011_create_friendships.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateFriendships < ActiveRecord::Migration - def self.up - create_table :friendships do |t| - t.column :person_id, :integer - t.column :friend_id, :integer - t.column :created_at, :datetime - end - end - - def self.down - drop_table :friendships - end -end diff --git a/db/migrate/012_create_tasks.rb b/db/migrate/012_create_tasks.rb new file mode 100644 index 0000000..5b3817b --- /dev/null +++ b/db/migrate/012_create_tasks.rb @@ -0,0 +1,18 @@ +class CreateTasks < ActiveRecord::Migration + def self.up + create_table :tasks do |t| + t.column :data, :text + t.column :status, :integer + t.column :end_date, :date + + t.column :requestor_id, :integer + t.column :target_id, :integer + + t.column :code, :string, :limit => 40 + end + end + + def self.down + drop_table :tasks + end +end diff --git a/db/migrate/013_access_control_migration.rb b/db/migrate/013_access_control_migration.rb new file mode 100644 index 0000000..543fc08 --- /dev/null +++ b/db/migrate/013_access_control_migration.rb @@ -0,0 +1,21 @@ +class AccessControlMigration < ActiveRecord::Migration + def self.up + create_table :roles do |t| + t.column :name, :string + t.column :permissions, :string + end + + create_table :role_assignments do |t| + t.column :accessor_id, :integer + t.column :accessor_type, :string + t.column :resource_id, :integer + t.column :resource_type, :string + t.column :role_id, :integer + end + end + + def self.down + drop_table :roles + drop_table :role_assignments + end +end diff --git a/db/migrate/013_create_person_infos.rb b/db/migrate/013_create_person_infos.rb deleted file mode 100644 index 79a56b2..0000000 --- a/db/migrate/013_create_person_infos.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreatePersonInfos < ActiveRecord::Migration - def self.up - create_table :person_infos do |t| - t.column :name, :string - t.column :photo, :text - t.column :address, :text - t.column :contact_information, :text - - t.column :person_id, :integer - end - end - - def self.down - drop_table :person_infos - end -end diff --git a/db/migrate/014_create_region_validators_table.rb b/db/migrate/014_create_region_validators_table.rb new file mode 100644 index 0000000..0f718a6 --- /dev/null +++ b/db/migrate/014_create_region_validators_table.rb @@ -0,0 +1,12 @@ +class CreateRegionValidatorsTable < ActiveRecord::Migration + def self.up + create_table :region_validators, :id => false do |t| + t.column :region_id, :integer + t.column :organization_id, :integer + end + end + + def self.down + drop_table :region_validators + end +end diff --git a/db/migrate/016_create_categories.rb b/db/migrate/016_create_categories.rb deleted file mode 100644 index 9dc8b37..0000000 --- a/db/migrate/016_create_categories.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateCategories < ActiveRecord::Migration - def self.up - create_table :categories do |t| - t.column :name, :string - t.column :slug, :string - t.column :path, :text, :default => '' - - t.column :display_color, :integer - - t.column :environment_id, :integer - t.column :parent_id, :integer - t.column :type, :string - end - end - - def self.down - drop_table :categories - end -end diff --git a/db/migrate/017_create_tasks.rb b/db/migrate/017_create_tasks.rb deleted file mode 100644 index 5b3817b..0000000 --- a/db/migrate/017_create_tasks.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateTasks < ActiveRecord::Migration - def self.up - create_table :tasks do |t| - t.column :data, :text - t.column :status, :integer - t.column :end_date, :date - - t.column :requestor_id, :integer - t.column :target_id, :integer - - t.column :code, :string, :limit => 40 - end - end - - def self.down - drop_table :tasks - end -end diff --git a/db/migrate/018_access_control_migration.rb b/db/migrate/018_access_control_migration.rb deleted file mode 100644 index 543fc08..0000000 --- a/db/migrate/018_access_control_migration.rb +++ /dev/null @@ -1,21 +0,0 @@ -class AccessControlMigration < ActiveRecord::Migration - def self.up - create_table :roles do |t| - t.column :name, :string - t.column :permissions, :string - end - - create_table :role_assignments do |t| - t.column :accessor_id, :integer - t.column :accessor_type, :string - t.column :resource_id, :integer - t.column :resource_type, :string - t.column :role_id, :integer - end - end - - def self.down - drop_table :roles - drop_table :role_assignments - end -end diff --git a/db/migrate/019_create_region_validators_table.rb b/db/migrate/019_create_region_validators_table.rb deleted file mode 100644 index 0f718a6..0000000 --- a/db/migrate/019_create_region_validators_table.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateRegionValidatorsTable < ActiveRecord::Migration - def self.up - create_table :region_validators, :id => false do |t| - t.column :region_id, :integer - t.column :organization_id, :integer - end - end - - def self.down - drop_table :region_validators - end -end -- libgit2 0.21.2