Advertisement
Rainulf

Untitled

Mar 4th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.75 KB | None | 0 0
  1. CREATE TABLE unx511.avatars (
  2.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  3.     username VARCHAR(20) NOT NULL,
  4.     password VARCHAR(40) NOT NULL,
  5.     level tinyint UNSIGNED NOT NULL DEFAULT 1,
  6.     lvl_points INT UNSIGNED DEFAULT 0,
  7.     health INT UNSIGNED NOT NULL DEFAULT 100,
  8.     HP INT UNSIGNED NOT NULL DEFAULT 1,
  9.     cash DECIMAL DEFAULT 0,
  10.     banked DOUBLE DEFAULT 0,
  11.     PRIMARY KEY (id)
  12. ) ENGINE = InnoDB;
  13.  
  14.  
  15. CREATE TABLE unx511.avatar_attack (
  16.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  17.     attacker_id INT UNSIGNED NOT NULL,
  18.     victim_id INT UNSIGNED NOT NULL,
  19.     winner INT NOT NULL,
  20.     attack_date datetime NOT NULL,
  21.     PRIMARY KEY (id),
  22.     FOREIGN KEY (attacker_id) REFERENCES avatars (id),
  23.     FOREIGN KEY (victim_id) REFERENCES avatars (id)
  24. )  ENGINE = InnoDB;
  25.  
  26.  
  27. CREATE TABLE unx511.hitlist (
  28.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  29.     placed_hit INT UNSIGNED NOT NULL,
  30.     person_to_beat INT UNSIGNED NOT NULL,
  31.     amount_paid DECIMAL NOT NULL,
  32.     paid_date datetime NOT NULL,
  33.     active ENUM('Y', 'N') NOT NULL,
  34.     beat_by INT UNSIGNED NOT NULL,
  35.     PRIMARY KEY (id),
  36.     FOREIGN KEY (placed_hit) REFERENCES avatars (id),
  37.     FOREIGN KEY (person_to_beat) REFERENCES avatars (id)
  38. )  ENGINE = InnoDB;
  39.  
  40.  
  41. CREATE TABLE unx511.missions (
  42.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  43.     name VARCHAR(256) NOT NULL,
  44.     description VARCHAR(1024),
  45.     pay_amount DECIMAL NOT NULL,
  46.     score_to_beat INT NOT NULL,
  47.     attack_points INT NOT NULL,
  48.     defence_points INT NOT NULL,
  49.     EXP FLOAT NOT NULL,
  50.     loot DECIMAL NOT NULL,
  51.     PRIMARY KEY (id)
  52. ) ENGINE = InnoDB;
  53.  
  54.  
  55. CREATE TABLE unx511.item (
  56.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  57.     name VARCHAR(256) NOT NULL,
  58.     attack_points INT UNSIGNED NULL,
  59.     defence_points INT UNSIGNED NULL,
  60.     cost DECIMAL UNSIGNED NOT NULL,
  61.     PRIMARY KEY (id)
  62. ) ENGINE = InnoDB;
  63.  
  64.  
  65. CREATE TABLE unx511.avatar_item (
  66.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  67.     avatar_id INT UNSIGNED NOT NULL,
  68.     item_id INT UNSIGNED NOT NULL,
  69.     amount INT NOT NULL DEFAULT 0,  # how many OF items exist IN USER inventory
  70.     amount_paid DECIMAL NOT NULL,   # IS this necessary? since each item has a cost associated WITH it
  71.     # DATE    -- if there are multiple items how does date work?
  72.     PRIMARY KEY (id),
  73.     FOREIGN KEY (avatar_id) REFERENCES avatars (id),
  74.     FOREIGN KEY (item_id) REFERENCES item (id)
  75. ) ENGINE = InnoDB;
  76.  
  77.  
  78. CREATE TABLE unx511.avatar_mission (
  79.     id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  80.     avatar_id INT UNSIGNED NOT NULL,
  81.     mission_id INT UNSIGNED NOT NULL,
  82.     mission_date datetime NOT NULL,
  83.     PRIMARY KEY (id),
  84.     FOREIGN KEY (avatar_id) REFERENCES avatars (id),
  85.     FOREIGN KEY (mission_id) REFERENCES missions (id)
  86. ) ENGINE = InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement