Guest User

Untitled

a guest
Jan 15th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                                                      
  2.                                                                      
  3.                                                                      
  4.                                              
  5. class CreateUsers < ActiveRecord::Migration
  6.   def self.up
  7.     create_table :users, :options => "AUTO_INCREMENT = 40000" do |t|
  8.       t.string :usid, :limit => 15, :null => false
  9.       t.string :password, :limit => 30, :null => false
  10.       t.string :salt, :limit => 40
  11.       t.string :name, :limit => 50, :null => false
  12.       t.string :email, :limit => 30, :null => false
  13.       t.string :room, :limit => 6, :null => false
  14.       t.string :school, :limit => 5, :null => false
  15.       t.integer :firewall, :null => false
  16.       t.integer :order, :null => false
  17.       t.timestamps
  18.     end
  19.   end
  20.  
  21.   def self.down
  22.     drop_table :users
  23.   end
  24. end
  25.  
  26. class CreateGroups < ActiveRecord::Migration
  27.   def self.up
  28.     create_table :groups do |t|
  29.       t.string :name
  30.       t.timestamps
  31.     end
  32.   end
  33.  
  34.   def self.down
  35.     drop_table :groups
  36.   end
  37. end
  38.  
  39. class CreateComputers < ActiveRecord::Migration
  40.   def self.up
  41.     create_table :computers do |t|
  42.       t.integer :user_id
  43.       t.string :mac, :limit => 18
  44.       t.string :wmac, :limit => 18
  45.       t.string :host, :limit => 20, :null => false
  46.       t.string :password, :limit => 30, :null => false
  47.       t.string :salt :limit => 30
  48.       t.datetime :expire
  49.       t.timestamps
  50.     end
  51.   end
  52.  
  53.   def self.down
  54.     drop_table :computers
  55.   end
  56. end
  57.  
  58. class CreatePacis < ActiveRecord::Migration
  59.   def self.up
  60.     create_table :pacis do |t|
  61.       t.integer :computer_id
  62.       t.string :ip, :limit => 16, :null => false
  63.       t.timestamps
  64.     end
  65.   end
  66.  
  67.   def self.down
  68.     drop_table :pacis
  69.   end
  70. end
  71.  
  72. class CreateBans < ActiveRecord::Migration
  73.   def self.up
  74.     create_table :bans do |t|
  75.       t.integer :computer_id
  76.       t.string :reason, :limit => 100, :null => false
  77.       t.datetime :starttime, :null => false
  78.       t.datetime :endtime, :null => false
  79.     end
  80.   end
  81.  
  82.   def self.down
  83.     drop_table :bans
  84.   end
  85. end
  86.  
  87. class CreateEbans < ActiveRecord::Migration
  88.   def self.up
  89.     create_table :ebans do |t|
  90.       t.integer :paci_id
  91.       t.string :reason, :limit => 100, :null => false
  92.       t.datetime :starttime, :null => false
  93.       t.datetime :endtime, :null => false
  94.     end
  95.   end
  96.  
  97.   def self.down
  98.     drop_table :ebans
  99.   end
  100. end
  101.  
  102. class CreateTraffics < ActiveRecord::Migration
  103.   def self.up
  104.     create_table :traffics do |t|
  105.       t.integer :computer_id
  106.       t.string :ip, :limit => 16, :null => false
  107.       t.datetime :time, :null => false
  108.       t.integer :in_up, :null => false
  109.       t.integer :in_down, :null => false
  110.       t.integer :out_up, :null => false
  111.       t.integer :out_down, :null => false
  112.       t.integer :xdrop_up, :null => false
  113.       t.integer :xdrop_down, :null => false
  114.     end
  115.   end
  116.  
  117.   def self.down
  118.     drop_table :traffics
  119.   end
  120. end
  121.  
  122. class CreateMembers < ActiveRecord::Migration
  123.   def self.up
  124.     create_table :members do |t|
  125.       t.integer :user_id
  126.       t.integer :group_id
  127.     end
  128.   end
  129.  
  130.   def self.down
  131.     drop_table :members
  132.   end
  133. end
Add Comment
Please, Sign In to add comment