```
CREATE TABLE IF NOT EXISTS `gksphone_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `unique_id` varchar(50) NOT NULL DEFAULT '',
  `identifier` longtext NOT NULL,
  `setup_owner` longtext NOT NULL,
  `model_type` varchar(50) NOT NULL DEFAULT '0',
  `mail_address` longtext NOT NULL,
  `mail_password` longtext NOT NULL,
  `phone_lang` varchar(50) NOT NULL DEFAULT '0',
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `setup_status` tinyint(4) NOT NULL DEFAULT 0,
  `phone_password` varchar(50) NOT NULL DEFAULT '0',
  `look_id` tinyint(4) NOT NULL DEFAULT 0,
  `security_question` VARCHAR(50) NOT NULL DEFAULT '0',
  `security_answer` longtext NOT NULL,
  `phone_settings` longtext NOT NULL,
  `social_accounts` text NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `unique_id` (`unique_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `gksphone_esim` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pin` int(11) NOT NULL DEFAULT 0,
  `operator` varchar(50) NOT NULL DEFAULT '0',
  `package_id` int(11) NOT NULL DEFAULT 0,
  `phone_number` varchar(50) NOT NULL DEFAULT '0',
  `phone_id` varchar(50) NOT NULL DEFAULT '',
  `is_active` tinyint(4) NOT NULL DEFAULT 0,
  `package_sms` int(11) NOT NULL DEFAULT 0,
  `package_call` int(11) NOT NULL DEFAULT 0,
  `package_internet` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `phone_number` (`phone_number`),
  KEY `idx_phone_id` (`phone_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `gksphone_advertising` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(50) NOT NULL,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  `firstname` varchar(256) NOT NULL,
  `message` longtext NOT NULL,
  `image` longtext DEFAULT NULL,
  `filter` varchar(255) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_advertising_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `gksphone_bank_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(50) NOT NULL DEFAULT '',
  `type` int(11) NOT NULL,
  `amount` int(11) NOT NULL DEFAULT 0,
  `description` longtext NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_bank_histroy_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `gksphone_billing` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50) NOT NULL,
  `amount` int(11) NOT NULL DEFAULT 0,
  `society` varchar(50) NOT NULL DEFAULT '',
  `societylabel` varchar(50) NOT NULL DEFAULT '',
  `sender` varchar(50) NOT NULL,
  `sendercitizenid` varchar(50) NOT NULL,
  `description` varchar(250) NOT NULL,
  `status` varchar(50) NOT NULL DEFAULT '',
  `bill_holder` varchar(50) NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_calls` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) NOT NULL DEFAULT '',
  `caller` varchar(50) NOT NULL,
  `receiver` varchar(50) NOT NULL DEFAULT '',
  `type` varchar(50) NOT NULL DEFAULT '',
  `status` int(11) NOT NULL,
  `hidden` int(11) NOT NULL DEFAULT 0,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_calls_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_contacts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
  `number` varchar(30) CHARACTER SET utf8mb4 NOT NULL,
  `display` longtext CHARACTER SET utf8mb4 NOT NULL,
  `phone_id` varchar(50) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `gksphone_contacts_ibfk_1` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_darkchat_channels` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `channel_name` varchar(50) NOT NULL,
  `channel_created` tinyint(4) NOT NULL,
  `phone_id` varchar(50) NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `phone_uniq` (`phone_id`) USING BTREE,
  CONSTRAINT `FK_gksphone_darkchat_channels_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_darkchat_message` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `channel_id` int(11) NOT NULL,
  `message` longtext NOT NULL,
  `phone_id` varchar(50) NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `phone_uniq` (`phone_id`) USING BTREE,
  CONSTRAINT `FK_gksphone_darkchat_message_gksphone_darkchat_channels` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_darkchat_channels` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `gksphone_gallery` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `image` longtext NOT NULL,
  `favorite` tinyint(4) NOT NULL DEFAULT 0,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_gallery_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `gksphone_gameleaderboard` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tetris` int(11) NOT NULL DEFAULT 0,
  `snake` int(11) NOT NULL DEFAULT 0,
  `twenty` int(11) NOT NULL DEFAULT 0,
  `phone_id` varchar(500) NOT NULL,
  `name` varchar(500) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_gameleaderboard_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_gps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `citizenid` longtext NOT NULL,
  `gps_name` longtext NOT NULL,
  `gps_coord` longtext NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_gps_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `gksphone_mails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(255) NOT NULL DEFAULT '0',
  `sender` varchar(255) NOT NULL DEFAULT '0',
  `subject` varchar(255) NOT NULL DEFAULT '0',
  `image` varchar(250) DEFAULT NULL,
  `message` text NOT NULL,
  `button` longtext DEFAULT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_messages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sender` longtext CHARACTER SET utf8mb4 NOT NULL,
  `receiver` longtext CHARACTER SET utf8mb4 NOT NULL,
  `message` longtext CHARACTER SET utf8mb4 NOT NULL,
  `phone_id` varchar(50) NOT NULL DEFAULT '0',
  `read_at` timestamp NULL DEFAULT NULL,
  `sent_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_editable` tinyint(1) NOT NULL DEFAULT 0,
  `is_sender` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_messages_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_messages_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `phone_number` varchar(50) NOT NULL,
  `iscreator` tinyint(4) NOT NULL DEFAULT 0,
  `group_name` longtext NOT NULL,
  `group_about` longtext NOT NULL,
  `group_image` longtext NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`),
  CONSTRAINT `FK_gksphone_messages_group_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `gksphone_messages_groups_members` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `group_id` int(11) NOT NULL,
  `phone_number` varchar(50) NOT NULL,
  `joined_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`) USING BTREE,
  KEY `group_id` (`group_id`) USING BTREE,
  CONSTRAINT `FK_gksphone_messages_groups_members_gksphone_messages_groups` FOREIGN KEY (`group_id`) REFERENCES `gksphone_messages_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `gksphone_messages_groups_members_ibfk_1` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE IF NOT EXISTS `gksphone_messages_groups_messages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `group_id` int(11) NOT NULL,
  `message` text NOT NULL,
  `sender` varchar(50) NOT NULL,
  `sent_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `read_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`) USING BTREE,
  KEY `group_id` (`group_id`) USING BTREE,
  CONSTRAINT `gksphone_messages_groups_messages_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `gksphone_messages_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `gksphone_messages_groups_messages_ibfk_2` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE IF NOT EXISTS `gksphone_messages_post` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(50) NOT NULL DEFAULT '',
  `content` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_number` (`phone_number`) USING BTREE,
  CONSTRAINT `gksphone_messages_post_ibfk_1` FOREIGN KEY (`phone_number`) REFERENCES `gksphone_esim` (`phone_number`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;


CREATE TABLE IF NOT EXISTS `gksphone_messages_stories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(50) NOT NULL DEFAULT '',
  `content` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `expires_at` timestamp NOT NULL DEFAULT (current_timestamp() + interval 24 hour),
  PRIMARY KEY (`id`),
  KEY `phone_number` (`phone_number`),
  CONSTRAINT `FK_gksphone_messages_stories_gksphone_esim` FOREIGN KEY (`phone_number`) REFERENCES `gksphone_esim` (`phone_number`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_messages_viewed_stories` (
  `phone_number` varchar(50) NOT NULL DEFAULT '',
  `story_id` int(11) NOT NULL,
  `viewed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  KEY `phone_number` (`phone_number`),
  KEY `story_id` (`story_id`),
  CONSTRAINT `FK_gksphone_messages_viewed_stories_gksphone_esim` FOREIGN KEY (`phone_number`) REFERENCES `gksphone_esim` (`phone_number`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_gksphone_messages_viewed_stories_gksphone_messages_stories` FOREIGN KEY (`story_id`) REFERENCES `gksphone_messages_stories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_news` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `news_text` longtext NOT NULL,
  `news_title` longtext NOT NULL,
  `news_image` longtext DEFAULT NULL,
  `news_video` longtext DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `gksphone_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `title` longtext NOT NULL,
  `image` longtext DEFAULT NULL,
  `note` longtext NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone_id` (`phone_id`) USING BTREE,
  CONSTRAINT `gksphone_notes_ibfk_1` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE IF NOT EXISTS `gksphone_stockmarket` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  `stock_market` longtext NOT NULL,
  `stock_histroy` longtext NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `phone_id` (`phone_id`),
  CONSTRAINT `gksphone_stockmarket_ibfk_1` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE IF NOT EXISTS `gksphone_twt_users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `identifier` longtext NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `displayname` varchar(255) NOT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `banner` varchar(255) DEFAULT NULL,
  `is_verified` int(11) NOT NULL DEFAULT 0,
  `verifedbuytime` timestamp NULL DEFAULT current_timestamp(),
  `banned` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`user_id`) USING BTREE,
  UNIQUE KEY `unique_username` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_twt_posts` (
  `post_id` int(11) NOT NULL AUTO_INCREMENT,
  `identifier` longtext NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `content` longtext CHARACTER SET utf8mb4 NOT NULL,
  `media` longtext DEFAULT NULL,
  `poll_options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `end_date` timestamp NULL DEFAULT NULL,
  `comment` int(11) NOT NULL DEFAULT 0,
  `commentid` int(11) NOT NULL DEFAULT 0,
  `pinned` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`post_id`) USING BTREE,
  KEY `user_id` (`user_id`) USING BTREE,
  CONSTRAINT `gksphone_twt_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `gksphone_twt_users` (`user_id`) ON DELETE CASCADE,
  CONSTRAINT `poll_options` CHECK (json_valid(`poll_options`))
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_twt_followers` (
  `follow_id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) NOT NULL,
  `followid` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`follow_id`) USING BTREE,
  KEY `userid` (`userid`) USING BTREE,
  KEY `FK_gksphone_twt_follower_gksphone_twt_users` (`followid`) USING BTREE,
  CONSTRAINT `FK_gksphone_twt_follower_gksphone_twt_users` FOREIGN KEY (`followid`) REFERENCES `gksphone_twt_users` (`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `FK_gksphone_twt_followers_gksphone_twt_users` FOREIGN KEY (`userid`) REFERENCES `gksphone_twt_users` (`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_twt_hastags` (
  `hastag_id` int(11) NOT NULL AUTO_INCREMENT,
  `hastag` varchar(250) NOT NULL DEFAULT '',
  `postid` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`hastag_id`) USING BTREE,
  KEY `postid` (`postid`) USING BTREE,
  CONSTRAINT `FK_gksphone_twt_hastags_gksphone_twt_posts` FOREIGN KEY (`postid`) REFERENCES `gksphone_twt_posts` (`post_id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_twt_likepost` (
  `like_id` int(11) NOT NULL AUTO_INCREMENT,
  `postid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`like_id`) USING BTREE,
  KEY `userid` (`userid`) USING BTREE,
  KEY `postid` (`postid`) USING BTREE,
  CONSTRAINT `FK_gksphone_twt_likepost_gksphone_twt_posts` FOREIGN KEY (`postid`) REFERENCES `gksphone_twt_posts` (`post_id`) ON DELETE CASCADE,
  CONSTRAINT `FK_gksphone_twt_likepost_gksphone_twt_users` FOREIGN KEY (`userid`) REFERENCES `gksphone_twt_users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;



CREATE TABLE IF NOT EXISTS `gksphone_twt_retweet` (
  `retwettsid` int(11) NOT NULL AUTO_INCREMENT,
  `postid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`retwettsid`) USING BTREE,
  KEY `userid` (`userid`) USING BTREE,
  KEY `postid` (`postid`) USING BTREE,
  CONSTRAINT `FK_gksphone_twt_retweet_gksphone_twt_posts` FOREIGN KEY (`postid`) REFERENCES `gksphone_twt_posts` (`post_id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `FK_gksphone_twt_retweet_gksphone_twt_users` FOREIGN KEY (`userid`) REFERENCES `gksphone_twt_users` (`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;



CREATE TABLE IF NOT EXISTS `gksphone_vehicle_sales` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `identifier` longtext NOT NULL,
  `player_name` varchar(50) NOT NULL,
  `phone_number` varchar(255) NOT NULL,
  `plate` varchar(255) NOT NULL,
  `model` varchar(255) NOT NULL,
  `price` int(11) NOT NULL,
  `image` longtext NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `gksphone_wanted` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50) NOT NULL,
  `fullname` varchar(50) NOT NULL,
  `reason` varchar(250) DEFAULT NULL,
  `appearance` varchar(250) DEFAULT NULL,
  `lastseen` varchar(250) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `gksphone_music` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`playlist_name` LONGTEXT NOT NULL,
	`playlist_img` LONGTEXT NOT NULL,
	`details` LONGTEXT NOT NULL,
	`phone_id` VARCHAR(50) NOT NULL,
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `FK_gksphone_music_gksphone_esim` (`phone_id`) USING BTREE,
	CONSTRAINT `FK_gksphone_music_gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `gksphone_music_like` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`phone_id` VARCHAR(50) NOT NULL,
	`songid` VARCHAR(50) NOT NULL,
	`title` VARCHAR(250) NOT NULL,
	`artist` VARCHAR(250) NOT NULL,
	`img` LONGTEXT NOT NULL,
	`seconds` INT(11) NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `FK__gksphone_esim` (`phone_id`) USING BTREE,
	CONSTRAINT `FK__gksphone_esim` FOREIGN KEY (`phone_id`) REFERENCES `gksphone_esim` (`phone_id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;


```


can you convert to IF EXISTS REPLACE EM TO NEW