From 9b8052149aeac9a62e2077f6cd18866246d3b597 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 2 Jan 2026 17:53:59 -0500 Subject: [PATCH] Saving these SQL export examples. --- ...ther_dev__account__2026-01-02_22_20_47.sql | 104 +++++++++++ ...ther_dev__journal__2026-01-02_22_18_03.sql | 138 +++++++++++++++ ...ev__journal_entry__2026-01-02_22_19_31.sql | 166 ++++++++++++++++++ 3 files changed, 408 insertions(+) create mode 100644 documentation/aether_dev__account__2026-01-02_22_20_47.sql create mode 100644 documentation/aether_dev__journal__2026-01-02_22_18_03.sql create mode 100644 documentation/aether_dev__journal_entry__2026-01-02_22_19_31.sql diff --git a/documentation/aether_dev__account__2026-01-02_22_20_47.sql b/documentation/aether_dev__account__2026-01-02_22_20_47.sql new file mode 100644 index 0000000..00c70ee --- /dev/null +++ b/documentation/aether_dev__account__2026-01-02_22_20_47.sql @@ -0,0 +1,104 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.3 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Jan 02, 2026 at 10:20 PM +-- Server version: 12.1.2-MariaDB-log +-- PHP Version: 8.4.15 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!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 */; + +-- +-- Database: `aether_dev` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `account` +-- + +CREATE TABLE `account` ( + `id` int(11) NOT NULL, + `id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, + `code` varchar(50) DEFAULT NULL, + `name` varchar(200) DEFAULT NULL, + `short_name` varchar(20) DEFAULT NULL, + `description` text DEFAULT NULL, + `enable` tinyint(1) NOT NULL DEFAULT 0, + `enable_from` datetime DEFAULT NULL, + `enable_to` datetime DEFAULT NULL, + `notes` text DEFAULT NULL, + `created_on` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Triggers `account` +-- +DELIMITER $$ +CREATE TRIGGER `before_insert_account` BEFORE INSERT ON `account` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + /* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_str(11, 'URL'); + END IF; + END; +END +$$ +DELIMITER ; +DELIMITER $$ +CREATE TRIGGER `before_update_account` BEFORE UPDATE ON `account` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + /* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_str(11, 'URL'); + END IF; + END; +END +$$ +DELIMITER ; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `account` +-- +ALTER TABLE `account` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id_random` (`id_random`), + ADD UNIQUE KEY `code` (`code`), + ADD KEY `enable` (`enable`), + ADD KEY `name` (`name`), + ADD KEY `created_on` (`created_on`), + ADD KEY `updated_on` (`updated_on`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `account` +-- +ALTER TABLE `account` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +COMMIT; + +/*!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 */; diff --git a/documentation/aether_dev__journal__2026-01-02_22_18_03.sql b/documentation/aether_dev__journal__2026-01-02_22_18_03.sql new file mode 100644 index 0000000..5bf5098 --- /dev/null +++ b/documentation/aether_dev__journal__2026-01-02_22_18_03.sql @@ -0,0 +1,138 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.3 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Jan 02, 2026 at 10:18 PM +-- Server version: 12.1.2-MariaDB-log +-- PHP Version: 8.4.15 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!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 */; + +-- +-- Database: `aether_dev` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `journal` +-- + +CREATE TABLE `journal` ( + `id` int(11) NOT NULL, + `id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, + `account_id` int(11) DEFAULT NULL, + `person_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `type_code` varchar(25) DEFAULT NULL, + `default_private` tinyint(1) DEFAULT NULL COMMENT 'default to private', + `default_public` tinyint(1) DEFAULT NULL COMMENT 'default to public', + `default_personal` tinyint(1) DEFAULT NULL COMMENT 'default to personal', + `default_professional` tinyint(1) DEFAULT NULL COMMENT 'default to professional', + `private_passcode` varchar(20) DEFAULT NULL COMMENT 'passcode to show private entries', + `public_passcode` varchar(20) DEFAULT NULL COMMENT 'passcode to show only public entries', + `name` varchar(250) NOT NULL, + `short_name` varchar(25) DEFAULT NULL, + `summary` text DEFAULT NULL, + `outline` text DEFAULT NULL, + `description` text DEFAULT NULL, + `description_html` text DEFAULT NULL, + `description_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`description_json`)), + `alert` tinyint(1) DEFAULT NULL, + `alert_msg` text DEFAULT NULL, + `allow_auth` tinyint(1) NOT NULL DEFAULT 0, + `auth_key` varchar(25) DEFAULT NULL, + `passcode` varchar(25) DEFAULT NULL, + `passcode_timeout` int(11) NOT NULL DEFAULT 300 COMMENT 'in seconds', + `cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`cfg_json`)), + `data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)), + `enable` tinyint(1) NOT NULL DEFAULT 1, + `hide` tinyint(1) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `archive_on` datetime DEFAULT NULL, + `archive` tinyint(1) DEFAULT NULL, + `priority` tinyint(1) DEFAULT NULL, + `sort` int(11) DEFAULT NULL, + `group` varchar(100) DEFAULT NULL, + `notes` text DEFAULT NULL, + `created_on` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Triggers `journal` +-- +DELIMITER $$ +CREATE TRIGGER `before_insert_journal` BEFORE INSERT ON `journal` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); + /* SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); */ + /* SET NEW.id_random = gen_rand_str(11, 'URL'); */ + END IF; + + /* SET NEW.default_qry_str = journal_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.description); */ + END; +END +$$ +DELIMITER ; +DELIMITER $$ +CREATE TRIGGER `before_update_journal` BEFORE UPDATE ON `journal` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); + /* SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); */ + /* SET NEW.id_random = gen_rand_str(11, 'URL'); */ + END IF; + + /* SET NEW.default_qry_str = journal_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.description); */ + END; +END +$$ +DELIMITER ; +DELIMITER $$ +CREATE TRIGGER `journal_after_delete` AFTER DELETE ON `journal` FOR EACH ROW BEGIN + DELETE FROM journal_entry WHERE journal_entry.journal_id = OLD.id; +END +$$ +DELIMITER ; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `journal` +-- +ALTER TABLE `journal` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id_random` (`id_random`), + ADD KEY `account_id` (`account_id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `journal` +-- +ALTER TABLE `journal` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +COMMIT; + +/*!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 */; diff --git a/documentation/aether_dev__journal_entry__2026-01-02_22_19_31.sql b/documentation/aether_dev__journal_entry__2026-01-02_22_19_31.sql new file mode 100644 index 0000000..b8363e3 --- /dev/null +++ b/documentation/aether_dev__journal_entry__2026-01-02_22_19_31.sql @@ -0,0 +1,166 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.3 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Jan 02, 2026 at 10:19 PM +-- Server version: 12.1.2-MariaDB-log +-- PHP Version: 8.4.15 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!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 */; + +-- +-- Database: `aether_dev` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `journal_entry` +-- + +CREATE TABLE `journal_entry` ( + `id` int(11) NOT NULL, + `id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, + `journal_id` int(11) NOT NULL, + `code` varchar(20) DEFAULT NULL, + `lu_type_id` int(11) DEFAULT NULL, + `type` varchar(50) DEFAULT NULL, + `topic_id` int(11) DEFAULT NULL, + `topic` varchar(50) DEFAULT NULL, + `activity_id` int(11) DEFAULT NULL, + `activity` varchar(50) DEFAULT NULL, + `private` tinyint(1) DEFAULT NULL COMMENT 'implies encryption if possible', + `public` tinyint(1) DEFAULT NULL, + `personal` tinyint(1) DEFAULT NULL, + `professional` tinyint(1) DEFAULT NULL, + `name` varchar(250) DEFAULT NULL, + `short_name` varchar(25) DEFAULT NULL, + `summary` text DEFAULT NULL, + `content` text DEFAULT NULL, + `content_html` text DEFAULT NULL, + `content_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`content_json`)), + `content_encrypted` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `history` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'content history', + `history_encrypted` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'content history encrypted', + `passcode_hash` varchar(64) DEFAULT NULL COMMENT 'to match with index', + `template` tinyint(1) DEFAULT NULL COMMENT 'use as template entry', + `type_code` varchar(25) DEFAULT NULL, + `topic_code` varchar(25) DEFAULT NULL, + `category_code` varchar(25) DEFAULT NULL, + `tags` varchar(255) DEFAULT NULL COMMENT 'comma delimited list', + `start_datetime` datetime DEFAULT NULL, + `end_datetime` datetime DEFAULT NULL, + `seconds` int(11) DEFAULT NULL, + `hours` decimal(3,2) DEFAULT NULL, + `timezone` varchar(50) DEFAULT NULL, + `location` text DEFAULT NULL COMMENT 'probably an address', + `latitude` float DEFAULT NULL, + `longitude` float DEFAULT NULL, + `billable` tinyint(1) DEFAULT 0, + `billable_to_id` int(11) DEFAULT NULL, + `billiable_to` varchar(100) DEFAULT NULL, + `alert` tinyint(1) DEFAULT NULL, + `alert_msg` text DEFAULT NULL, + `data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)), + `enable` tinyint(1) NOT NULL DEFAULT 1, + `hide` tinyint(1) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `archive_on` datetime DEFAULT NULL, + `archive` tinyint(1) DEFAULT NULL, + `priority` tinyint(1) DEFAULT NULL, + `sort` int(11) DEFAULT NULL, + `group` varchar(100) DEFAULT NULL, + `default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches', + `notes` text DEFAULT NULL, + `created_on` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Triggers `journal_entry` +-- +DELIMITER $$ +CREATE TRIGGER `before_insert_journal_entry` BEFORE INSERT ON `journal_entry` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + /* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); + /* SET NEW.id_random = gen_rand_str(11, 'URL'); */ + END IF; + + SET NEW.default_qry_str = journal_entry_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.content, NEW.history, NEW.category_code, NEW.tags, NEW.alert_msg, NEW.data_json); + END; +END +$$ +DELIMITER ; +DELIMITER $$ +CREATE TRIGGER `before_update_journal_entry` BEFORE UPDATE ON `journal_entry` FOR EACH ROW BEGIN + BEGIN + IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6) + THEN + /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */ + /* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */ + SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); + /* SET NEW.id_random = gen_rand_str(11, 'URL'); */ + END IF; + + SET NEW.default_qry_str = journal_entry_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.content, NEW.history, NEW.category_code, NEW.tags, NEW.alert_msg, NEW.data_json); + END; +END +$$ +DELIMITER ; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `journal_entry` +-- +ALTER TABLE `journal_entry` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id_random` (`id_random`), + ADD KEY `journal_id` (`journal_id`), + ADD KEY `tags` (`tags`), + ADD KEY `enable` (`enable`), + ADD KEY `hide` (`hide`), + ADD KEY `status` (`status`), + ADD KEY `priority` (`priority`), + ADD KEY `archive` (`archive`), + ADD KEY `sort` (`sort`), + ADD KEY `group` (`group`), + ADD KEY `created_on` (`created_on`), + ADD KEY `updated_on` (`updated_on`), + ADD KEY `start_datetime` (`start_datetime`), + ADD KEY `private` (`private`), + ADD KEY `public` (`public`), + ADD KEY `personal` (`personal`), + ADD KEY `professional` (`professional`), + ADD KEY `name` (`name`); +ALTER TABLE `journal_entry` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `journal_entry` +-- +ALTER TABLE `journal_entry` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +COMMIT; + +/*!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 */;