separated out ip ban logic from regular bans, users can no longer register if an ip ban is in place

This commit is contained in:
albert
2010-03-18 17:55:57 -04:00
parent dcf8d0df4c
commit e46bfb3d76
12 changed files with 124 additions and 33 deletions

View File

@@ -2,7 +2,6 @@ class CreateBans < ActiveRecord::Migration
def self.up
create_table :bans do |t|
t.column :user_id, :integer
t.column :ip_addr, "inet"
t.column :reason, :text, :null => false
t.column :banner_id, :integer, :null => false
t.column :expires_at, :datetime, :null => false
@@ -10,7 +9,6 @@ class CreateBans < ActiveRecord::Migration
end
add_index :bans, :user_id
add_index :bans, :ip_addr
add_index :bans, :expires_at
end

View File

@@ -0,0 +1,16 @@
class CreateIpBans < ActiveRecord::Migration
def self.up
create_table :ip_bans do |t|
t.column :creator_id, :integer, :null => false
t.column :ip_addr, :inet, :null => false
t.column :reason, :text, :null => false
t.timestamps
end
add_index :ip_bans, :ip_addr, :unique => true
end
def self.down
drop_table :ip_bans
end
end