Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
4.1 kB
3
Indexable
Never
// create a mysql database named decoy.
var mysql = require('mysql');
var connection = mysql.createConnection({
    host     : 'localhost',
    port     : '3306',
    user     : 'isa',
    password : 'xxx123',
    database : 'decoy'
});


connection.connect(function(err) {
    if (err) {
        console.error('error connecting: ' + err.stack);
        return;
    }
    console.log('Database connection is succes.' + connection.threadId);
});



// create a table users with columns: user_id, first_name, surname, birth_date nickname, email, password, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE users (user_id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(255), surname VARCHAR(255), birth_date DATE, nickname VARCHAR(255), email VARCHAR(255), password VARCHAR(255), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (user_id))';




// create a table CS GO stats with columns: user_id, nickname, kills, deaths, assists, headshots, rounds, rounds_won, rounds_lost, rounds_tied, rounds_played, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_stats (user_id INT NOT NULL, nickname VARCHAR(255), kills INT, deaths INT, assists INT, headshots INT, rounds INT, rounds_won INT, rounds_lost INT, rounds_tied INT, rounds_played INT, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (user_id))';


// create a table CS GO maps with columns: map_id, map_name, map_image, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_maps (map_id INT NOT NULL AUTO_INCREMENT, map_name VARCHAR(255), map_image VARCHAR(255), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (map_id))';

// create a table CS GO servers with columns: server_id, server_name, server_ip, server_port, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_servers (server_id INT NOT NULL AUTO_INCREMENT, server_name VARCHAR(255), server_ip VARCHAR(255), server_port INT, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (server_id))';

// create a table CS GO matches with columns: match_id, map_id, server_id, user_id, score, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_matches (match_id INT NOT NULL AUTO_INCREMENT, map_id INT, server_id INT, user_id INT, score INT, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (match_id))';

// create a table CS GO match_stats with columns: match_id, user_id, kills, deaths, assists, headshots, rounds, rounds_won, rounds_lost, rounds_tied, rounds_played, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_match_stats (match_id INT NOT NULL, user_id INT, kills INT, deaths INT, assists INT, headshots INT, rounds INT, rounds_won INT, rounds_lost INT, rounds_tied INT, rounds_played INT, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (match_id))';




// create a table CS GO level_ranks with columns: level_id, level_name, level_image, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_level_ranks (level_id INT NOT NULL AUTO_INCREMENT, level_name VARCHAR(255), level_image VARCHAR(255), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (level_id))';


// create a table CS GO user_level_ranks with columns: user_id, level_id, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_user_level_ranks (user_id INT NOT NULL, level_id INT, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (user_id))';

// create a table CS GO premium_users with columns: user_id, premium_start, premium_end, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_premium_users (user_id INT NOT NULL, premium_start DATETIME, premium_end DATETIME, created_at DATETIME, updated_at DATETIME, PRIMARY KEY (user_id))';
// create a table CS GO premium_ladder with columns: ladder_id, ladder_name, ladder_image, created_at, updated_at and a primary key.
var sql = 'CREATE TABLE cs_go_premium_ladder (ladder_id INT NOT NULL AUTO_INCREMENT, ladder_name VARCHAR(255), ladder_image VARCHAR(255), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (ladder_id))';