/*M!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19  Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: fondbevakning
-- ------------------------------------------------------
-- Server version	10.11.14-MariaDB-0ubuntu0.24.04.1

/*!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 */;
/*!40101 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 */;

--
-- Current Database: `fondbevakning`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `fondbevakning` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_swedish_ci */;

USE `fondbevakning`;

--
-- Table structure for table `fonder`
--

DROP TABLE IF EXISTS `fonder`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `fonder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `namn` varchar(255) NOT NULL,
  `isin` varchar(20) NOT NULL,
  `morningstar_id` varchar(50) DEFAULT NULL,
  `notis_troskel` decimal(5,2) DEFAULT 2.00,
  `aktiv` tinyint(1) DEFAULT 1,
  `skapad` timestamp NULL DEFAULT current_timestamp(),
  `valuta` varchar(10) DEFAULT 'SEK',
  PRIMARY KEY (`id`),
  UNIQUE KEY `isin` (`isin`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `fonder`
--

LOCK TABLES `fonder` WRITE;
/*!40000 ALTER TABLE `fonder` DISABLE KEYS */;
INSERT INTO `fonder` VALUES
(3,'cpr','LU1989766446','0P0001KRE9',2.00,1,'2026-06-16 18:57:29','USD'),
(8,'Avanza auto 6','SE0009779705',NULL,2.00,1,'2026-06-17 21:21:57','SEK'),
(9,'ap7 aktiefond','SE0003299999',NULL,2.00,1,'2026-06-18 08:49:32','SEK'),
(10,'Avanza Emergin Market','SE0012454338',NULL,2.00,1,'2026-06-18 08:50:19','SEK'),
(11,'Handelsbanken Global','SE0011309707',NULL,2.00,1,'2026-06-18 08:51:01','SEK'),
(12,'Handelsbanken USA','SE0004139780',NULL,2.00,1,'2026-06-18 08:51:47','SEK'),
(13,'Evli SIlver and gold','FI4000188982',NULL,2.00,1,'2026-06-18 08:55:57','SEK');
/*!40000 ALTER TABLE `fonder` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `installningar`
--

DROP TABLE IF EXISTS `installningar`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `installningar` (
  `nyckel` varchar(50) NOT NULL,
  `varde` varchar(255) NOT NULL,
  PRIMARY KEY (`nyckel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `installningar`
--

