aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dummy/db
diff options
context:
space:
mode:
Diffstat (limited to 'spec/dummy/db')
-rw-r--r--spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb23
-rw-r--r--spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb13
-rw-r--r--spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb24
-rw-r--r--spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb9
-rw-r--r--spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb48
-rw-r--r--spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb11
-rw-r--r--spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb31
-rw-r--r--spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb5
-rw-r--r--spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb13
-rw-r--r--spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb23
-rw-r--r--spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb56
-rw-r--r--spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb38
-rw-r--r--spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb11
-rw-r--r--spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb26
-rw-r--r--spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb13
-rw-r--r--spec/dummy/db/migrate/20110802081571_create_seo_meta.rb86
-rw-r--r--spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb11
-rw-r--r--spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb21
-rw-r--r--spec/dummy/db/schema.rb239
-rw-r--r--spec/dummy/db/seeds.rb5
-rw-r--r--spec/dummy/db/seeds/pages.rb63
21 files changed, 769 insertions, 0 deletions
diff --git a/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb
new file mode 100644
index 0000000..3199a9c
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb
@@ -0,0 +1,23 @@
+class CreateRefinerycmsCoreSchema < ActiveRecord::Migration
+ def self.up
+ create_table ::Slug.table_name, :force => true do |t|
+ t.string "name"
+ t.integer "sluggable_id"
+ t.integer "sequence", :default => 1, :null => false
+ t.string "sluggable_type", :limit => 40
+ t.string "scope", :limit => 40
+ t.datetime "created_at"
+ end
+
+ add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true
+ add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id"
+ end
+
+ def self.down
+ [::Slug].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb
new file mode 100644
index 0000000..0795cad
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb
@@ -0,0 +1,13 @@
+class AddLocaleToSlugs < ActiveRecord::Migration
+ def self.up
+ add_column ::Slug.table_name, :locale, :string
+
+ add_index ::Slug.table_name, :locale
+ end
+
+ def self.down
+ remove_column ::Slug.table_name, :locale
+
+ remove_index ::Slug.table_name, :locale
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb
new file mode 100644
index 0000000..b60cf82
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb
@@ -0,0 +1,24 @@
+class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration
+ def self.up
+ create_table ::Refinery::Setting.table_name, :force => true do |t|
+ t.string "name"
+ t.text "value"
+ t.boolean "destroyable", :default => true
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "scoping"
+ t.boolean "restricted", :default => false
+ t.string "callback_proc_as_string"
+ end
+
+ add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name"
+ end
+
+ def self.down
+ [::Refinery::Setting].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb
new file mode 100644
index 0000000..2fdf6d8
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb
@@ -0,0 +1,9 @@
+class AddValueTypeToRefinerySettings < ActiveRecord::Migration
+ def self.up
+ add_column ::Refinery::Setting.table_name, :form_value_type, :string
+ end
+
+ def self.down
+ remove_column ::Refinery::Setting.table_name, :form_value_type
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb
new file mode 100644
index 0000000..f9b6c2e
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb
@@ -0,0 +1,48 @@
+class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration
+ def self.up
+ # Postgres apparently requires the roles_users table to exist before creating the roles table.
+ create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t|
+ t.integer "user_id"
+ t.integer "role_id"
+ end unless ::Refinery::RolesUsers.table_exists?
+
+ create_table ::Refinery::Role.table_name, :force => true do |t|
+ t.string "title"
+ end unless ::Refinery::Role.table_exists?
+
+ unless ::Refinery::UserPlugin.table_exists?
+ create_table ::Refinery::UserPlugin.table_name, :force => true do |t|
+ t.integer "user_id"
+ t.string "name"
+ t.integer "position"
+ end
+
+ add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title"
+ add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true
+
+ end
+
+ unless ::Refinery::User.table_exists?
+ create_table ::Refinery::User.table_name, :force => true do |t|
+ t.string "login", :null => false
+ t.string "email", :null => false
+ t.string "crypted_password", :null => false
+ t.string "password_salt", :null => false
+ t.string "persistence_token"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "perishable_token"
+ end
+
+ add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id"
+ end
+ end
+
+ def self.down
+ [::User].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name if model.table_exists? if model.table_exists?
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb
new file mode 100644
index 0000000..e72d81f
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb
@@ -0,0 +1,11 @@
+class AddMissingIndexesToRolesUsers < ActiveRecord::Migration
+ def self.up
+ add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id]
+ add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id]
+ end
+
+ def self.down
+ remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id]
+ remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id]
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb
new file mode 100644
index 0000000..8beef83
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb
@@ -0,0 +1,31 @@
+class ChangeToDeviseUsersTable < ActiveRecord::Migration
+ def self.up
+ add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime
+ add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime
+ add_column ::Refinery::User.table_name, :current_sign_in_ip, :string
+ add_column ::Refinery::User.table_name, :last_sign_in_ip, :string
+ add_column ::Refinery::User.table_name, :sign_in_count, :integer
+ add_column ::Refinery::User.table_name, :remember_token, :string
+ add_column ::Refinery::User.table_name, :reset_password_token, :string
+
+ rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password
+ rename_column ::Refinery::User.table_name, :login, :username
+
+ ::Refinery::User.reset_column_information
+ end
+
+ def self.down
+ remove_column ::Refinery::User.table_name, :current_sign_in_at
+ remove_column ::Refinery::User.table_name, :last_sign_in_at
+ remove_column ::Refinery::User.table_name, :current_sign_in_ip
+ remove_column ::Refinery::User.table_name, :last_sign_in_ip
+ remove_column ::Refinery::User.table_name, :sign_in_count
+ remove_column ::Refinery::User.table_name, :remember_token
+ remove_column ::Refinery::User.table_name, :reset_password_token
+
+ rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password
+ rename_column ::Refinery::User.table_name, :username, :login
+
+ ::Refinery::User.reset_column_information
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb
new file mode 100644
index 0000000..524b36f
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb
@@ -0,0 +1,5 @@
+class AddRememberCreatedAtToUsers < ActiveRecord::Migration
+ def change
+ add_column ::Refinery::User.table_name, :remember_created_at, :datetime
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb
new file mode 100644
index 0000000..afcbfd7
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb
@@ -0,0 +1,13 @@
+class RemovePasswordSaltFromUsers < ActiveRecord::Migration
+ def self.up
+ remove_column ::Refinery::User.table_name, :password_salt
+ # Make the current password invalid :(
+ ::Refinery::User.all.each do |u|
+ u.update_attribute(:encrypted_password, u.encrypted_password[29..-1])
+ end
+ end
+
+ def self.down
+ add_column ::Refinery::User.table_name, :password_salt, :string
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb
new file mode 100644
index 0000000..6c4e079
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb
@@ -0,0 +1,23 @@
+class CreateRefinerycmsImagesSchema < ActiveRecord::Migration
+ def self.up
+ create_table ::Refinery::Image.table_name, :force => true do |t|
+ t.string "image_mime_type"
+ t.string "image_name"
+ t.integer "image_size"
+ t.integer "image_width"
+ t.integer "image_height"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "image_uid"
+ t.string "image_ext"
+ end unless ::Refinery::Image.table_exists?
+ end
+
+ def self.down
+ [::Image].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name if model.table_exists?
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb
new file mode 100644
index 0000000..4458726
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb
@@ -0,0 +1,56 @@
+class CreateRefinerycmsPagesSchema < ActiveRecord::Migration
+ def self.up
+ unless ::Refinery::PagePart.table_exists?
+ create_table ::Refinery::PagePart.table_name, :force => true do |t|
+ t.integer "refinery_page_id"
+ t.string "title"
+ t.text "body"
+ t.integer "position"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id"
+ add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id"
+ end
+
+ unless ::Refinery::Page.table_exists?
+ create_table ::Refinery::Page.table_name, :force => true do |t|
+ t.string "title"
+ t.integer "parent_id"
+ t.integer "position"
+ t.string "path"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "meta_keywords"
+ t.text "meta_description"
+ t.boolean "show_in_menu", :default => true
+ t.string "link_url"
+ t.string "menu_match"
+ t.boolean "deletable", :default => true
+ t.string "custom_title"
+ t.string "custom_title_type", :default => "none"
+ t.boolean "draft", :default => false
+ t.string "browser_title"
+ t.boolean "skip_to_first_child", :default => false
+ t.integer "lft"
+ t.integer "rgt"
+ t.integer "depth"
+ end
+
+ add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth"
+ add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id"
+ add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft"
+ add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id"
+ add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt"
+ end
+ end
+
+ def self.down
+ [::Page, ::Refinery::PagePart].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name if model.table_exists?
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb b/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb
new file mode 100644
index 0000000..bdb0a43
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb
@@ -0,0 +1,38 @@
+class TranslatePagePlugin < ActiveRecord::Migration
+ def self.up
+ say_with_time("Creating ::Refinery::PagePart translation table") do
+ ::Refinery::PagePart.create_translation_table!({
+ :body => :text
+ }, {
+ :migrate_data => true
+ })
+ end
+
+ say_with_time("Creating ::Refinery::Page translation table") do
+ ::Refinery::Page.create_translation_table!({
+ :title => :string,
+ :meta_keywords => :string,
+ :meta_description => :text,
+ :browser_title => :string
+ }, {
+ :migrate_data => true
+ })
+ end
+
+ puts "seeds pages"
+ if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file?
+ load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any?
+ end
+
+ say_with_time("Updating slugs") do
+ ::Slug.update_all(:locale => I18n.locale)
+ end
+ end
+
+ def self.down
+ say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do
+ ::Refinery::Page.drop_translation_table! :migrate_data => true
+ ::Refinery::PagePart.drop_translation_table! :migrate_data => true
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb
new file mode 100644
index 0000000..d265838
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb
@@ -0,0 +1,11 @@
+class RemoveCachedSlugFromPages < ActiveRecord::Migration
+ def self.up
+ if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug')
+ remove_column ::Refinery::Page.table_name, :cached_slug
+ end
+ end
+
+ def self.down
+ # Don't add this column back, it breaks stuff.
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb
new file mode 100644
index 0000000..ab21e11
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb
@@ -0,0 +1,26 @@
+class TranslateCustomTitleOnPages < ActiveRecord::Migration
+ def self.up
+ unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title)
+ add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string
+
+ # Re-save custom_title
+ ::Refinery::Page.all.each do |page|
+ page.update_attribute(:custom_title, page.untranslated_attributes['custom_title'])
+ end
+
+ end
+ end
+
+ def self.down
+ # Re-save custom_title
+ ::Refinery::Page.all.each do |page|
+ ::Refinery::Page.update_all({
+ :custom_title => page.attributes['custom_title']
+ }, {
+ :id => page.id.to_s
+ }) unless page.attributes['custom_title'].nil?
+ end
+
+ remove_column ::Refinery::Page.translation_class.table_name, :custom_title
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb
new file mode 100644
index 0000000..9dc30b2
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb
@@ -0,0 +1,13 @@
+class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration
+ def self.up
+ ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name|
+ remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name)
+ end
+ end
+
+ def self.down
+ ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name|
+ add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type
+ end
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb b/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb
new file mode 100644
index 0000000..abc2178
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb
@@ -0,0 +1,86 @@
+class CreateSeoMeta < ActiveRecord::Migration
+
+ def self.up
+ create_table :seo_meta do |t|
+ t.integer :seo_meta_id
+ t.string :seo_meta_type
+
+ t.string :browser_title
+ t.string :meta_keywords
+ t.text :meta_description
+
+ t.timestamps
+ end
+
+ add_index :seo_meta, :id
+ add_index :seo_meta, [:seo_meta_id, :seo_meta_type]
+
+ # Grab the attributes of the records that currently exist
+ existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes)
+
+ # Remove columns
+ ::SeoMeta.attributes.keys.each do |field|
+ if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field)
+ remove_column ::Refinery::Page.translation_class.table_name, field
+ end
+ end
+
+ # Reset column information because otherwise the old columns will still exist.
+ ::Refinery::Page.translation_class.reset_column_information
+
+ # Re-attach seo_meta
+ ::Refinery::Page.translation_class.send :is_seo_meta
+
+ # Migrate data
+ existing_translations.each do |translation|
+ ::Refinery::Page.translation_class.find(translation['id']).update_attributes(
+ ::SeoMeta.attributes.keys.inject({}) {|attributes, name|
+ attributes.merge(name => translation[name.to_s])
+ }
+ )
+ end
+
+ # Reset column information again because otherwise the old columns will still exist.
+ ::Refinery::Page.reset_column_information
+ end
+
+ def self.down
+ # Grab the attributes of the records that currently exist
+ existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes)
+
+ # Add columns back to your model
+ ::SeoMeta.attributes.each do |field, field_type|
+ unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field)
+ add_column ::Refinery::Page.translation_class.table_name, field, field_type
+ end
+ end
+
+ # Reset column information because otherwise the new columns won't exist yet.
+ ::Refinery::Page.translation_class.reset_column_information
+
+ # Migrate data
+ existing_translations.each do |translation|
+ ::Refinery::Page.translation_class.update_all(
+ ::SeoMeta.attributes.keys.inject({}) {|attributes, name|
+ attributes.merge(name => translation[name.to_s])
+ }, :id => translation['id']
+ )
+ end
+
+ ::SeoMeta.attributes.keys.each do |k|
+ ::Refinery::Page.translation_class.module_eval %{
+ def #{k}
+ end
+
+ def #{k}=(*args)
+ end
+ }
+ end
+
+ # Reset column information again because otherwise the old columns will still exist.
+ ::Refinery::Page.reset_column_information
+
+ drop_table :seo_meta
+ end
+
+end
diff --git a/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb b/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb
new file mode 100644
index 0000000..eb98ed1
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb
@@ -0,0 +1,11 @@
+class CreateAddTemplateColumns < ActiveRecord::Migration
+ def self.up
+ add_column ::Refinery::Page.table_name, :view_template, :string
+ add_column ::Refinery::Page.table_name, :layout_template, :string
+ end
+
+ def self.down
+ remove_column ::Refinery::Page.table_name, :layout_template
+ remove_column ::Refinery::Page.table_name, :view_template
+ end
+end
diff --git a/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb
new file mode 100644
index 0000000..360f469
--- /dev/null
+++ b/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb
@@ -0,0 +1,21 @@
+class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration
+ def self.up
+ create_table ::Refinery::Resource.table_name, :force => true do |t|
+ t.string "file_mime_type"
+ t.string "file_name"
+ t.integer "file_size"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "file_uid"
+ t.string "file_ext"
+ end unless ::Refinery::Resource.table_exists?
+ end
+
+ def self.down
+ [::Resource].reject{|m|
+ !(defined?(m) and m.respond_to?(:table_name))
+ }.each do |model|
+ drop_table model.table_name if model.table_exists?
+ end
+ end
+end
diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb
new file mode 100644
index 0000000..3068a6b
--- /dev/null
+++ b/spec/dummy/db/schema.rb
@@ -0,0 +1,239 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110803223529) do
+
+ create_table "refinery_blog_categories", :force => true do |t|
+ t.string "title"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "cached_slug"
+ end
+
+ add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id"
+
+ create_table "refinery_blog_categories_blog_posts", :force => true do |t|
+ t.integer "blog_category_id"
+ t.integer "blog_post_id"
+ end
+
+ add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp"
+
+ create_table "refinery_blog_comments", :force => true do |t|
+ t.integer "blog_post_id"
+ t.boolean "spam"
+ t.string "name"
+ t.string "email"
+ t.text "body"
+ t.string "state"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id"
+
+ create_table "refinery_blog_posts", :force => true do |t|
+ t.string "title"
+ t.text "body"
+ t.boolean "draft"
+ t.datetime "published_at"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "user_id"
+ t.string "cached_slug"
+ t.string "custom_url"
+ t.text "custom_teaser"
+ end
+
+ add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id"
+
+ create_table "refinery_images", :force => true do |t|
+ t.string "image_mime_type"
+ t.string "image_name"
+ t.integer "image_size"
+ t.integer "image_width"
+ t.integer "image_height"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "image_uid"
+ t.string "image_ext"
+ end
+
+ create_table "refinery_page_part_translations", :force => true do |t|
+ t.integer "refinery_page_part_id"
+ t.string "locale"
+ t.text "body"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef"
+
+ create_table "refinery_page_parts", :force => true do |t|
+ t.integer "refinery_page_id"
+ t.string "title"
+ t.text "body"
+ t.integer "position"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id"
+ add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id"
+
+ create_table "refinery_page_translations", :force => true do |t|
+ t.integer "refinery_page_id"
+ t.string "locale"
+ t.string "title"
+ t.string "custom_title"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902"
+
+ create_table "refinery_pages", :force => true do |t|
+ t.integer "parent_id"
+ t.integer "position"
+ t.string "path"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "show_in_menu", :default => true
+ t.string "link_url"
+ t.string "menu_match"
+ t.boolean "deletable", :default => true
+ t.string "custom_title_type", :default => "none"
+ t.boolean "draft", :default => false
+ t.boolean "skip_to_first_child", :default => false
+ t.integer "lft"
+ t.integer "rgt"
+ t.integer "depth"
+ t.string "view_template"
+ t.string "layout_template"
+ end
+
+ add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth"
+ add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id"
+ add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft"
+ add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id"
+ add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt"
+
+ create_table "refinery_resources", :force => true do |t|
+ t.string "file_mime_type"
+ t.string "file_name"
+ t.integer "file_size"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "file_uid"
+ t.string "file_ext"
+ end
+
+ create_table "refinery_roles", :force => true do |t|
+ t.string "title"
+ end
+
+ create_table "refinery_roles_users", :id => false, :force => true do |t|
+ t.integer "user_id"
+ t.integer "role_id"
+ end
+
+ add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id"
+ add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id"
+
+ create_table "refinery_settings", :force => true do |t|
+ t.string "name"
+ t.text "value"
+ t.boolean "destroyable", :default => true
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "scoping"
+ t.boolean "restricted", :default => false
+ t.string "callback_proc_as_string"
+ t.string "form_value_type"
+ end
+
+ add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name"
+
+ create_table "refinery_user_plugins", :force => true do |t|
+ t.integer "user_id"
+ t.string "name"
+ t.integer "position"
+ end
+
+ add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title"
+ add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true
+
+ create_table "refinery_users", :force => true do |t|
+ t.string "username", :null => false
+ t.string "email", :null => false
+ t.string "encrypted_password", :null => false
+ t.string "persistence_token"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "perishable_token"
+ t.datetime "current_sign_in_at"
+ t.datetime "last_sign_in_at"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.integer "sign_in_count"
+ t.string "remember_token"
+ t.string "reset_password_token"
+ t.datetime "remember_created_at"
+ end
+
+ add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id"
+
+ create_table "seo_meta", :force => true do |t|
+ t.integer "seo_meta_id"
+ t.string "seo_meta_type"
+ t.string "browser_title"
+ t.string "meta_keywords"
+ t.text "meta_description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id"
+ add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type"
+
+ create_table "slugs", :force => true do |t|
+ t.string "name"
+ t.integer "sluggable_id"
+ t.integer "sequence", :default => 1, :null => false
+ t.string "sluggable_type", :limit => 40
+ t.string "scope", :limit => 40
+ t.datetime "created_at"
+ t.string "locale"
+ end
+
+ add_index "slugs", ["locale"], :name => "index_slugs_on_locale"
+ add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true
+ add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id"
+
+ create_table "taggings", :force => true do |t|
+ t.integer "tag_id"
+ t.integer "taggable_id"
+ t.string "taggable_type"
+ t.integer "tagger_id"
+ t.string "tagger_type"
+ t.string "context"
+ t.datetime "created_at"
+ end
+
+ add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
+
+ create_table "tags", :force => true do |t|
+ t.string "name"
+ end
+
+end
diff --git a/spec/dummy/db/seeds.rb b/spec/dummy/db/seeds.rb
new file mode 100644
index 0000000..a158e52
--- /dev/null
+++ b/spec/dummy/db/seeds.rb
@@ -0,0 +1,5 @@
+# Refinery seeds
+Dir[Rails.root.join('db', 'seeds', '*.rb').to_s].each do |file|
+ puts "Loading db/seeds/#{file.split(File::SEPARATOR).last}"
+ load(file)
+end
diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb
new file mode 100644
index 0000000..668687f
--- /dev/null
+++ b/spec/dummy/db/seeds/pages.rb
@@ -0,0 +1,63 @@
+module Refinery
+ ::Refinery::Page.reset_column_information
+
+ # Check whether all columns are applied yet by seo_meta.
+ unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k|
+ ::Refinery::Page.translation_class.instance_methods.include?(k)
+ }
+ # Make pages model seo_meta because not all columns are accessible.
+ ::Refinery::Page.translation_class.send :is_seo_meta
+ end
+
+ page_position = -1
+
+ unless ::Refinery::Page.where(:menu_match => "^/$").any?
+ home_page = ::Refinery::Page.create!({:title => "Home",
+ :deletable => false,
+ :link_url => "/",
+ :menu_match => "^/$",
+ :position => (page_position += 1)})
+ home_page.parts.create({
+ :title => "Body",
+ :body => "<p>Welcome to our site. This is just a place holder page while we gather our content.</p>",
+ :position => 0
+ })
+ home_page.parts.create({
+ :title => "Side Body",
+ :body => "<p>This is another block of content over here.</p>",
+ :position => 1
+ })
+
+ home_page_position = -1
+ page_not_found_page = home_page.children.create(:title => "Page not found",
+ :menu_match => "^/404$",
+ :show_in_menu => false,
+ :deletable => false,
+ :position => (home_page_position += 1))
+ page_not_found_page.parts.create({
+ :title => "Body",
+ :body => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>",
+ :position => 0
+ })
+ else
+ page_position += 1
+ end
+
+ unless ::Refinery::Page.by_title("About").any?
+ about_us_page = ::Refinery::Page.create(:title => "About",
+ :deletable => true,
+ :position => (page_position += 1))
+ about_us_page.parts.create({
+ :title => "Body",
+ :body => "<p>This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.</p>",
+ :position => 0
+ })
+ about_us_page.parts.create({
+ :title => "Side Body",
+ :body => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.</p>",
+ :position => 1
+ })
+ else
+ page_position += 1
+ end
+end