daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE DATABASE IF NOT EXISTS `Repository`;
  2. USE `Repository`;
  3.  
  4. /******************** Add Table: Repositories ************************/
  5.  
  6. /* Build Table Structure */
  7. SET character_set_client = utf8;
  8. CREATE TABLE `Repositories`
  9. (
  10.     `Id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  11.     `Name` VARCHAR(255) NOT NULL,
  12.     `InsertBy` VARCHAR(255) NOT NULL,
  13.     `UpdateBy` VARCHAR(255) NOT NULL,
  14.     `InsertTime` DATETIME NOT NULL,
  15.     `UpdateTime` DATETIME NOT NULL,
  16.     `Path` VARCHAR(255) NOT NULL,
  17.     `Url` VARCHAR(255) NOT NULL,
  18.     PRIMARY KEY (`Id`)
  19. ) ENGINE=InnoDB COMMENT "Repositorios de pacotes";
  20.  
  21. /******************** Add Table: Local ************************/
  22.  
  23. /* Build Table Structure */
  24. SET character_set_client = utf8;
  25. CREATE TABLE `Local`
  26. (
  27.     `Id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  28.     `Name` VARCHAR(255) NOT NULL,
  29.     `InsertBy` VARCHAR(255) NOT NULL,
  30.     `UpdateBy` VARCHAR(255) NOT NULL,
  31.     `InsertTime` DATETIME NOT NULL,
  32.     `UpdateTime` DATETIME NOT NULL,
  33.     PRIMARY KEY (`Id`)
  34. ) ENGINE=InnoDB COMMENT "Producao ou Homologacao";
  35.  
  36. /******************** Add Table: Media ************************/
  37.  
  38. /* Build Table Structure */
  39. SET character_set_client = utf8;
  40. CREATE TABLE `Media`
  41. (
  42.     `Id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  43.     `Name` VARCHAR(255) NOT NULL,
  44.     `InsertBy` VARCHAR(255) NOT NULL,
  45.     `UpdateBy` VARCHAR(255) NOT NULL,
  46.     `InsertTime` DATETIME NOT NULL,
  47.     `UpdateTime` DATETIME NOT NULL,
  48.     PRIMARY KEY (`Id`)
  49. ) ENGINE=InnoDB COMMENT "Midia dos sistemas, 1) Servidor, 2) Cliente, 3) Desktop";
  50.  
  51. /******************** Add Table: Package ************************/
  52.  
  53. /* Build Table Structure */
  54. SET character_set_client = utf8;
  55. CREATE TABLE Package
  56. (
  57.     `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  58.     `FileName` VARCHAR(255) NOT NULL,
  59.     `InsertBy` VARCHAR(255) NOT NULL,
  60.     `UpdateBy` VARCHAR(255) NOT NULL,
  61.     `InsertTime` DATETIME NOT NULL,
  62.     `UpdateTime` DATETIME NOT NULL,
  63.     `Name` VARCHAR(255) NOT NULL,
  64.     `Version` VARCHAR(255) NOT NULL,
  65.     `Release` VARCHAR(255) NOT NULL,
  66.     `Arch` VARCHAR(255) NOT NULL,
  67.     `Hash` VARCHAR(255) NOT NULL,
  68.     `RepositoriesId` INT(11) UNSIGNED NOT NULL,
  69.     PRIMARY KEY (`Id`),
  70.     INDEX (`Hash`, `RepositoriesId`),
  71.     FOREIGN KEY (`RepositoriesId`) REFERENCES Repositories (`Id`) ON UPDATE CASCADE
  72. ) ENGINE=InnoDB Comment "Pacotes dos produtos";
  73.  
  74. ALTER TABLE `Package` ADD UNIQUE `Name` (`Name`, `Version`, `Release`, `Arch`, `RepositoriesId`);
  75. ALTER TABLE `Package` ADD UNIQUE `Hash` (`Hash`, `RepositoriesId`);
  76. ALTER TABLE `Package` ADD INDEX `HashIndex` (`Hash`);
  77. /******************** Add Table: Product ************************/
  78.  
  79. /* Build Table Structure */
  80. SET character_set_client = utf8;
  81. CREATE TABLE `Product`
  82. (
  83.     `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  84.     `ProductCode` TEXT(50) NOT NULL,
  85.     `InsertBy` TEXT(50) NOT NULL,
  86.     `UpdateBy` TEXT(50) NOT NULL,
  87.     `InsertTime` DATETIME NOT NULL,
  88.     `UpdateTime` DATETIME NOT NULL,
  89.     `Major` INTEGER NOT NULL,
  90.     `Minor` INTEGER NOT NULL,
  91.     `SubVersion` INTEGER NOT NULL,
  92.     `Build` INTEGER NOT NULL,
  93.     `LocalId` INT(11) UNSIGNED NOT NULL,
  94.     PRIMARY KEY (`Id`),
  95.     FOREIGN KEY (`LocalId`) REFERENCES Local (`Id`) ON UPDATE CASCADE
  96. ) ENGINE=InnoDB COMMENT "Versoes dos produtos";
  97.  
  98. /******************** Add Table: PackageProduct ************************/
  99.  
  100. /* Build Table Structure */
  101. SET character_set_client = utf8;
  102. CREATE TABLE `PackageProduct`
  103. (
  104.     `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  105.     `InsertBy` VARCHAR(50) NOT NULL,
  106.     `UpdateBy` VARCHAR(50) NOT NULL,
  107.     `InsertTime` DATETIME NOT NULL,
  108.     `UpdateTime` DATETIME NOT NULL,
  109.     `PackageId` BIGINT UNSIGNED NOT NULL,
  110.     `ProductId` BIGINT UNSIGNED NOT NULL,
  111.     `MediaId` INT(11) UNSIGNED NOT NULL,
  112.     PRIMARY KEY (`Id`),
  113.     FOREIGN KEY (`PackageId`) REFERENCES Package (`Id`) ON UPDATE CASCADE,
  114.     FOREIGN KEY (`ProductId`) REFERENCES Product (`Id`) ON UPDATE CASCADE
  115. ) ENGINE=InnoDB Comment "Relacionamento de pacotes com produtos";
  116.  
  117.  
  118. /******************** Add Table: ProductMedia ************************/
  119.  
  120. /* Build Table Structure */
  121. SET character_set_client = utf8;
  122. CREATE TABLE `ProductMedia`
  123. (
  124.     `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  125.     `InsertBy` VARCHAR(255) NOT NULL,
  126.     `UpdateBy` VARCHAR(255) NOT NULL,
  127.     `InsertTime` DATETIME NOT NULL,
  128.     `UpdateTime` DATETIME NOT NULL,
  129.     `ProductId` BIGINT UNSIGNED NOT NULL,
  130.     `MediaId` INT(11) UNSIGNED NOT NULL,
  131.     PRIMARY KEY (`Id`),
  132.     FOREIGN KEY (`ProductId`) REFERENCES Product (`Id`) ON UPDATE CASCADE,
  133.     FOREIGN KEY (`MediaId`) REFERENCES Media (`Id`) ON UPDATE CASCADE
  134. ) ENGINE=InnoDB COMMENT "Relacionamento de produto com midia";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top