<?php

namespace WoWPress\Database;

class CreateTable
{

    public static $table_name = "_tblname";
    public static $own_prefix = "wowpress_";
    public static $fields = [];

    public static function sql()
    {
        global $wpdb;
        $charset_collate = $wpdb->get_charset_collate();
        $table_name = $wpdb->prefix . static::$own_prefix . static::$table_name;
        $sql =  "CREATE TABLE $table_name (
            ID mediumint(9) NOT NULL AUTO_INCREMENT,
            ";
        foreach(static::$fields as $field => $options){
            $sql .= $field." ".$options.",
            ";
        }
        $sql .= "PRIMARY KEY  (ID)
        ) $charset_collate;";


        return $sql;
    }
}


