From 59003788a7c9532793b6cb33500617261795e04a Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 23 Oct 2018 07:02:49 -0400 Subject: [PATCH] Add comments table --- includes/schema.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/schema.php b/includes/schema.php index e72c0db..346aa3c 100644 --- a/includes/schema.php +++ b/includes/schema.php @@ -15,6 +15,7 @@ function run_migrations() { return; } apply_migration( '0.0.1', 'migration_0_0_1' ); + apply_migration( '1.1.0', 'migration_1_1_0' ); update_option( 'pterotype_previously_migrated_version', PTEROTYPE_VERSION ); } @@ -177,4 +178,21 @@ function migration_0_0_1() { " ); } + +function migration_1_1_0() { + $wpdb->query( + " + CREATE TABLE {$wpdb->prefix}pterotype_comments ( + comment_id BIGINT(20) UNSIGNED NOT NULL, + object_id INT UNSIGNED NOT NULL, + PRIMARY KEY (comment_id, object_id), + FOREIGN KEY pt_comments_comment_fk(comment_id) + REFERENCES {$wpdb->comments}(comment_ID), + FOREIGN KEY pt_comments_object_fk(object_id) + references {$wpdb->prefix}pterotype_objects(id) + ) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + " + ); +} ?>