openpayz.sql 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. -- Default OpenPayz MySQL preset.
  2. -- Must be applied after ubilling dump.
  3. -- transactions log table
  4. CREATE TABLE IF NOT EXISTS `op_transactions` (
  5. `id` int(11) NOT NULL AUTO_INCREMENT,
  6. `hash` varchar(255) NOT NULL,
  7. `date` datetime NOT NULL,
  8. `summ` double NOT NULL,
  9. `customerid` varchar(255) NOT NULL,
  10. `paysys` varchar(255) NOT NULL,
  11. `processed` tinyint(1) NOT NULL,
  12. `note` text NOT NULL,
  13. PRIMARY KEY (`id`),
  14. UNIQUE KEY `hash` (`hash`)
  15. ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
  16. -- default customers mappings view
  17. CREATE VIEW op_customers (realid,virtualid) AS SELECT users.login, CRC32(users.login) FROM users LEFT JOIN op_denied ON users.login = op_denied.login WHERE op_denied.login IS NULL;
  18. -- static customers table
  19. CREATE TABLE IF NOT EXISTS `op_static` (
  20. `id` int(11) NOT NULL auto_increment,
  21. `realid` varchar(255) NOT NULL,
  22. `virtualid` varchar(255) NOT NULL,
  23. PRIMARY KEY (`id`),
  24. KEY `realid` (`realid`),
  25. KEY `virtualid` (`virtualid`)
  26. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;