2 of 2 edited tags; edited title

How to Create database table when Plugin installed/activated, and delete database when Plugin deleted

I am trying to create new WordPress plugin with object oriented programming.I want to create database when plugin activation and delete database when plugin deleting.Below is my code its not working for me.I have two files one is main plugin file other one is plugin functions included files.

main file code as below:

Plugin Name: Test Reviews1
Plugin URI: https://test.in/
Description: This Test Plugin. 
Version: 1.0 
Author: Test 
Author URI: https://test.in/ 
License: GPLv2 or later 

    new test_plugin();
    class test_plugin{

        public function __construct(){

            $this->plugin_dir = plugins_url( '' , __FILE__ );
            $this->security = new hidemysite_security();



include file code as below:

class hidemysite_security{

 public function __construct() {
  if (is_admin()) {
    register_activation_hook(__FILE__, array(&$this, 'activate'));
      register_deactivation_hook( __FILE__, 'my_plugin_remove_database' );


public function activate() {
  global $wpdb;
  $table = $wpdb->prefix . 'md_things';
  $charset = $wpdb->get_charset_collate();
    $charset_collate = $wpdb->get_charset_collate();
    $sql = "CREATE TABLE $table (
        id mediumint(9) NOT NULL AUTO_INCREMENT,
        time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
        name tinytext NOT NULL,
        text text NOT NULL,
        url varchar(55) DEFAULT '' NOT NULL,
        PRIMARY KEY  (id)
    ) $charset_collate;";

    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta( $sql );

public function my_plugin_remove_database() {
     global $wpdb;
     $table_name = $wpdb->prefix . 'md_things';
     $sql = "DROP TABLE IF EXISTS $table_name";

Could You Please Help Me ?