1.2.0.sql 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. CREATE TABLE IF NOT EXISTS `stigma` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `scope` varchar(64) DEFAULT NULL,
  4. `itemid` varchar(128) NOT NULL,
  5. `state` varchar(255) NOT NULL,
  6. `date` datetime NOT NULL,
  7. `admin` varchar(64) DEFAULT NULL,
  8. PRIMARY KEY (`id`)
  9. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  10. CREATE TABLE IF NOT EXISTS `extcontras` (
  11. `id` int(11) NOT NULL AUTO_INCREMENT,
  12. `contras_id` int(11) NOT NULL,
  13. `contract_id` int(11) NOT NULL,
  14. `address_id` int(11) NOT NULL,
  15. `period_id` int(11) NOT NULL,
  16. `payday` tinyint(3) DEFAULT NULL,
  17. `date_create` datetime NOT NULL,
  18. PRIMARY KEY (`id`),
  19. KEY `contras_id` (`contras_id`),
  20. KEY `contract_id` (`contract_id`),
  21. KEY `address_id` (`address_id`),
  22. KEY `period_id` (`period_id`),
  23. KEY `payday` (`payday`)
  24. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  25. CREATE TABLE IF NOT EXISTS `extcontras_profiles` (
  26. `id` int(11) NOT NULL AUTO_INCREMENT,
  27. `name` varchar(255) NOT NULL,
  28. `edrpo` varchar(100) DEFAULT NULL,
  29. `contact` varchar(255) DEFAULT NULL,
  30. `email` varchar(255) DEFAULT NULL,
  31. PRIMARY KEY (`id`),
  32. KEY `name` (`name`),
  33. KEY `edrpo` (`edrpo`),
  34. KEY `contact` (`contact`)
  35. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  36. CREATE TABLE IF NOT EXISTS `extcontras_contracts` (
  37. `id` int(11) NOT NULL AUTO_INCREMENT,
  38. `contract` varchar(150) DEFAULT NULL,
  39. `date_start` date NOT NULL,
  40. `date_end` date DEFAULT NULL,
  41. `subject` varchar(255) DEFAULT NULL,
  42. `full_sum` double DEFAULT 0,
  43. `autoprolong` tinyint(3) DEFAULT 1,
  44. `notes` varchar(255) DEFAULT NULL,
  45. PRIMARY KEY (`id`),
  46. KEY `contract` (`contract`),
  47. KEY `date_start` (`date_start`),
  48. KEY `date_end` (`date_end`),
  49. KEY `subject` (`subject`),
  50. KEY `full_sum` (`full_sum`)
  51. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  52. CREATE TABLE IF NOT EXISTS `extcontras_address` (
  53. `id` int(11) NOT NULL AUTO_INCREMENT,
  54. `address` varchar(255) NOT NULL,
  55. `summ` double DEFAULT 0,
  56. `contract_notes` varchar(255) DEFAULT NULL,
  57. `notes` varchar(255) DEFAULT NULL,
  58. PRIMARY KEY (`id`)
  59. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  60. CREATE TABLE IF NOT EXISTS `extcontras_periods` (
  61. `id` int(11) NOT NULL AUTO_INCREMENT,
  62. `period_name` varchar(100) NOT NULL,
  63. PRIMARY KEY (`id`)
  64. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  65. CREATE TABLE IF NOT EXISTS `extcontras_invoices` (
  66. `id` int(11) NOT NULL AUTO_INCREMENT,
  67. `contras_rec_id` int(11) NOT NULL,
  68. `internal_number` varchar(150) DEFAULT '',
  69. `invoice_number` varchar(150) NOT NULL,
  70. `date` date NOT NULL,
  71. `summ` double DEFAULT 0,
  72. `summ_vat` double DEFAULT 0,
  73. `notes` varchar(250) DEFAULT '',
  74. `incoming` tinyint(1) DEFAULT 0,
  75. `outgoing` tinyint(1) DEFAULT 0,
  76. PRIMARY KEY (`id`),
  77. KEY `contras_rec_id` (`contras_rec_id`),
  78. KEY `invoice_number` (`invoice_number`),
  79. KEY `date` (`date`),
  80. KEY `summ` (`summ`)
  81. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  82. CREATE TABLE IF NOT EXISTS `extcontras_money` (
  83. `id` int(11) NOT NULL AUTO_INCREMENT,
  84. `profile_id` int(11) NOT NULL,
  85. `contract_id` int(11) DEFAULT NULL,
  86. `address_id` int(11) DEFAULT NULL,
  87. `accrual_id` int(11) DEFAULT NULL,
  88. `invoice_id` int(11) DEFAULT NULL,
  89. `purpose` varchar(255) NOT NULL DEFAULT '',
  90. `date` datetime NOT NULL,
  91. `date_edit` datetime NOT NULL,
  92. `summ_accrual` double DEFAULT 0,
  93. `summ_payment` double DEFAULT 0,
  94. `incoming` tinyint(1) DEFAULT 0,
  95. `outgoing` tinyint(1) DEFAULT 0,
  96. `paynotes` varchar(255) NOT NULL DEFAULT '',
  97. PRIMARY KEY (`id`),
  98. KEY `profile_id` (`profile_id`),
  99. KEY `contract_id` (`contract_id`),
  100. KEY `address_id` (`address_id`),
  101. KEY `accrual_id` (`accrual_id`),
  102. KEY `purpose` (`purpose`),
  103. KEY `date` (`date`),
  104. KEY `date_edit` (`date_edit`),
  105. KEY `summ_accrual` (`summ_accrual`),
  106. KEY `summ_payment` (`summ_payment`)
  107. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  108. CREATE TABLE IF NOT EXISTS `extcontras_missed_payms` (
  109. `id` int(11) NOT NULL AUTO_INCREMENT,
  110. `contras_rec_id` int(11) NOT NULL,
  111. `profile_id` int(11) NOT NULL,
  112. `contract_id` int(11) DEFAULT NULL,
  113. `address_id` int(11) DEFAULT NULL,
  114. `period_id` int(11) NOT NULL,
  115. `payday` tinyint(3) DEFAULT NULL,
  116. `date_payment` date NOT NULL,
  117. `date_expired` datetime NOT NULL,
  118. `date_payed` datetime DEFAULT NULL,
  119. `summ_payment` double DEFAULT 0,
  120. PRIMARY KEY (`id`),
  121. KEY `contras_rec_id` (`contras_rec_id`),
  122. KEY `profile_id` (`profile_id`),
  123. KEY `contract_id` (`contract_id`),
  124. KEY `address_id` (`address_id`),
  125. KEY `period_id` (`period_id`),
  126. KEY `date_payment` (`date_payment`),
  127. KEY `date_payed` (`date_payed`),
  128. KEY `summ_payment` (`summ_payment`)
  129. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  130. ALTER TABLE `stigma` ADD INDEX(`scope`);
  131. ALTER TABLE `stigma` ADD INDEX(`itemid`);