--
-- Host: localhost    Database: anteckningar
-- ------------------------------------------------------


--
-- Current Database: `anteckningar`
--

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

USE `anteckningar`;

--
-- Table structure for table `checklist_items`
--

CREATE TABLE `checklist_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `note_id` int(11) NOT NULL,
  `text` varchar(500) NOT NULL DEFAULT '',
  `checked` tinyint(1) NOT NULL DEFAULT 0,
  `position` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_items_note` (`note_id`),
  CONSTRAINT `fk_note` FOREIGN KEY (`note_id`) REFERENCES `notes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `checklist_items`
--

INSERT INTO `checklist_items` VALUES
(1,1,'testa servern',0,0),
(2,1,'kolla att mail fungerar',1,1),
(3,1,'kolla så totp fungerar',1,2);

--
-- Table structure for table `login_logs`
--

CREATE TABLE `login_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(60) NOT NULL,
  `ip` varchar(45) NOT NULL,
  `success` tinyint(1) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_loginlogs_lookup` (`username`,`ip`,`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `login_logs`
--

INSERT INTO `login_logs` VALUES
(1,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 09:47:26'),
(2,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:12:48'),
(3,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:12:55'),
(4,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:24:20'),
(5,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:42:19'),
(6,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:54:16'),
(7,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 10:54:24'),
(8,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:04:58'),
(9,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:42:33'),
(10,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:42:44'),
(11,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:43:52'),
(12,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:44:06'),
(13,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:52:19'),
(14,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:52:27'),
(15,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:53:16'),
(16,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 11:53:23'),
(17,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:04:50'),
(18,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:05:00'),
(19,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:06:11'),
(20,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:13:48'),
(21,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:14:52'),
(22,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:19:29'),
(23,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 12:19:36'),
(24,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 17:03:39'),
(25,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 17:04:35'),
(26,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 17:04:55'),
(27,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 17:38:30'),
(28,'Hans Engfeldt','192.168.1.207',1,'2026-07-30 17:38:39'),
(29,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:38:10'),
(30,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:38:18'),
(31,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:52:47'),
(32,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:52:55'),
(33,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:54:21'),
(34,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:54:34'),
(35,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:57:33'),
(36,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 10:57:39'),
(37,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 11:03:24'),
(38,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 11:03:37'),
(39,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 11:06:17'),
(40,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 11:06:24'),
(41,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 12:10:42'),
(42,'Hans Engfeldt','192.168.1.207',1,'2026-07-31 12:10:53');

--
-- Table structure for table `notes`
--

CREATE TABLE `notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL DEFAULT '',
  `content` mediumtext DEFAULT NULL,
  `type` enum('text','checklist') NOT NULL DEFAULT 'text',
  `color` varchar(20) NOT NULL DEFAULT 'default',
  `pinned` tinyint(1) NOT NULL DEFAULT 0,
  `archived` tinyint(1) NOT NULL DEFAULT 0,
  `position` int(11) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_notes_user_archived` (`user_id`,`archived`),
  CONSTRAINT `fk_notes_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `notes`
--

INSERT INTO `notes` VALUES
(1,1,'Test',NULL,'checklist','green',0,0,0,'2026-07-30 09:42:09','2026-07-31 11:13:48'),
(2,1,'coop ej med i listan','coop som ej är med i listan\nabc123\ndea002\nweb80d','text','pink',0,0,0,'2026-07-30 10:10:25','2026-07-31 12:12:51'),
(3,1,'Mywallet','9f61dbbabf0069cfebe1631fe14a2bcd415e3d44d186306a96d57d89fdd709c2','text','default',0,0,0,'2026-07-30 12:06:55','2026-07-30 12:06:55');


