How do I make this to MySQL-Async? // Database

Hey, I’m trying to make this to MySQL-Async but I get this error when I’m trying.

The vrp_mysql version:

MySQL2.createCommand("vRP/police_mdt_table",[[ 
CREATE TABLE IF NOT EXISTS `vrp_tablet_users` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`notes` varchar(255) DEFAULT NULL,
	`photo` varchar(255) DEFAULT NULL,

	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_user_log` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`offense` varchar(255) DEFAULT NULL,
	`count` int(11) DEFAULT NULL,
	
	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_log2` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`title` varchar(255) DEFAULT NULL,
	`desc` longtext DEFAULT NULL,
    `charges` longtext DEFAULT NULL,
    `author` varchar(255) DEFAULT NULL,
	`name` varchar(255) DEFAULT NULL,
    `date` varchar(255) DEFAULT NULL,
    `jailtime` int(11) DEFAULT NULL,

	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_papakongen` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`name` varchar(255) DEFAULT NULL,
	`report_id` int(11) DEFAULT NULL,
	`report_title` varchar(255) DEFAULT NULL,
	`charges` longtext DEFAULT NULL,
	`date` varchar(255) DEFAULT NULL,
	`expire` varchar(255) DEFAULT NULL,
	`notes` varchar(255) DEFAULT NULL,
	`author` varchar(255) DEFAULT NULL,

	PRIMARY KEY (`id`)
);
	
CREATE TABLE IF NOT EXISTS `vrp_tablet_bøder` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`title` varchar(255) NOT NULL,
	`amount` int(11) NOT NULL,
	`jailtime` int(11) NOT NULL,
	
	PRIMARY KEY (`id`)
);
]])

-- init
MySQL2.execute("vRP/police_mdt_table")

What I have tried:

MySQL.Async.execute("CREATE TABLE IF NOT EXISTS `vrp_tablet_users` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`notes` varchar(255) DEFAULT NULL,
	`photo` varchar(255) DEFAULT NULL,

	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_user_log` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`offense` varchar(255) DEFAULT NULL,
	`count` int(11) DEFAULT NULL,
	
	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_log2` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`title` varchar(255) DEFAULT NULL,
	`desc` longtext DEFAULT NULL,
    `charges` longtext DEFAULT NULL,
    `author` varchar(255) DEFAULT NULL,
	`name` varchar(255) DEFAULT NULL,
    `date` varchar(255) DEFAULT NULL,
    `jailtime` int(11) DEFAULT NULL,

	PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `vrp_tablet_papakongen` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`user_id` int(11) NOT NULL,
	`name` varchar(255) DEFAULT NULL,
	`report_id` int(11) DEFAULT NULL,
	`report_title` varchar(255) DEFAULT NULL,
	`charges` longtext DEFAULT NULL,
	`date` varchar(255) DEFAULT NULL,
	`expire` varchar(255) DEFAULT NULL,
	`notes` varchar(255) DEFAULT NULL,
	`author` varchar(255) DEFAULT NULL,

	PRIMARY KEY (`id`)
);
	
CREATE TABLE IF NOT EXISTS `vrp_tablet_bøder` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`title` varchar(255) NOT NULL,
	`amount` int(11) NOT NULL,
	`jailtime` int(11) NOT NULL,
	
	PRIMARY KEY (`id`)
);", {}, function(result) print(result) end)

The error to what I have tried:

If there are any wise people out there within mysql-async, then I would be grateful if you made a comment or reply.

Update:

I replaced " " with []

I’m wondering why, if these are the only statements you need to make, why not just add the tables yourself? Why do you need the script to do the initial table creation?

1 Like

Are you sure you want to create tables or do you want to create rows?