Advertisement
Doc94

Base de datos - RochGOTH

Nov 18th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 5.40 KB | None | 0 0
  1. /*
  2. TABLA COMUN - USUARIOS Y DATOS
  3. */
  4. CREATE DATABASE `gothmcn_common` /*!40100 DEFAULT CHARACTER SET latin1 */;
  5.  
  6. CREATE TABLE `accounts` (
  7.   `uuid` varchar(40) NOT NULL,
  8.   `name` varchar(16) NOT NULL,
  9.   `rank` int(11) NOT NULL DEFAULT '0',
  10.   `registerDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  11.   `lastconectionDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  12.   `totaltimeconnected` int(11) NOT NULL DEFAULT '0',
  13.   PRIMARY KEY (`uuid`),
  14.   KEY `name` (`name`),
  15.   KEY `rank` (`rank`)
  16. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Registro de cuentas';
  17.  
  18. CREATE TABLE `accountconfig` (
  19.   `uuid` varchar(40) NOT NULL,
  20.   `chatcolor` int(11) DEFAULT '0',
  21.   `invamigos` int(11) DEFAULT '0',
  22.   `msgtoggle` int(11) DEFAULT '0',
  23.   `hide` int(11) DEFAULT '0',
  24.   PRIMARY KEY (`uuid`),
  25.   CONSTRAINT `account_config` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  26. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  27.  
  28. CREATE TABLE `configvars` (
  29.   `varname` varchar(50) NOT NULL,
  30.   `varvalue` text,
  31.   PRIMARY KEY (`varname`)
  32. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  33.  
  34. CREATE TABLE `friends` (
  35.   `uuid` varchar(40) NOT NULL,
  36.   `amigosuuid` text,
  37.   PRIMARY KEY (`uuid`),
  38.   CONSTRAINT `account_friend` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  39. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  40.  
  41. CREATE TABLE `nickeds` (
  42.   `uuid` varchar(40) NOT NULL,
  43.   `nick` varchar(20) NOT NULL DEFAULT 'nul',
  44.   `skin` varchar(20) NOT NULL DEFAULT 'Notch',
  45.   PRIMARY KEY (`uuid`),
  46.   CONSTRAINT `account_nicked` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  47. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  48. CREATE TABLE `userstatus` (
  49.   `uuid` varchar(40) NOT NULL,
  50.   `server_name` varchar(25) NOT NULL,
  51.   `lastupdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  52.   PRIMARY KEY (`uuid`),
  53.   CONSTRAINT `uuid_account` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  54. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  55.  
  56. /*
  57. TABLA SANCIONES - REGISTROS Y SANCIONES
  58. */
  59. CREATE DATABASE `gothmcn_sanctions` /*!40100 DEFAULT CHARACTER SET latin1 */;
  60.  
  61. CREATE TABLE `bans` (
  62.   `id` int(11) NOT NULL,
  63.   `idLog` int(11) NOT NULL,
  64.   `uuid` varchar(40) NOT NULL,
  65.   `staff` varchar(40) NOT NULL,
  66.   `reason` text NOT NULL,
  67.   `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  68.   `expire` timestamp NULL DEFAULT NULL,
  69.   PRIMARY KEY (`id`),
  70.   KEY `bans_idlog_idx` (`idLog`),
  71.   KEY `account_staffban` (`staff`),
  72.   KEY `account_userban` (`uuid`),
  73.   CONSTRAINT `account_staffban` FOREIGN KEY (`staff`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  74.   CONSTRAINT `account_userban` FOREIGN KEY (`uuid`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  75.   CONSTRAINT `bans_idlog` FOREIGN KEY (`idLog`) REFERENCES `logsanctions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  76. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  77.  
  78. CREATE TABLE `ip_ban` (
  79.   `ip` varbinary(16) NOT NULL,
  80.   PRIMARY KEY (`ip`)
  81. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  82.  
  83. CREATE TABLE `logsanctions` (
  84.   `id` int(11) NOT NULL AUTO_INCREMENT,
  85.   `time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  86.   `uuidTo` varchar(40) DEFAULT NULL,
  87.   `uuidFrom` varchar(40) DEFAULT NULL,
  88.   `reason` text,
  89.   `sanction` enum('BAN','UNBAN','TEMPBAN','UNTEMPBAN','KICK','MUTE') DEFAULT NULL,
  90.   PRIMARY KEY (`id`),
  91.   KEY `account_sto` (`uuidTo`),
  92.   KEY `account_sfrom` (`uuidFrom`),
  93.   CONSTRAINT `account_sfrom` FOREIGN KEY (`uuidFrom`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  94.   CONSTRAINT `account_sto` FOREIGN KEY (`uuidTo`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  95. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
  96.  
  97. CREATE TABLE `mutes` (
  98.   `id` int(11) NOT NULL,
  99.   `idLog` int(11) NOT NULL,
  100.   `uuid` varchar(40) NOT NULL,
  101.   `staff` varchar(40) NOT NULL,
  102.   `reason` text NOT NULL,
  103.   `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  104.   `expire` timestamp NULL DEFAULT NULL,
  105.   PRIMARY KEY (`id`),
  106.   KEY `bans_idlog_idx` (`idLog`),
  107.   KEY `account_staffmute` (`staff`),
  108.   KEY `account_usermuted` (`uuid`),
  109.   CONSTRAINT `account_staffmute` FOREIGN KEY (`staff`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  110.   CONSTRAINT `account_usermuted` FOREIGN KEY (`uuid`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  111.   CONSTRAINT `mutes_idlog` FOREIGN KEY (`id`) REFERENCES `logsanctions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  112. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  113.  
  114. CREATE TABLE `reports` (
  115.   `id` int(11) NOT NULL AUTO_INCREMENT,
  116.   `uuidFrom` varchar(40) NOT NULL,
  117.   `uuidTo` varchar(40) NOT NULL,
  118.   `serverFrom` text NOT NULL,
  119.   `serverTo` text NOT NULL,
  120.   `reason` text NOT NULL,
  121.   `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  122.   PRIMARY KEY (`id`),
  123.   KEY `account_reportTo` (`uuidTo`),
  124.   KEY `account_reportFrom` (`uuidFrom`),
  125.   CONSTRAINT `account_reportFrom` FOREIGN KEY (`uuidFrom`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  126.   CONSTRAINT `account_reportTo` FOREIGN KEY (`uuidTo`) REFERENCES `gothmcn_common`.`accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
  127. ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement