From 662ec1e3caf7bb99b8ad50baa063ec4e78ef6a7a Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 3 Apr 2025 18:12:50 -0400 Subject: [PATCH] Updating MariaDb Translate scripts --- Translate/Database/ReadMe.txt | 2 + Translate/Database/optimize.sql | 46 ++ Translate/Database/optimizedb.sh | 2 + Translate/Database/restoredb.sh | 7 + Translate/Database/schema.sql | 1224 ++++++++++++++++++++++++++++++ Translate/translate.sh | 3 + 6 files changed, 1284 insertions(+) create mode 100644 Translate/Database/ReadMe.txt create mode 100755 Translate/Database/optimize.sql create mode 100755 Translate/Database/optimizedb.sh create mode 100755 Translate/Database/restoredb.sh create mode 100644 Translate/Database/schema.sql diff --git a/Translate/Database/ReadMe.txt b/Translate/Database/ReadMe.txt new file mode 100644 index 0000000..441fb40 --- /dev/null +++ b/Translate/Database/ReadMe.txt @@ -0,0 +1,2 @@ +These scripts go in the /mnt/Mariadb folder + diff --git a/Translate/Database/optimize.sql b/Translate/Database/optimize.sql new file mode 100755 index 0000000..8fb3587 --- /dev/null +++ b/Translate/Database/optimize.sql @@ -0,0 +1,46 @@ +PURGE BINARY LOGS BEFORE NOW(); + +USE market_data; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE analystpricetarget; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE analystratings; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE balancesheet; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE incomestatement; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE cashflowstatement; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE dividendhistory; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE etfholdings; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE fundamentals; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE historical; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE insidertransaction; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE options; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE prices; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE secfilings; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE valuations; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE yieldcurve; + +use portfolio_data; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE accounts; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE cash; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE trades; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE watchlist; + +OPTIMIZE NO_WRITE_TO_BINLOG TABLE watchlists; + diff --git a/Translate/Database/optimizedb.sh b/Translate/Database/optimizedb.sh new file mode 100755 index 0000000..889b8b5 --- /dev/null +++ b/Translate/Database/optimizedb.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo mysql -u root -pdbas --default-character-set=utf8mb4 < optimize.sql diff --git a/Translate/Database/restoredb.sh b/Translate/Database/restoredb.sh new file mode 100755 index 0000000..193e983 --- /dev/null +++ b/Translate/Database/restoredb.sh @@ -0,0 +1,7 @@ +#!/bin/bash +sudo mysql -u root -pdbas --default-character-set=utf8mb4 < backupdb2.sql +sudo mysql -u root -pdbas --default-character-set=utf8mb4 < optimize.sql +sudo service mariadb stop +sudo truncate /var/log/mariadb/adrastea.log -s 0 +sudo truncate /var/log/mariadb/adrastea-slow.log -s 0 +sudo service mariadb start diff --git a/Translate/Database/schema.sql b/Translate/Database/schema.sql new file mode 100644 index 0000000..7dafc77 --- /dev/null +++ b/Translate/Database/schema.sql @@ -0,0 +1,1224 @@ +-- MySQL dump 10.13 Distrib 8.0.33, for Win64 (x86_64) +-- +-- Host: localhost Database: +-- ------------------------------------------------------ +-- 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' */; +/*!50606 SET @OLD_INNODB_STATS_AUTO_RECALC=@@INNODB_STATS_AUTO_RECALC */; +/*!50606 SET GLOBAL INNODB_STATS_AUTO_RECALC=OFF */; +/*!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 */; + +-- +-- Position to start replication or point-in-time recovery from +-- + +CHANGE MASTER TO MASTER_LOG_FILE='EUROPA-bin.000230', MASTER_LOG_POS=9483869; + +-- +-- Current Database: `market_data` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `market_data` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; + +USE `market_data`; + +-- +-- Table structure for table `analystpricetarget` +-- + +DROP TABLE IF EXISTS `analystpricetarget`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `analystpricetarget` ( + `date` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `mean_target` decimal(19,2) DEFAULT NULL, + `median_target` decimal(19,2) DEFAULT NULL, + `high_target` decimal(19,2) DEFAULT NULL, + `low_target` decimal(19,2) DEFAULT NULL, + PRIMARY KEY (`symbol`,`date`), + KEY `FK_AnalystPriceTarget_SecurityMaster` (`symbol`), + CONSTRAINT `FK_AnalystPriceTarget_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `analystpricetarget` +-- + +LOCK TABLES `analystpricetarget` WRITE; +/*!40000 ALTER TABLE `analystpricetarget` DISABLE KEYS */; +/*!40000 ALTER TABLE `analystpricetarget` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `analystratings` +-- + +DROP TABLE IF EXISTS `analystratings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `analystratings` ( + `date` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `company` varchar(255) DEFAULT NULL, + `brokerage_firm` varchar(50) NOT NULL, + `type` varchar(20) DEFAULT NULL, + `ratings_change` varchar(50) DEFAULT NULL, + `price_target` decimal(19,2) DEFAULT NULL, + PRIMARY KEY (`symbol`,`date`,`brokerage_firm`), + KEY `symbol` (`symbol`), + CONSTRAINT `FK_AnalystRatings_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `analystratings` +-- + +LOCK TABLES `analystratings` WRITE; +/*!40000 ALTER TABLE `analystratings` DISABLE KEYS */; +/*!40000 ALTER TABLE `analystratings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `balancesheet` +-- + +DROP TABLE IF EXISTS `balancesheet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `balancesheet` ( + `asof` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `long_term_debt` decimal(19,2) DEFAULT NULL, + `other_liabilities` decimal(19,2) DEFAULT NULL, + `deferred_long_term_liabilities` decimal(19,2) DEFAULT NULL, + `minority_interest` decimal(19,2) DEFAULT NULL, + `negative_goodwill` decimal(19,2) DEFAULT NULL, + `total_stockholder_equity` decimal(19,2) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + `period` bit(1) NOT NULL, + `inventory` decimal(19,2) DEFAULT NULL, + `property_plant_and_equipment` decimal(19,2) DEFAULT NULL, + `intangible_assets` decimal(19,2) DEFAULT NULL, + `accumulated_amortization` decimal(19,2) DEFAULT NULL, + `goodwill` decimal(19,2) DEFAULT NULL, + `total_current_assets` decimal(19,2) DEFAULT NULL, + `total_assets` decimal(19,2) DEFAULT NULL, + `total_current_liabilities` decimal(19,2) DEFAULT NULL, + `total_liabilities` decimal(19,2) DEFAULT NULL, + `cash_and_cash_equivalents` decimal(19,2) DEFAULT NULL, + PRIMARY KEY (`symbol`,`asof`,`period`), + KEY `IX_BalanceSheet_Modified` (`modified`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `balancesheet` +-- + +LOCK TABLES `balancesheet` WRITE; +/*!40000 ALTER TABLE `balancesheet` DISABLE KEYS */; +/*!40000 ALTER TABLE `balancesheet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `cashflowstatement` +-- + +DROP TABLE IF EXISTS `cashflowstatement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `cashflowstatement` ( + `asof` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `depreciation_and_amortization` decimal(19,2) DEFAULT NULL, + `deferred_income_taxes` decimal(19,2) DEFAULT NULL, + `stock_based_compensation` decimal(19,2) DEFAULT NULL, + `accounts_receivable` decimal(19,2) DEFAULT NULL, + `inventory` decimal(19,2) DEFAULT NULL, + `accounts_payable` decimal(19,2) DEFAULT NULL, + `accrued_liabilities` decimal(19,2) DEFAULT NULL, + `operating_cashflow` decimal(19,2) DEFAULT NULL, + `free_cashflow` decimal(19,2) DEFAULT NULL, + `period` int NOT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`asof`,`period`), + KEY `IX_CashflowStatement_Modified` (`modified`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cashflowstatement` +-- + +LOCK TABLES `cashflowstatement` WRITE; +/*!40000 ALTER TABLE `cashflowstatement` DISABLE KEYS */; +/*!40000 ALTER TABLE `cashflowstatement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `companyprofile` +-- + +DROP TABLE IF EXISTS `companyprofile`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `companyprofile` ( + `symbol` varchar(15) NOT NULL, + `description` mediumtext, + `pricing_source` varchar(10) DEFAULT NULL, + `can_roll_previous` tinyint(1) NOT NULL DEFAULT '0', + `freeze_pricing` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`symbol`), + UNIQUE KEY `symbol` (`symbol`), + KEY `IDX_SYMBOL` (`symbol`), + CONSTRAINT `FK_CompanyProfile_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `companyprofile` +-- + +LOCK TABLES `companyprofile` WRITE; +/*!40000 ALTER TABLE `companyprofile` DISABLE KEYS */; +/*!40000 ALTER TABLE `companyprofile` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `currencyconversion` +-- + +DROP TABLE IF EXISTS `currencyconversion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `currencyconversion` ( + `asof` datetime NOT NULL, + `source_currency` varchar(10) NOT NULL, + `destination_currency` varchar(10) NOT NULL, + `destination_currency_name` varchar(255) DEFAULT NULL, + `units_per_source` double NOT NULL, + `source_per_unit` double NOT NULL, + PRIMARY KEY (`asof`,`source_currency`,`destination_currency`), + KEY `IX_DATE_SOURCE` (`source_currency`,`destination_currency`,`asof`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `currencyconversion` +-- + +LOCK TABLES `currencyconversion` WRITE; +/*!40000 ALTER TABLE `currencyconversion` DISABLE KEYS */; +/*!40000 ALTER TABLE `currencyconversion` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `dictionary` +-- + +DROP TABLE IF EXISTS `dictionary`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `dictionary` ( + `word` varchar(55) NOT NULL, + `part_of_speech` varchar(15) NOT NULL, + PRIMARY KEY (`word`,`part_of_speech`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `dictionary` +-- + +LOCK TABLES `dictionary` WRITE; +/*!40000 ALTER TABLE `dictionary` DISABLE KEYS */; +/*!40000 ALTER TABLE `dictionary` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `dividendhistory` +-- + +DROP TABLE IF EXISTS `dividendhistory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `dividendhistory` ( + `symbol` varchar(15) NOT NULL, + `dividend_type` varchar(25) DEFAULT NULL, + `cash_amount` decimal(22,2) DEFAULT NULL, + `div_ex_date` datetime NOT NULL, + `declaration_date` datetime DEFAULT NULL, + `record_date` datetime DEFAULT NULL, + `payment_date` datetime DEFAULT NULL, + `modified` datetime NOT NULL, + PRIMARY KEY (`symbol`,`div_ex_date`), + KEY `symbol` (`symbol`), + CONSTRAINT `FK_DividendHistory_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `dividendhistory` +-- + +LOCK TABLES `dividendhistory` WRITE; +/*!40000 ALTER TABLE `dividendhistory` DISABLE KEYS */; +/*!40000 ALTER TABLE `dividendhistory` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `earningsannouncements` +-- + +DROP TABLE IF EXISTS `earningsannouncements`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `earningsannouncements` ( + `symbol` varchar(15) NOT NULL, + `date` datetime NOT NULL, + `period_ending` datetime NOT NULL, + `estimate` decimal(19,2) DEFAULT NULL, + `reported` decimal(19,2) DEFAULT NULL, + `surprise` decimal(19,2) DEFAULT NULL, + `surprise_pct` decimal(10,2) DEFAULT NULL, + `time` varchar(25) DEFAULT NULL, + `modified` datetime NOT NULL, + PRIMARY KEY (`symbol`,`date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `earningsannouncements` +-- + +LOCK TABLES `earningsannouncements` WRITE; +/*!40000 ALTER TABLE `earningsannouncements` DISABLE KEYS */; +/*!40000 ALTER TABLE `earningsannouncements` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `economicindicators` +-- + +DROP TABLE IF EXISTS `economicindicators`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `economicindicators` ( + `country_code` varchar(25) NOT NULL, + `country_name` varchar(255) DEFAULT NULL, + `indicator_name` varchar(50) NOT NULL, + `indicator_code` varchar(50) DEFAULT NULL, + `indicator_value` decimal(19,2) DEFAULT NULL, + `year` int NOT NULL, + `source` varchar(50) NOT NULL, + `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`country_code`,`indicator_name`,`year`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `economicindicators` +-- + +LOCK TABLES `economicindicators` WRITE; +/*!40000 ALTER TABLE `economicindicators` DISABLE KEYS */; +/*!40000 ALTER TABLE `economicindicators` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `etfholdings` +-- + +DROP TABLE IF EXISTS `etfholdings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `etfholdings` ( + `etf_symbol` varchar(15) NOT NULL, + `holding_symbol` varchar(15) NOT NULL, + `holding_symbol_sc` varchar(15) DEFAULT NULL, + `pcnt_of_assets` decimal(19,2) DEFAULT NULL, + `company` varchar(255) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + KEY `ETFHOLDINGS_IDX_ETFSYMBOL` (`etf_symbol`), + CONSTRAINT `FK_ETFHoldings_SecurityMaster` FOREIGN KEY (`etf_symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `etfholdings` +-- + +LOCK TABLES `etfholdings` WRITE; +/*!40000 ALTER TABLE `etfholdings` DISABLE KEYS */; +/*!40000 ALTER TABLE `etfholdings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `fundamentals` +-- + +DROP TABLE IF EXISTS `fundamentals`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `fundamentals` ( + `symbol` varchar(15) NOT NULL, + `asof` date NOT NULL, + `source` varchar(15) DEFAULT NULL, + `next_earnings_date` date DEFAULT NULL, + `beta` decimal(19,2) DEFAULT NULL, + `low52` decimal(19,2) DEFAULT NULL, + `high52` decimal(19,2) DEFAULT NULL, + `volume` bigint DEFAULT NULL, + `market_cap` decimal(19,2) DEFAULT NULL, + `pe` decimal(19,2) DEFAULT NULL, + `eps` decimal(19,2) DEFAULT NULL, + `peg` decimal(19,2) DEFAULT NULL, + `return_on_assets` decimal(19,2) DEFAULT NULL, + `return_on_equity` decimal(19,2) DEFAULT NULL, + `total_cash` decimal(19,2) DEFAULT NULL, + `total_debt` decimal(19,2) DEFAULT NULL, + `shares_outstanding` decimal(19,2) DEFAULT NULL, + `revenue` decimal(19,2) DEFAULT NULL, + `revenue_per_share` decimal(19,2) DEFAULT NULL, + `qtrly_revenue_growth` decimal(19,2) DEFAULT NULL, + `gross_profit` decimal(19,2) DEFAULT NULL, + `ebitda` decimal(19,2) DEFAULT NULL, + `net_income_available_to_common` decimal(19,2) DEFAULT NULL, + `book_value_per_share` decimal(19,2) DEFAULT NULL, + `operating_cashflow` decimal(19,2) DEFAULT NULL, + `leveraged_free_cashflow` decimal(19,2) DEFAULT NULL, + `trailing_pe` decimal(19,2) DEFAULT NULL, + `ebit` decimal(19,2) DEFAULT NULL, + `enterprise_value` decimal(19,2) DEFAULT NULL, + PRIMARY KEY (`symbol`,`asof`), + KEY `PK_Fundamental_Symbol` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `fundamentals` +-- + +LOCK TABLES `fundamentals` WRITE; +/*!40000 ALTER TABLE `fundamentals` DISABLE KEYS */; +/*!40000 ALTER TABLE `fundamentals` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `headlines` +-- + +DROP TABLE IF EXISTS `headlines`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `headlines` ( + `symbol` varchar(15) NOT NULL, + `asof` date NOT NULL, + `headline` varchar(512) NOT NULL, + `modified` datetime NOT NULL, + `source` varchar(25) NOT NULL, + KEY `symbol` (`symbol`), + KEY `IX_HEADLINES` (`symbol`,`asof`,`headline`), + CONSTRAINT `FK_Headlines_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `headlines` +-- + +LOCK TABLES `headlines` WRITE; +/*!40000 ALTER TABLE `headlines` DISABLE KEYS */; +/*!40000 ALTER TABLE `headlines` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `historical` +-- + +DROP TABLE IF EXISTS `historical`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `historical` ( + `symbol` varchar(15) NOT NULL, + `asof` datetime NOT NULL, + `type` varchar(55) NOT NULL, + `value` decimal(19,2) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`asof`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `historical` +-- + +LOCK TABLES `historical` WRITE; +/*!40000 ALTER TABLE `historical` DISABLE KEYS */; +/*!40000 ALTER TABLE `historical` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `incomestatement` +-- + +DROP TABLE IF EXISTS `incomestatement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `incomestatement` ( + `asof` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `total_revenue` decimal(19,2) DEFAULT NULL, + `cost_of_revenue` decimal(19,2) DEFAULT NULL, + `income_tax_expense` decimal(19,2) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + `gross_profit` decimal(19,2) DEFAULT NULL, + `net_income` decimal(19,2) DEFAULT NULL, + `sga` decimal(19,2) DEFAULT NULL, + `net_income_applicable_to_common_shares` decimal(19,2) DEFAULT NULL, + `ebit` decimal(19,2) DEFAULT NULL, + `operating_expenses` decimal(19,2) DEFAULT NULL, + `research_and_development` decimal(19,2) DEFAULT NULL, + `period` int NOT NULL, + `interest_expense` decimal(19,2) DEFAULT NULL, + PRIMARY KEY (`symbol`,`asof`,`period`), + KEY `IX_IncomeStatement_Modified` (`modified`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `incomestatement` +-- + +LOCK TABLES `incomestatement` WRITE; +/*!40000 ALTER TABLE `incomestatement` DISABLE KEYS */; +/*!40000 ALTER TABLE `incomestatement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `insidertransaction` +-- + +DROP TABLE IF EXISTS `insidertransaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `insidertransaction` ( + `symbol` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `filing_date` datetime NOT NULL, + `transaction_date` datetime NOT NULL, + `insider_name` varchar(255) DEFAULT NULL, + `ownership_type` varchar(55) DEFAULT NULL, + `securities` varchar(255) DEFAULT NULL, + `nature_of_transaction` varchar(255) DEFAULT NULL, + `number_or_value_acquired_disposed` decimal(19,2) DEFAULT NULL, + `price` decimal(19,2) DEFAULT NULL, + `form` varchar(55) NOT NULL, + `sec_accession_number` varchar(55) NOT NULL, + `form_row_number` varchar(55) NOT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`form`,`sec_accession_number`,`form_row_number`), + KEY `symbol` (`symbol`), + CONSTRAINT `FK_InsiderTransaction_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `insidertransaction` +-- + +LOCK TABLES `insidertransaction` WRITE; +/*!40000 ALTER TABLE `insidertransaction` DISABLE KEYS */; +/*!40000 ALTER TABLE `insidertransaction` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `lexicon` +-- + +DROP TABLE IF EXISTS `lexicon`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `lexicon` ( + `word` varchar(55) NOT NULL, + `sentiment` varchar(10) NOT NULL, + `part_of_speech` varchar(15) DEFAULT NULL, + PRIMARY KEY (`word`,`sentiment`), + KEY `IX_Lexicon` (`part_of_speech`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `lexicon` +-- + +LOCK TABLES `lexicon` WRITE; +/*!40000 ALTER TABLE `lexicon` DISABLE KEYS */; +/*!40000 ALTER TABLE `lexicon` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `marketholidays` +-- + +DROP TABLE IF EXISTS `marketholidays`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `marketholidays` ( + `Date` date NOT NULL, + `Description` varchar(50) DEFAULT NULL, + PRIMARY KEY (`Date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `marketholidays` +-- + +LOCK TABLES `marketholidays` WRITE; +/*!40000 ALTER TABLE `marketholidays` DISABLE KEYS */; +/*!40000 ALTER TABLE `marketholidays` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mstarsecurityid` +-- + +DROP TABLE IF EXISTS `mstarsecurityid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `mstarsecurityid` ( + `symbol` varchar(15) NOT NULL, + `security_identifier` varchar(25) NOT NULL, + `modified` datetime NOT NULL, + PRIMARY KEY (`symbol`), + KEY `IX_HEADLINES` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mstarsecurityid` +-- + +LOCK TABLES `mstarsecurityid` WRITE; +/*!40000 ALTER TABLE `mstarsecurityid` DISABLE KEYS */; +/*!40000 ALTER TABLE `mstarsecurityid` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `options` +-- + +DROP TABLE IF EXISTS `options`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `options` ( + `symbol` varchar(15) NOT NULL, + `expiration_date` date NOT NULL, + `option_type` char(1) NOT NULL, + `strike` decimal(19,2) NOT NULL, + `last_price` decimal(19,2) DEFAULT NULL, + `change_price` decimal(19,2) DEFAULT NULL, + `bid` decimal(19,2) DEFAULT NULL, + `ask` decimal(19,2) DEFAULT NULL, + `volume` int DEFAULT NULL, + `open_interest` decimal(19,2) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`expiration_date`,`option_type`,`strike`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `options` +-- + +LOCK TABLES `options` WRITE; +/*!40000 ALTER TABLE `options` DISABLE KEYS */; +/*!40000 ALTER TABLE `options` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `premarket` +-- + +DROP TABLE IF EXISTS `premarket`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `premarket` ( + `market` varchar(25) NOT NULL, + `change_value` decimal(19,2) NOT NULL, + `change_percent` decimal(19,2) NOT NULL, + `timestamp` varchar(50) NOT NULL, + PRIMARY KEY (`market`,`timestamp`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `premarket` +-- + +LOCK TABLES `premarket` WRITE; +/*!40000 ALTER TABLE `premarket` DISABLE KEYS */; +/*!40000 ALTER TABLE `premarket` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `priceindex` +-- + +DROP TABLE IF EXISTS `priceindex`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `priceindex` ( + `index_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `index_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `index_value` decimal(19,2) DEFAULT NULL, + `as_of` datetime NOT NULL, + `source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`index_code`,`as_of`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `priceindex` +-- + +LOCK TABLES `priceindex` WRITE; +/*!40000 ALTER TABLE `priceindex` DISABLE KEYS */; +/*!40000 ALTER TABLE `priceindex` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `prices` +-- + +DROP TABLE IF EXISTS `prices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `prices` ( + `date` date NOT NULL, + `symbol` varchar(15) NOT NULL, + `open` decimal(19,2) DEFAULT NULL, + `high` decimal(19,2) DEFAULT NULL, + `low` decimal(19,2) DEFAULT NULL, + `close` decimal(19,2) DEFAULT NULL, + `volume` bigint DEFAULT NULL, + `adjclose` decimal(19,2) DEFAULT NULL, + `source` char(1) DEFAULT NULL, + PRIMARY KEY (`symbol`,`date`), + KEY `IX_PRICES_DATE_SYMBOL` (`date` DESC,`symbol`), + KEY `IX_PRICES_SYMBOL` (`symbol`), + KEY `IX_PRICES_DATE` (`date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `prices` +-- + +LOCK TABLES `prices` WRITE; +/*!40000 ALTER TABLE `prices` DISABLE KEYS */; +/*!40000 ALTER TABLE `prices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `secfilings` +-- + +DROP TABLE IF EXISTS `secfilings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `secfilings` ( + `symbol` varchar(15) NOT NULL, + `filing_date` datetime NOT NULL, + `form` varchar(25) NOT NULL, + `form_text` longblob NOT NULL, + `description` varchar(255) DEFAULT NULL, + `sec_filing_url` varchar(255) NOT NULL, + `sequence` bigint NOT NULL, + `sec_accession_number` varchar(50) NOT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`filing_date`,`sequence`,`sec_accession_number`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `secfilings` +-- + +LOCK TABLES `secfilings` WRITE; +/*!40000 ALTER TABLE `secfilings` DISABLE KEYS */; +/*!40000 ALTER TABLE `secfilings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `securitymaster` +-- + +DROP TABLE IF EXISTS `securitymaster`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `securitymaster` ( + `symbol` varchar(15) NOT NULL, + `company` varchar(255) DEFAULT NULL, + `cik` varchar(15) DEFAULT NULL, + `sector` varchar(255) DEFAULT NULL, + `industry` varchar(255) DEFAULT NULL, + `security_type` varchar(15) DEFAULT NULL, + `create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `securitymaster` +-- + +LOCK TABLES `securitymaster` WRITE; +/*!40000 ALTER TABLE `securitymaster` DISABLE KEYS */; +/*!40000 ALTER TABLE `securitymaster` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `splits` +-- + +DROP TABLE IF EXISTS `splits`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `splits` ( + `symbol` varchar(15) NOT NULL, + `effective_date` datetime NOT NULL, + `ratio` varchar(10) DEFAULT NULL, + `applied` tinyint DEFAULT NULL, + `applied_least_recent` datetime DEFAULT NULL, + `applied_most_recent` datetime DEFAULT NULL, + `modified` date DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`symbol`,`effective_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `splits` +-- + +LOCK TABLES `splits` WRITE; +/*!40000 ALTER TABLE `splits` DISABLE KEYS */; +/*!40000 ALTER TABLE `splits` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `valuations` +-- + +DROP TABLE IF EXISTS `valuations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `valuations` ( + `valuation_date` datetime NOT NULL, + `symbol` varchar(15) NOT NULL, + `company` varchar(255) NOT NULL, + `next_earnings_date` datetime DEFAULT NULL, + `long_term_debt` decimal(22,2) DEFAULT NULL, + `revenue` decimal(22,2) DEFAULT NULL, + `debt_load` varchar(15) DEFAULT NULL, + `roic_avg` decimal(22,2) DEFAULT NULL, + `bvps_dates` varchar(50) DEFAULT NULL, + `avg_equity_growth` decimal(22,2) DEFAULT NULL, + `avg_equity_growth_2y` decimal(22,2) DEFAULT NULL, + `avg_equity_growth_4y` decimal(22,2) DEFAULT NULL, + `eps_dates` varchar(50) DEFAULT NULL, + `avg_eps_growth` decimal(22,2) DEFAULT NULL, + `avg_eps_growth_2y` decimal(22,2) DEFAULT NULL, + `avg_eps_growth_4y` decimal(22,2) DEFAULT NULL, + `revenue_dates` varchar(50) DEFAULT NULL, + `avg_revenue_growth` decimal(22,2) DEFAULT NULL, + `avg_revenue_growth_qtr` decimal(22,2) DEFAULT NULL, + `avg_revenue_growth_2y` decimal(22,2) DEFAULT NULL, + `avg_revenue_growth_4y` decimal(22,2) DEFAULT NULL, + `avg_freecashflow_growth` decimal(22,2) DEFAULT NULL, + `avg_operating_cashflow` decimal(22,2) DEFAULT NULL, + `avg_working_capital` decimal(22,2) DEFAULT NULL, + `bvps` decimal(22,2) DEFAULT NULL, + `price_to_book` decimal(22,2) DEFAULT NULL, + `eps` decimal(22,2) DEFAULT NULL, + `pe` decimal(22,2) DEFAULT NULL, + `peg` decimal(22,2) DEFAULT NULL, + `implied_earnings_growth` decimal(22,2) DEFAULT NULL, + `low_pe` decimal(22,2) DEFAULT NULL, + `trailing_pe` decimal(22,2) DEFAULT NULL, + `avg_low_trailing` decimal(22,2) DEFAULT NULL, + `current_stock_estimate_price` decimal(22,2) DEFAULT NULL, + `price_estimate_10y` decimal(22,2) DEFAULT NULL, + `todays_price_for_required_return` decimal(22,2) DEFAULT NULL, + `mos` decimal(22,2) DEFAULT NULL, + `mos_80` decimal(22,2) DEFAULT NULL, + `intrinsic_value` decimal(22,2) DEFAULT NULL, + `rgv` decimal(22,2) DEFAULT NULL, + `latest_price` decimal(22,2) DEFAULT NULL, + `upside_pcnt` decimal(22,2) DEFAULT NULL, + `downside_pcnt` decimal(22,2) DEFAULT NULL, + `mean_target_price` decimal(22,2) DEFAULT NULL, + `low_target_price` decimal(22,2) DEFAULT NULL, + `high_target_price` decimal(22,2) DEFAULT NULL, + `bargain_mos` tinyint(1) DEFAULT NULL, + `bargain_mos_80` tinyint(1) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + `beta90` decimal(19,2) DEFAULT NULL, + `beta2Y` decimal(19,2) DEFAULT NULL, + `roic_dates` varchar(50) DEFAULT NULL, + `roic_slope` decimal(22,2) DEFAULT NULL, + `market_cap` decimal(22,2) DEFAULT NULL, + `earnings_yield` decimal(23,2) DEFAULT NULL, + `enterprise_value` decimal(22,2) DEFAULT NULL, + `ebit` decimal(22,2) DEFAULT NULL, + `tlb_rank_roic` decimal(22,2) DEFAULT NULL, + `fundamental_value` decimal(22,2) DEFAULT NULL, + `net_current_asset_value_per_share` decimal(22,2) DEFAULT NULL, + `roic_latest` decimal(22,2) DEFAULT NULL, + `sector` varchar(255) DEFAULT NULL, + `industry` varchar(255) DEFAULT NULL, + `debt_to_equity` decimal(22,2) DEFAULT NULL, + `sec_13` tinyint(1) DEFAULT NULL, + `sec_13_filing_date` datetime DEFAULT NULL, + `roc_latest` decimal(22,4) DEFAULT NULL, + `tlb_rank_roc` decimal(22,4) DEFAULT NULL, + `operating_earnings` decimal(22,4) DEFAULT NULL, + `am_rank` decimal(22,4) DEFAULT NULL, + `acquirers_multiple` decimal(22,4) DEFAULT NULL, + `dividend_yield` decimal(22,4) DEFAULT NULL, + `shares_outstanding` decimal(22,4) DEFAULT NULL, + `operating_cashflow` decimal(22,4) DEFAULT NULL, + PRIMARY KEY (`symbol`,`valuation_date`), + KEY `IX_VALUATIONS_DATE` (`valuation_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `valuations` +-- + +LOCK TABLES `valuations` WRITE; +/*!40000 ALTER TABLE `valuations` DISABLE KEYS */; +/*!40000 ALTER TABLE `valuations` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `yieldcurve` +-- + +DROP TABLE IF EXISTS `yieldcurve`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `yieldcurve` ( + `date` datetime NOT NULL, + `1Mo` decimal(19,2) DEFAULT NULL, + `3Mo` decimal(19,2) DEFAULT NULL, + `6Mo` decimal(19,2) DEFAULT NULL, + `1Yr` decimal(19,2) DEFAULT NULL, + `2Yr` decimal(19,2) DEFAULT NULL, + `3Yr` decimal(19,2) DEFAULT NULL, + `5Yr` decimal(19,2) DEFAULT NULL, + `7Yr` decimal(19,2) DEFAULT NULL, + `10Yr` decimal(19,2) DEFAULT NULL, + `20Yr` decimal(19,2) DEFAULT NULL, + `30Yr` decimal(19,2) DEFAULT NULL, + `modified` datetime DEFAULT NULL, + PRIMARY KEY (`date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `yieldcurve` +-- + +LOCK TABLES `yieldcurve` WRITE; +/*!40000 ALTER TABLE `yieldcurve` DISABLE KEYS */; +/*!40000 ALTER TABLE `yieldcurve` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `zacksrank` +-- + +DROP TABLE IF EXISTS `zacksrank`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `zacksrank` ( + `symbol` varchar(15) NOT NULL, + `date` datetime NOT NULL, + `zacks_rank` varchar(25) DEFAULT NULL, + `type` varchar(20) DEFAULT NULL, + PRIMARY KEY (`symbol`,`date`), + CONSTRAINT `FK_ZacksRank_SecurityMaster` FOREIGN KEY (`symbol`) REFERENCES `securitymaster` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `zacksrank` +-- + +LOCK TABLES `zacksrank` WRITE; +/*!40000 ALTER TABLE `zacksrank` DISABLE KEYS */; +/*!40000 ALTER TABLE `zacksrank` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Current Database: `portfolio_data` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `portfolio_data` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; + +USE `portfolio_data`; + +-- +-- 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) NOT NULL, + PRIMARY KEY (`account`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `accounts` +-- + +LOCK TABLES `accounts` WRITE; +/*!40000 ALTER TABLE `accounts` DISABLE KEYS */; +/*!40000 ALTER TABLE `accounts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) NOT NULL, + `date` datetime NOT NULL, + `description` varchar(255) 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=2006 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cash` +-- + +LOCK TABLES `cash` WRITE; +/*!40000 ALTER TABLE `cash` DISABLE KEYS */; +/*!40000 ALTER TABLE `cash` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) NOT NULL, + `payment_date` datetime NOT NULL, + `account` varchar(50) NOT NULL, + `amount` decimal(16,4) NOT NULL, + PRIMARY KEY (`symbol`,`payment_date`,`account`), + KEY `symbol` (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `dividends` +-- + +LOCK TABLES `dividends` WRITE; +/*!40000 ALTER TABLE `dividends` DISABLE KEYS */; +/*!40000 ALTER TABLE `dividends` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) NOT NULL, + `stop_limit` decimal(19,2) DEFAULT NULL, + `shares` decimal(19,2) DEFAULT NULL, + `stop_type` varchar(15) DEFAULT NULL, + `active` int DEFAULT NULL, + PRIMARY KEY (`symbol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stoplimits` +-- + +LOCK TABLES `stoplimits` WRITE; +/*!40000 ALTER TABLE `stoplimits` DISABLE KEYS */; +/*!40000 ALTER TABLE `stoplimits` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) NOT NULL, + `trade_date` datetime NOT NULL, + `shares` decimal(19,2) DEFAULT NULL, + `price` decimal(19,2) DEFAULT NULL, + `buysell` char(1) DEFAULT NULL, + `status` varchar(10) NOT NULL, + `account` varchar(25) 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=1026 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `trades` +-- + +LOCK TABLES `trades` WRITE; +/*!40000 ALTER TABLE `trades` DISABLE KEYS */; +/*!40000 ALTER TABLE `trades` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) 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_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `watchlist` +-- + +LOCK TABLES `watchlist` WRITE; +/*!40000 ALTER TABLE `watchlist` DISABLE KEYS */; +/*!40000 ALTER TABLE `watchlist` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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) 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_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `watchlists` +-- + +LOCK TABLES `watchlists` WRITE; +/*!40000 ALTER TABLE `watchlists` DISABLE KEYS */; +/*!40000 ALTER TABLE `watchlists` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Current Database: `user_data` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `user_data` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; + +USE `user_data`; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `users` ( + `username` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `salt` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `hash` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_by` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_on` datetime NOT NULL, + `modified_by` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `modified_on` datetime DEFAULT NULL, + PRIMARY KEY (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +/*!50606 SET GLOBAL INNODB_STATS_AUTO_RECALC=@OLD_INNODB_STATS_AUTO_RECALC */; + +/*!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 2025-03-29 12:11:09 diff --git a/Translate/translate.sh b/Translate/translate.sh index e56d6e5..5514968 100755 --- a/Translate/translate.sh +++ b/Translate/translate.sh @@ -1,4 +1,7 @@ #!/bin/bash cd /home/pi/ARM64/Translate/Translate/bin/Debug/net8.0 ./translate /mnt/mariadb/backupdb.sql /mnt/mariadb/backupdb2.sql +cd /mnt/mariadb +./restoredb.sh +