aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorJames Thompson <james.b.thompson@gmail.com>2012-03-14 11:40:16 +0200
committerJames Thompson <james.b.thompson@gmail.com>2012-03-14 11:40:16 +0200
commit56d7747f54e86993415b76c92e101608e5ea44e2 (patch)
tree025b7b37f50c4c291e7e676286e7767c40adb1f9 /db/migrate
downloadrefinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.tar.gz
refinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.tar.bz2
refinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.zip
initial commit
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/1_create_banners_banners.rb34
-rw-r--r--db/migrate/2_create_banners_banners_pages.rb15
2 files changed, 49 insertions, 0 deletions
diff --git a/db/migrate/1_create_banners_banners.rb b/db/migrate/1_create_banners_banners.rb
new file mode 100644
index 0000000..680fd7b
--- /dev/null
+++ b/db/migrate/1_create_banners_banners.rb
@@ -0,0 +1,34 @@
+class CreateBannersBanners < ActiveRecord::Migration
+
+ def up
+ create_table :refinery_banners do |t|
+ t.string :name
+ t.string :title
+ t.string :description
+ t.integer :image_id
+ t.string :url
+ t.boolean :is_active
+ t.date :start_date
+ t.date :expiry_date
+ t.integer :position
+ t.integer :position
+
+ t.timestamps
+ end
+
+ end
+
+ def down
+ if defined?(::Refinery::UserPlugin)
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-banners"})
+ end
+
+ if defined?(::Refinery::Page)
+ ::Refinery::Page.delete_all({:link_url => "/banners/banners"})
+ end
+
+ drop_table :refinery_banners
+
+ end
+
+end
diff --git a/db/migrate/2_create_banners_banners_pages.rb b/db/migrate/2_create_banners_banners_pages.rb
new file mode 100644
index 0000000..89af8e9
--- /dev/null
+++ b/db/migrate/2_create_banners_banners_pages.rb
@@ -0,0 +1,15 @@
+class CreateBannersBannersPages < ActiveRecord::Migration
+ def self.up
+ create_table :refinery_banners_pages, :id => false do |t|
+ t.integer :page_id
+ t.integer :banner_id
+ end
+
+ add_index :refinery_banners_pages, :page_id
+ add_index :refinery_banners_pages, :banner_id
+ end
+
+ def self.down
+ drop_table :refinery_banners_pages
+ end
+end