LOCK TABLES `installningar` WRITE;
/*!40000 ALTER TABLE `installningar` DISABLE KEYS */;
INSERT INTO `installningar` VALUES
('ntfy_token',''),
('ntfy_topic','fondbevakning'),
('ntfy_url','https://ntfy.engfeldt.nu');
/*!40000 ALTER TABLE `installningar` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `kurser`
--

DROP TABLE IF EXISTS `kurser`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `kurser` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fond_id` int(11) NOT NULL,
  `datum` date NOT NULL,
  `kurs` decimal(12,4) NOT NULL,
  `hamtad` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unik_kurs` (`fond_id`,`datum`),
  CONSTRAINT `kurser_ibfk_1` FOREIGN KEY (`fond_id`) REFERENCES `fonder` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=138 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `kurser`
--

LOCK TABLES `kurser` WRITE;
/*!40000 ALTER TABLE `kurser` DISABLE KEYS */;
INSERT INTO `kurser` VALUES
(4,8,'2026-06-17',254.1800,'2026-06-17 21:22:09'),
(10,8,'2026-06-18',253.2200,'2026-06-18 08:28:28'),
(15,9,'2026-06-18',925.1100,'2026-06-18 08:51:51'),
(16,10,'2026-06-18',196.4900,'2026-06-18 08:51:52'),
(17,11,'2026-06-18',687.1500,'2026-06-18 08:51:52'),
(18,12,'2026-06-18',1129.9200,'2026-06-18 08:51:53'),
(25,13,'2026-06-18',1168.7300,'2026-06-18 08:56:06'),
(40,3,'2026-06-18',2115.4176,'2026-06-18 09:15:20'),
(61,3,'2026-06-19',2058.7520,'2026-06-19 08:57:02'),
(62,8,'2026-06-19',252.1100,'2026-06-19 08:57:03'),
(63,9,'2026-06-19',922.3700,'2026-06-19 08:57:04'),
(64,10,'2026-06-19',198.0000,'2026-06-19 08:57:04'),
(65,11,'2026-06-19',698.3700,'2026-06-19 08:57:05'),
(66,12,'2026-06-19',1147.2700,'2026-06-19 08:57:05'),
(67,13,'2026-06-19',1142.6700,'2026-06-19 08:57:06'),
(68,3,'2026-06-21',2009.5078,'2026-06-21 14:19:19'),
(69,8,'2026-06-21',252.1100,'2026-06-21 14:19:20'),
(70,9,'2026-06-21',922.3700,'2026-06-21 14:19:20'),
(71,10,'2026-06-21',198.0000,'2026-06-21 14:19:21'),
(72,11,'2026-06-21',698.3700,'2026-06-21 14:19:21'),
(73,12,'2026-06-21',1147.2700,'2026-06-21 14:19:22'),
(74,13,'2026-06-21',1142.6700,'2026-06-21 14:19:22'),
(89,3,'2026-06-22',2019.3517,'2026-06-22 19:14:53'),
(90,8,'2026-06-22',252.1100,'2026-06-22 19:14:54'),
(91,9,'2026-06-22',922.3700,'2026-06-22 19:14:54'),
(92,10,'2026-06-22',198.0000,'2026-06-22 19:14:55'),
(93,11,'2026-06-22',698.3700,'2026-06-22 19:14:56'),
(94,12,'2026-06-22',1147.2700,'2026-06-22 19:14:57'),
(95,13,'2026-06-22',1142.6700,'2026-06-22 19:14:57'),
(96,3,'2026-06-23',2043.6360,'2026-06-23 17:16:09'),
(97,8,'2026-06-23',252.1100,'2026-06-23 17:16:10'),
(98,9,'2026-06-23',922.3700,'2026-06-23 17:16:10'),
(99,10,'2026-06-23',198.0000,'2026-06-23 17:16:11'),
(100,11,'2026-06-23',698.3700,'2026-06-23 17:16:11'),
(101,12,'2026-06-23',1147.2700,'2026-06-23 17:16:12'),
(102,13,'2026-06-23',1142.6700,'2026-06-23 17:16:12'),
(103,3,'2026-06-26',1841.3972,'2026-06-26 03:50:16'),
(104,8,'2026-06-26',256.5700,'2026-06-26 03:50:24'),
(105,9,'2026-06-26',944.0800,'2026-06-26 03:50:25'),
(106,10,'2026-06-26',199.7800,'2026-06-26 03:50:26'),
(107,11,'2026-06-26',700.4500,'2026-06-26 03:50:27'),
(108,12,'2026-06-26',1144.8800,'2026-06-26 03:50:28'),
(109,13,'2026-06-26',1015.2000,'2026-06-26 03:50:28'),
(110,3,'2026-06-27',1857.4781,'2026-06-27 19:14:29'),
(111,8,'2026-06-27',256.8000,'2026-06-27 19:14:30'),
(112,9,'2026-06-27',943.9100,'2026-06-27 19:14:31'),
(113,10,'2026-06-27',201.5600,'2026-06-27 19:14:32'),
(114,11,'2026-06-27',692.7400,'2026-06-27 19:14:32'),
(115,12,'2026-06-27',1139.6400,'2026-06-27 19:14:33'),
(116,13,'2026-06-27',1032.8700,'2026-06-27 19:14:34'),
(117,3,'2026-06-29',1856.1234,'2026-06-29 10:44:39'),
(118,8,'2026-06-29',256.8000,'2026-06-29 10:44:40'),
(119,9,'2026-06-29',943.9100,'2026-06-29 10:44:41'),
(120,10,'2026-06-29',201.5600,'2026-06-29 10:44:41'),
(121,11,'2026-06-29',692.7400,'2026-06-29 10:44:42'),
(122,12,'2026-06-29',1139.6400,'2026-06-29 10:44:43'),
(123,13,'2026-06-29',1032.8700,'2026-06-29 10:44:43'),
(124,3,'2026-07-01',1877.4283,'2026-07-01 15:26:09'),
(125,8,'2026-07-01',257.4700,'2026-07-01 15:26:10'),
(126,9,'2026-07-01',946.7900,'2026-07-01 15:26:11'),
(127,10,'2026-07-01',196.2300,'2026-07-01 15:26:12'),
(128,11,'2026-07-01',699.5200,'2026-07-01 15:26:13'),
(129,12,'2026-07-01',1151.8100,'2026-07-01 15:26:14'),
(130,13,'2026-07-01',1036.3000,'2026-07-01 15:26:15'),
(131,3,'2026-07-06',1934.3901,'2026-07-06 15:19:49'),
(132,8,'2026-07-06',258.3700,'2026-07-06 15:19:50'),
(133,9,'2026-07-06',945.7600,'2026-07-06 15:19:50'),
(134,10,'2026-07-06',192.3900,'2026-07-06 15:19:51'),
(135,11,'2026-07-06',704.6600,'2026-07-06 15:19:52'),
(136,12,'2026-07-06',1166.2700,'2026-07-06 15:19:53'),
(137,13,'2026-07-06',1078.0800,'2026-07-06 15:19:53');
/*!40000 ALTER TABLE `kurser` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `notiser`
--

DROP TABLE IF EXISTS `notiser`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `notiser` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fond_id` int(11) NOT NULL,
  `meddelande` text NOT NULL,
  `skickad` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fond_id` (`fond_id`),
  CONSTRAINT `notiser_ibfk_1` FOREIGN KEY (`fond_id`) REFERENCES `fonder` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `notiser`
--

LOCK TABLES `notiser` WRITE;
/*!40000 ALTER TABLE `notiser` DISABLE KEYS */;
INSERT INTO `notiser` VALUES
(1,3,'cpr\n+2.00% (216.4100 → 220.7400)','2026-06-18 08:28:28'),
(2,3,'cpr\n+2.00% (216.4100 → 220.7400)','2026-06-18 08:43:26'),
(3,3,'cpr\n+2.00% (216.4100 → 220.7400)','2026-06-18 08:51:50'),
(4,3,'cpr\n+2.00% (216.4100 → 220.7400)','2026-06-18 08:56:03'),
(5,3,'cpr\n+2.00% (216.4100 → 220.7400)','2026-06-18 09:02:38'),
(6,3,'cpr\n+875.22% (216.4100 → 2110.4731)','2026-06-18 09:13:29'),
(7,3,'cpr\n-2.68% (2115.4176 → 2058.7520)','2026-06-19 08:57:03'),
(8,13,'Evli SIlver and gold\n-2.23% (1168.7300 → 1142.6700)','2026-06-19 08:57:06'),
(9,3,'cpr\n-2.39% (2058.7520 → 2009.5078)','2026-06-21 14:19:19'),
(10,3,'cpr\n-2.39% (2058.7520 → 2009.5078)','2026-06-21 17:21:20'),
(11,3,'cpr\n-2.39% (2058.7520 → 2009.5078)','2026-06-21 19:32:03'),
(12,3,'cpr\n-9.90% (2043.6360 → 1841.3972)','2026-06-26 03:50:22'),
(13,9,'ap7 aktiefond\n+2.35% (922.3700 → 944.0800)','2026-06-26 03:50:26'),
(14,13,'Evli SIlver and gold\n-11.16% (1142.6700 → 1015.2000)','2026-06-26 03:50:29'),
(15,10,'Avanza Emergin Market\n-2.64% (201.5600 → 196.2300)','2026-07-01 15:26:12'),
(16,3,'cpr\n+3.03% (1877.4283 → 1934.3901)','2026-07-06 15:19:49'),
(17,13,'Evli SIlver and gold\n+4.03% (1036.3000 → 1078.0800)','2026-07-06 15:19:53');
/*!40000 ALTER TABLE `notiser` ENABLE KEYS */;
UNLOCK TABLES;
/*!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 2026-07-13  0:00:02
