added ads

This commit is contained in:
albert
2010-02-15 17:56:51 -05:00
parent 9f353c32f4
commit 09cca6f631
7 changed files with 254 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
class CreateAdvertisements < ActiveRecord::Migration
def self.up
create_table :advertisements do |t|
t.column :referral_url, :text, :null => false
t.column :ad_type, :string, :null => false
t.column :status, :string, :null => false
t.column :hit_count, :integer, :null => false, :default => 0
t.column :width, :integer, :null => false
t.column :height, :integer, :null => false
t.column :file_name, :string, :null => false
t.timestamps
end
add_index :advertisements, :ad_type
end
def self.down
drop_table :advertisements
end
end

View File

@@ -0,0 +1,16 @@
class CreateAdvertisementHits < ActiveRecord::Migration
def self.up
create_table :advertisement_hits do |t|
t.column :advertisement_id, :integer, :null => false
t.column :ip_addr, "inet", :null => false
t.timestamps
end
add_index :advertisement_hits, :advertisement_id
add_index :advertisement_hits, :created_at
end
def self.down
drop_table :advertisement_hits
end
end