Created
May 30, 2021 21:41
-
-
Save jeff-pal/5da82902d6ecf7716cd8af304df9da67 to your computer and use it in GitHub Desktop.
This is a sql query for create a table in WordPress environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS wp_chart_teams ( | |
id bigint(20) NOT NULL AUTO_INCREMENT, | |
name varchar(255) NOT NULL, | |
emoji varchar(255) NOT NULL, | |
parent_id bigint(20), | |
user_id bigint(20) unsigned NOT NULL, | |
UNIQUE(id), | |
PRIMARY KEY (id) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; | |
ALTER TABLE wp_chart_teams | |
ADD CONSTRAINT fk_parent_id | |
FOREIGN KEY (parent_id) | |
REFERENCES wp_chart_teams(id) | |
ON DELETE CASCADE; | |
ALTER TABLE wp_chart_teams | |
ADD CONSTRAINT fk_user_id | |
FOREIGN KEY (user_id) | |
REFERENCES wp_users(ID) | |
ON DELETE CASCADE; | |
INSERT INTO `wp_chart_teams`(id, name,emoji,parent_id, user_id) VALUES | |
(1, 'Rusty Corp.', '\\ud83d\\udc15', null, 1), | |
(2, 'Food', '\\ud83e\\udd69', 1, 1), | |
(3, 'Canine Therapy', '\\ud83d\\ude0c', 1, 1), | |
(4, 'Massages', '\\ud83d\\udc86', 3, 1), | |
(5, 'Games', '\\ud83c\\udfbe', 3, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment