-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.4.32-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- HeidiSQL Version:             12.6.0.6765
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


-- Dumping database structure for kval_darbs_riters
CREATE DATABASE IF NOT EXISTS `kval_darbs_riters` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `kval_darbs_riters`;

-- Dumping structure for table kval_darbs_riters.rr_410_accounts
CREATE TABLE IF NOT EXISTS `rr_410_accounts` (
  `account_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'konkreta konta id',
  `profile_id` int(11) unsigned NOT NULL COMMENT 'profila kas atbilst kontam id',
  `account_name` varchar(100) NOT NULL COMMENT 'konta nosaukums',
  PRIMARY KEY (`account_id`) USING BTREE,
  KEY `FK__profile` (`profile_id`),
  CONSTRAINT `FK__profile` FOREIGN KEY (`profile_id`) REFERENCES `rr_410_profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_accounts: ~3 rows (approximately)
INSERT INTO `rr_410_accounts` (`account_id`, `profile_id`, `account_name`) VALUES
	(1, 1, 'subacc1'),
	(8, 1, 'hhello');

-- Dumping structure for table kval_darbs_riters.rr_410_coin
CREATE TABLE IF NOT EXISTS `rr_410_coin` (
  `coin_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `coin_name` varchar(50) NOT NULL,
  PRIMARY KEY (`coin_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_coin: ~15 rows (approximately)
INSERT INTO `rr_410_coin` (`coin_id`, `coin_name`) VALUES
	(1, 'fee'),
	(2, 'fwrf'),
	(3, 'sfe'),
	(4, 'qr'),
	(5, 'wf'),
	(6, 'dwqw'),
	(7, 'btcb'),
	(8, 'btcbg'),
	(9, 'rt'),
	(10, 'pepe'),
	(11, 'karlis'),
	(12, 'lima'),
	(13, 'reinis'),
	(14, 'ge'),
	(15, 'grunde'),
	(16, 'jeee'),
	(17, 'eee'),
	(18, '');

-- Dumping structure for table kval_darbs_riters.rr_410_coinpair
CREATE TABLE IF NOT EXISTS `rr_410_coinpair` (
  `coinpair_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `coinpair_name` varchar(50) NOT NULL,
  PRIMARY KEY (`coinpair_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_coinpair: ~15 rows (approximately)
INSERT INTO `rr_410_coinpair` (`coinpair_id`, `coinpair_name`) VALUES
	(1, 'edd'),
	(2, 'fwef'),
	(3, 'wef'),
	(4, 'qwd'),
	(5, 'usdtt'),
	(6, 'usdttg'),
	(7, 'usdttg3'),
	(8, 'rt'),
	(9, 'usdt14'),
	(10, 'usdt13'),
	(11, 'rihardu'),
	(12, 'eur'),
	(13, 'ee'),
	(14, 'eg'),
	(15, 'ralfs'),
	(16, 'juuu'),
	(17, '');

-- Dumping structure for table kval_darbs_riters.rr_410_direction
CREATE TABLE IF NOT EXISTS `rr_410_direction` (
  `direction_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `direction` varchar(10) NOT NULL,
  PRIMARY KEY (`direction_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_direction: ~2 rows (approximately)
INSERT INTO `rr_410_direction` (`direction_id`, `direction`) VALUES
	(1, 'Long'),
	(2, 'Short');

-- Dumping structure for table kval_darbs_riters.rr_410_history_input
CREATE TABLE IF NOT EXISTS `rr_410_history_input` (
  `trade_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` int(11) unsigned NOT NULL,
  `coin_id` int(11) unsigned NOT NULL,
  `coinpair_id` int(11) unsigned NOT NULL,
  `direction_id` int(11) unsigned NOT NULL,
  `open_price` decimal(20,7) unsigned DEFAULT NULL,
  `close_price` decimal(20,7) unsigned DEFAULT NULL,
  `leverage` int(5) unsigned DEFAULT 1,
  `close_date` date DEFAULT NULL,
  `photo` blob DEFAULT NULL,
  `percents` decimal(6,2) DEFAULT NULL,
  PRIMARY KEY (`trade_id`) USING BTREE,
  KEY `FK_rr_410_history_input_rr_410_accounts` (`account_id`),
  KEY `FK_rr_410_history_input_rr_410_coin` (`coin_id`),
  KEY `FK_rr_410_history_input_rr_410_coinpair` (`coinpair_id`),
  KEY `FK_rr_410_history_input_rr_410_direction` (`direction_id`),
  CONSTRAINT `FK_rr_410_history_input_rr_410_accounts` FOREIGN KEY (`account_id`) REFERENCES `rr_410_accounts` (`account_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_coin` FOREIGN KEY (`coin_id`) REFERENCES `rr_410_coin` (`coin_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_coinpair` FOREIGN KEY (`coinpair_id`) REFERENCES `rr_410_coinpair` (`coinpair_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_direction` FOREIGN KEY (`direction_id`) REFERENCES `rr_410_direction` (`direction_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_history_input: ~24 rows (approximately)
INSERT INTO `rr_410_history_input` (`trade_id`, `account_id`, `coin_id`, `coinpair_id`, `direction_id`, `open_price`, `close_price`, `leverage`, `close_date`, `photo`, `percents`) VALUES
	(1, 1, 9, 8, 1, NULL, NULL, 1, NULL, NULL, NULL),
	(5, 1, 11, 11, 1, 31.5000000, 32.0000000, 100, '2024-10-02', NULL, NULL),
	(6, 1, 12, 12, 1, 23.0000000, 23.5687750, 3, '2024-10-09', NULL, NULL),
	(7, 1, 10, 6, 1, 23.0000000, 24.0000000, 12, '2024-10-09', NULL, 52.17),
	(8, 1, 10, 6, 1, 23.0000000, 24.0000000, 12, '2024-10-09', NULL, 52.17),
	(9, 1, 10, 6, 1, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, -74.45),
	(10, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(11, 1, 8, 10, 2, 34.0000000, 35.0000000, 3, '2024-10-12', NULL, -8.82),
	(12, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(13, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(14, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(15, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(16, 1, 10, 6, 2, 25.3450000, 24.2350000, 17, '2024-10-09', NULL, 74.45),
	(17, 1, 13, 13, 2, 13.0000000, 12.0000000, 4, '2024-10-10', NULL, 30.77),
	(18, 1, 14, 14, 1, 12.0000000, 2.0000000, 2, '2024-10-03', NULL, -166.67),
	(19, 1, 10, 10, 1, 123.0000000, 12.0000000, 1, '2024-10-10', NULL, -90.24),
	(20, 1, 15, 15, 2, 0.9900000, 1.0000000, 13, '2024-10-15', NULL, -13.13),
	(21, 1, 11, 10, 1, 12.0000000, 1.0000000, 4, '2024-10-01', NULL, -366.67),
	(22, 1, 16, 16, 1, 12.0000000, 22.0000000, 3, '2024-10-17', NULL, 250.00),
	(23, 1, 10, 6, 1, 5.5600000, 5.0000000, 10, '2024-10-15', _binary 0x6261636b6965652d3238363734352d6c616e6473636170652e6a7067, -100.72),
	(24, 1, 8, 12, 2, 0.0400000, 0.1000000, 3, '2024-10-15', _binary 0x6261636b6965652d3236353636312d6c616e647363617065202831292e6a7067, -450.00),
	(25, 1, 17, 14, 1, 0.0800000, 0.0300000, 1, '0000-00-00', _binary 0x6261636b6965652d3237373037382d6c616e6473636170652e6a7067, -62.50),
	(26, 1, 18, 17, 1, 0.0300000, 0.0400000, 2, '0000-00-00', NULL, 66.67),
	(27, 8, 10, 11, 1, 0.0300000, 0.0900000, 7, '2024-10-10', _binary 0x4469676573745f617574682e706e67, 1400.00),
	(28, 1, 10, 6, 1, 1.0000000, 2.0000000, 9, '2024-10-16', _binary 0x6261636b6965652d3236353636312d6c616e647363617065202831292e6a7067, 900.00);

-- Dumping structure for table kval_darbs_riters.rr_410_profile
CREATE TABLE IF NOT EXISTS `rr_410_profile` (
  `profile_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(250) NOT NULL,
  `password` varchar(250) NOT NULL,
  PRIMARY KEY (`profile_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_profile: ~0 rows (approximately)
INSERT INTO `rr_410_profile` (`profile_id`, `email`, `password`) VALUES
	(1, 'ralfsriters22@gmail.com', '$2y$10$oTFOLEC9whwOQu4YZ2fFZelzsgiDdS6VPpTXNrwvmZ3fCcFMBcAAG'),
	(2, 'saulitis@gmail.com', '$2y$10$Lf2v56TCKd69Fd.vf6jKDeA8AYP2xt/vBQ4Wp9Z/1DoCHOPHO1OsG');

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
