Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
- START TRANSACTION;
- SET time_zone = "+00:00";
- --
- -- Database: `homeassistant`
- --
- -- --------------------------------------------------------
- --
- -- Struktur-dump for tabellen `events`
- --
- -- --------------------------------------------------------
- CREATE TABLE `events` (
- `event_id` int(11) NOT NULL,
- `event_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `event_data` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `origin` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `origin_idx` smallint(6) DEFAULT NULL,
- `time_fired` datetime(6) DEFAULT NULL,
- `context_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `context_user_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `context_parent_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `data_id` int(11) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Begrænsninger for dumpede tabeller
- --
- --
- -- Indeks for tabel `events`
- --
- ALTER TABLE `events`
- ADD PRIMARY KEY (`event_id`),
- ADD KEY `ix_events_time_fired` (`time_fired`),
- ADD KEY `ix_events_data_id` (`data_id`),
- ADD KEY `ix_events_event_type_time_fired` (`event_type`,`time_fired`),
- ADD KEY `ix_events_context_id` (`context_id`);
- --
- -- Brug ikke AUTO_INCREMENT for slettede tabeller
- --
- --
- -- Tilføj AUTO_INCREMENT i tabel `events`
- --
- ALTER TABLE `events`
- MODIFY `event_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- Begrænsninger for dumpede tabeller
- --
- --
- -- Begrænsninger for tabel `events`
- --
- ALTER TABLE `events`
- ADD CONSTRAINT `events_ibfk_1` FOREIGN KEY (`data_id`) REFERENCES `event_data` (`data_id`);
- COMMIT;
- -- phpMyAdmin SQL Dump
- -- version 5.2.0
- -- https://www.phpmyadmin.net/
- --
- -- Vært: core-mariadb:3306
- -- Genereringstid: 07. 10 2022 kl. 12:24:56
- -- Serverversion: 10.6.8-MariaDB
- -- PHP-version: 8.0.21
- -- --------------------------------------------------------
- --
- -- Struktur-dump for tabellen `states`
- --
- -- --------------------------------------------------------
- CREATE TABLE `states` (
- `state_id` int(11) NOT NULL,
- `entity_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `attributes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `event_id` int(11) DEFAULT NULL,
- `last_changed` datetime(6) DEFAULT NULL,
- `last_updated` datetime(6) DEFAULT NULL,
- `old_state_id` int(11) DEFAULT NULL,
- `attributes_id` int(11) DEFAULT NULL,
- `context_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `context_user_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `context_parent_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `origin_idx` smallint(6) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Begrænsninger for dumpede tabeller
- --
- --
- -- Indeks for tabel `states`
- --
- ALTER TABLE `states`
- ADD PRIMARY KEY (`state_id`),
- ADD KEY `ix_states_entity_id_last_updated` (`entity_id`,`last_updated`),
- ADD KEY `ix_states_attributes_id` (`attributes_id`),
- ADD KEY `ix_states_old_state_id` (`old_state_id`),
- ADD KEY `ix_states_event_id` (`event_id`),
- ADD KEY `ix_states_last_updated` (`last_updated`),
- ADD KEY `ix_states_context_id` (`context_id`);
- --
- -- Brug ikke AUTO_INCREMENT for slettede tabeller
- --
- --
- -- Tilføj AUTO_INCREMENT i tabel `states`
- --
- ALTER TABLE `states`
- MODIFY `state_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- Begrænsninger for dumpede tabeller
- --
- --
- -- Begrænsninger for tabel `states`
- --
- ALTER TABLE `states`
- ADD CONSTRAINT `states_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE,
- ADD CONSTRAINT `states_ibfk_2` FOREIGN KEY (`old_state_id`) REFERENCES `states` (`state_id`),
- ADD CONSTRAINT `states_ibfk_3` FOREIGN KEY (`attributes_id`) REFERENCES `state_attributes` (`attributes_id`);
- COMMIT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement