Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. USE dev;
  2. CREATE TABLE `portal_events` (
  3. `Id` char(36) NOT NULL,
  4. `Title` longtext NULL,
  5. `Text` longtext NULL,
  6. `Poster` longtext NULL,
  7. `Place` longtext NULL,
  8. `Date` datetime(6) NOT NULL,
  9. CONSTRAINT `PK_portal_events` PRIMARY KEY (`Id`)
  10. );
  11.  
  12. CREATE TABLE `portal_news` (
  13. `Id` char(36) NOT NULL,
  14. `Title` longtext NULL,
  15. `Text` longtext NULL,
  16. `Published` datetime(6) NOT NULL,
  17. CONSTRAINT `PK_portal_news` PRIMARY KEY (`Id`)
  18. );
  19.  
  20. CREATE TABLE `portal_offices` (
  21. `Id` char(36) NOT NULL,
  22. `Name` longtext NULL,
  23. `Photo` longtext NULL,
  24. `IpRange` longtext NULL,
  25. `Address` longtext NULL,
  26. CONSTRAINT `PK_portal_offices` PRIMARY KEY (`Id`)
  27. );
  28.  
  29. CREATE TABLE `portal_tags` (
  30. `Id` char(36) NOT NULL,
  31. `Name` longtext NULL,
  32. CONSTRAINT `PK_portal_tags` PRIMARY KEY (`Id`)
  33. );
  34.  
  35. CREATE TABLE `portal_topic` (
  36. `Id` char(36) NOT NULL,
  37. `Name` longtext NULL,
  38. `Icon` longtext NULL,
  39. `EventEntityId` char(36) NULL,
  40. `NewsEntityId` char(36) NULL,
  41. CONSTRAINT `PK_portal_topic` PRIMARY KEY (`Id`),
  42. CONSTRAINT `FK_portal_topic_portal_events_EventEntityId` FOREIGN KEY (`EventEntityId`) REFERENCES `portal_events` (`Id`) ON DELETE CASCADE,
  43. CONSTRAINT `FK_portal_topic_portal_news_NewsEntityId` FOREIGN KEY (`NewsEntityId`) REFERENCES `portal_news` (`Id`) ON DELETE CASCADE
  44. );
  45.  
  46. CREATE TABLE `portal_eventoffice` (
  47. `EventId` char(36) NOT NULL,
  48. `OfficeId` char(36) NOT NULL,
  49. CONSTRAINT `PK_portal_eventoffice` PRIMARY KEY (`EventId`, `OfficeId`),
  50. CONSTRAINT `FK_portal_eventoffice_portal_events_EventId` FOREIGN KEY (`EventId`) REFERENCES `portal_events` (`Id`) ON DELETE CASCADE,
  51. CONSTRAINT `FK_portal_eventoffice_portal_offices_OfficeId` FOREIGN KEY (`OfficeId`) REFERENCES `portal_offices` (`Id`) ON DELETE CASCADE
  52. );
  53.  
  54. CREATE TABLE `portal_hr` (
  55. `Id` char(36) NOT NULL,
  56. `Name` longtext NULL,
  57. `Photo` longtext NULL,
  58. `Skype` longtext NULL,
  59. `Phone` longtext NULL,
  60. `Email` longtext NULL,
  61. `OfficeId` char(36) NOT NULL,
  62. CONSTRAINT `PK_portal_hr` PRIMARY KEY (`Id`),
  63. CONSTRAINT `FK_portal_hr_portal_offices_OfficeId` FOREIGN KEY (`OfficeId`) REFERENCES `portal_offices` (`Id`) ON DELETE CASCADE
  64. );
  65.  
  66. CREATE TABLE `portal_newstag` (
  67. `NewsId` char(36) NOT NULL,
  68. `TagId` char(36) NOT NULL,
  69. CONSTRAINT `PK_portal_newstag` PRIMARY KEY (`NewsId`, `TagId`),
  70. CONSTRAINT `FK_portal_newstag_portal_news_NewsId` FOREIGN KEY (`NewsId`) REFERENCES `portal_news` (`Id`) ON DELETE CASCADE,
  71. CONSTRAINT `FK_portal_newstag_portal_tags_TagId` FOREIGN KEY (`TagId`) REFERENCES `portal_tags` (`Id`) ON DELETE CASCADE
  72. );
  73.  
  74. CREATE INDEX `IX_portal_eventoffice_OfficeId` ON `portal_eventoffice` (`OfficeId`);
  75.  
  76. CREATE INDEX `IX_portal_hr_OfficeId` ON `portal_hr` (`OfficeId`);
  77.  
  78. CREATE INDEX `IX_portal_newstag_TagId` ON `portal_newstag` (`TagId`);
  79.  
  80. CREATE INDEX `IX_portal_topic_EventEntityId` ON `portal_topic` (`EventEntityId`);
  81.  
  82. CREATE INDEX `IX_portal_topic_NewsEntityId` ON `portal_topic` (`NewsEntityId`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement