-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema: Add dependency additions #795
base: main
Are you sure you want to change the base?
Changes from all commits
0ca6839
e81e860
8206e62
dbd05f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
CREATE TABLE `dependency` ( | ||
`id` binary(20) NOT NULL, | ||
`name` text NOT NULL, | ||
`display_name` text NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; | ||
|
||
CREATE TABLE `dependency_state` ( | ||
`id` binary(20) NOT NULL, | ||
`dependency_id` binary(20) NOT NULL, | ||
`failed` enum('n', 'y') NOT NULL, | ||
UNIQUE INDEX `dependency_state_dependency_id_uindex` (dependency_id), | ||
KEY `dependency_state_dependency_id_fk` (`dependency_id`), | ||
CONSTRAINT `dependency_state_dependency_id_fk` FOREIGN KEY (`dependency_id`) REFERENCES `dependency` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; | ||
|
||
CREATE TABLE `redundancy_group` ( | ||
`id` binary(20) NOT NULL, | ||
`name` text NOT NULL, | ||
`display_name` text NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; | ||
|
||
CREATE TABLE `redundancy_group_state` ( | ||
`id` binary(20) NOT NULL, | ||
`redundancy_group_id` binary(20) NOT NULL, | ||
`failed` enum('n', 'y') NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that now it's there twice. Please refer to my other comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems I mixed things up here a bit. |
||
`last_state_change` bigint unsigned NOT NULL, | ||
UNIQUE INDEX `redundancy_group_state_redundancy_group_id_uindex` (redundancy_group_id), | ||
KEY `redundancy_group_state_redundancy_group_id_fk` (`redundancy_group_id`), | ||
CONSTRAINT `redundancy_group_state_redundancy_group_id_fk` FOREIGN KEY (`redundancy_group_id`) REFERENCES `redundancy_group` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; | ||
|
||
CREATE TABLE `dependency_node` ( | ||
`id` binary(20) NOT NULL, | ||
`host_id` binary(20) DEFAULT NULL, | ||
`service_id` binary(20) DEFAULT NULL, | ||
`redundancy_group_id` binary(20) DEFAULT NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `dependency_node_host_id_service_id_uindex` (`host_id`,`service_id`), | ||
KEY `dependency_node_redundancy_group_id_fk` (`redundancy_group_id`), | ||
KEY `dependency_node_service_id_fk` (`service_id`), | ||
CONSTRAINT `dependency_node_host_id_fk` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`), | ||
CONSTRAINT `dependency_node_redundancy_group_id_fk` FOREIGN KEY (`redundancy_group_id`) REFERENCES `redundancy_group` (`id`), | ||
CONSTRAINT `dependency_node_service_id_fk` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; | ||
|
||
CREATE TABLE `dependency_edge` ( | ||
`to_node_id` binary(20) NOT NULL, | ||
`from_node_id` binary(20) NOT NULL, | ||
`dependency_id` binary(20) DEFAULT NULL, | ||
UNIQUE KEY `dependency_edge_to_node_id_from_node_id_uindex` (`to_node_id`,`from_node_id`), | ||
KEY `dependency_edge_dependency_node_id_fk_2` (`from_node_id`), | ||
KEY `dependency_edge_dependency_id_fk` (`dependency_id`), | ||
CONSTRAINT `dependency_edge_dependency_id_fk` FOREIGN KEY (`dependency_id`) REFERENCES `dependency` (`id`), | ||
CONSTRAINT `dependency_edge_dependency_node_id_fk` FOREIGN KEY (`to_node_id`) REFERENCES `dependency_node` (`id`), | ||
CONSTRAINT `dependency_edge_dependency_node_id_fk_2` FOREIGN KEY (`from_node_id`) REFERENCES `dependency_node` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,2 @@ | ||||
alter table redundancy_group_state | ||||
add last_state_change bigint unsigned not null; | ||||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Unless I am missing something, it is already there. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ALTER TABLE host | ||
ADD COLUMN affected_children int unsigned DEFAULT NULL AFTER check_retry_interval; | ||
|
||
ALTER TABLE host_state | ||
ADD COLUMN affects_children enum('n', 'y') NOT NULL DEFAULT 'n' AFTER in_downtime; | ||
|
||
ALTER TABLE service | ||
ADD COLUMN affected_children int unsigned DEFAULT NULL AFTER check_retry_interval; | ||
|
||
ALTER TABLE service_state | ||
ADD COLUMN affects_children enum('n', 'y') NOT NULL DEFAULT 'n' AFTER in_downtime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my testing, I have added the environment ID as
environment_id BINARY(20) NOT NULL
to most tables.