Add comments table

This commit is contained in:
Jeremy Dormitzer 2018-10-23 07:02:49 -04:00
parent bd686447a3
commit 59003788a7

View File

@ -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;
"
);
}
?>