-- MySQL dump 10.13  Distrib 8.0.33, for Win64 (x86_64)
--
-- Host: localhost    Database: portfolio_data
-- ------------------------------------------------------
-- Server version	8.0.33

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!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 */;

--
-- Table structure for table `accounts`
--

DROP TABLE IF EXISTS `accounts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `accounts` (
  `account` varchar(25) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  PRIMARY KEY (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cash`
--

DROP TABLE IF EXISTS `cash`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cash` (
  `account` varchar(25) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `date` datetime NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `credit` decimal(19,2) DEFAULT NULL,
  `debit` decimal(19,2) DEFAULT NULL,
  `balance` decimal(19,2) DEFAULT NULL,
  `transaction_id` int NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`account`,`date`,`transaction_id`),
  UNIQUE KEY `transaction_id` (`transaction_id`),
  KEY `account` (`account`),
  KEY `IDX_DATE` (`date`),
  CONSTRAINT `FK_Cash_Accounts` FOREIGN KEY (`account`) REFERENCES `accounts` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=1511 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `dividends`
--

DROP TABLE IF EXISTS `dividends`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `dividends` (
  `symbol` varchar(15) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `payment_date` datetime NOT NULL,
  `account` varchar(50) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `amount` decimal(16,4) NOT NULL,
  PRIMARY KEY (`symbol`,`payment_date`,`account`),
  KEY `symbol` (`symbol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `stoplimits`
--

DROP TABLE IF EXISTS `stoplimits`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stoplimits` (
  `symbol` varchar(15) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `stop_limit` decimal(19,2) DEFAULT NULL,
  `shares` decimal(19,2) DEFAULT NULL,
  `stop_type` varchar(15) COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `active` int DEFAULT NULL,
  PRIMARY KEY (`symbol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `trades`
--

DROP TABLE IF EXISTS `trades`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `trades` (
  `trade_id` int NOT NULL AUTO_INCREMENT,
  `symbol` varchar(15) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `trade_date` datetime NOT NULL,
  `shares` decimal(19,2) DEFAULT NULL,
  `price` decimal(19,2) DEFAULT NULL,
  `buysell` char(1) COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `status` varchar(10) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `account` varchar(25) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `commission` decimal(19,2) NOT NULL DEFAULT '0.00',
  `date_sold` datetime DEFAULT NULL,
  `sell_price` decimal(19,2) DEFAULT NULL,
  PRIMARY KEY (`trade_id`),
  KEY `IX_Trades` (`symbol`,`trade_date`),
  KEY `FK_Trades_Accounts` (`account`),
  CONSTRAINT `FK_Trades_Accounts` FOREIGN KEY (`account`) REFERENCES `accounts` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=741 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `watchlist`
--

DROP TABLE IF EXISTS `watchlist`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `watchlist` (
  `watch_list_id` int NOT NULL,
  `symbol` varchar(15) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  PRIMARY KEY (`watch_list_id`,`symbol`),
  KEY `watch_list_id` (`watch_list_id`),
  CONSTRAINT `FK_WatchList_WatchLists` FOREIGN KEY (`watch_list_id`) REFERENCES `watchlists` (`watch_list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `watchlists`
--

DROP TABLE IF EXISTS `watchlists`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `watchlists` (
  `watch_list_id` int NOT NULL AUTO_INCREMENT,
  `watch_list_name` varchar(255) COLLATE utf8mb4_0900_ai_ci NOT NULL,
  PRIMARY KEY (`watch_list_id`),
  UNIQUE KEY `watch_list_id` (`watch_list_id`),
  KEY `watch_list_id_2` (`watch_list_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping events for database 'portfolio_data'
--

--
-- Dumping routines for database 'portfolio_data'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-05-18 10:05:58
