sql cleanup

This commit is contained in:
erik-sn committed 2020-11-21 00:35:44 -05:00
1 parent 2c4c54109f
commit 9363032c42
2 files changed
+70 -24

No files matched your search

@@ -1,25 +1,26 @@
import { useSetRecoilState } from 'recoil';
import { messageState } from './state';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useSetRecoilState } from "recoil";
import { messageState } from "./state";
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent";
const NOTIFICATION_TIMEOUT = 6000;
export const useMessagesService = () => {
const setMessageGroups = useSetRecoilState(messageState.messageGroups);
const setMessages = useSetRecoilState(messageState.messages);
const setCreateMessageGroupResult = useSetRecoilState(messageState.createMessageGroupResult);
const setCreateMessageGroupResult = useSetRecoilState(
messageState.createMessageGroupResult
);
const _handleCreateMessageGroupResult = (result) => {
console.log(result);
setCreateMessageGroupResult(result);
window.setTimeout(() => {
setCreateMessageGroupResult(null);
}, NOTIFICATION_TIMEOUT);
};
useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups);
useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages);
useNuiEvent('MESSAGES', 'phone:createMessageGroupSuccess', _handleCreateMessageGroupResult);
useNuiEvent('MESSAGES', 'phone:createMessageGroupFailed', _handleCreateMessageGroupResult);
}
useNuiEvent("MESSAGES", "phone:fetchMessageGroupsSuccess", setMessageGroups);
useNuiEvent("MESSAGES", "phone:fetchMessagesSuccess", setMessages);
useNuiEvent(
"MESSAGES",
"phone:createMessageGroupSuccess",
setCreateMessageGroupResult
);
useNuiEvent(
"MESSAGES",
"phone:createMessageGroupFailed",
setCreateMessageGroupResult
);
};
+51 -6
View File
@@ -1,6 +1,8 @@
-- comment this out if your server has a different table/location for phone_number
-- or if it already exists in the users table
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) NULL DEFAULT NULL;
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
CREATE TABLE IF NOT EXISTS npwd_phone_contacts (
id int(11) NOT NULL AUTO_INCREMENT,
@@ -16,9 +18,6 @@ AVG_ROW_LENGTH = 4096,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
`id` int NOT NULL AUTO_INCREMENT,
`message` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
@@ -29,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
`visible` tinyint NOT NULL DEFAULT '1',
`images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=190 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) ENGINE=InnoDB AUTO_INCREMENT=190 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
@@ -44,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `profile_name_UNIQUE` (`profile_name`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` (
`id` int NOT NULL AUTO_INCREMENT,
@@ -72,7 +71,7 @@ AVG_ROW_LENGTH = 4096,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
CREATE TABLE npwd_sellout_listings (
CREATE TABLE IF NOT EXISTS npwd_sellout_listings (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
name varchar(50) DEFAULT NULL,
@@ -99,3 +98,49 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
CONSTRAINT `report_profile` FOREIGN KEY (`profile_id`) REFERENCES `npwd_twitter_profiles` (`id`),
CONSTRAINT `report_tweet` FOREIGN KEY (`tweet_id`) REFERENCES `npwd_twitter_tweets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
`id` int NOT NULL AUTO_INCREMENT,
`user_identifier` varchar(40) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`group_id` varchar(60) NOT NULL,
`participant_identifier` varchar(40) NOT NULL,
`label` varchar(60) DEFAULT '',
PRIMARY KEY (`id`),
KEY `npwd_messages_groups_group_id` (`group_id`),
KEY `npwd_messages_groups_user_identifier_idx` (`user_identifier`),
KEY `npwd_messages_groups_participant_identifier_idx` (`participant_identifier`),
CONSTRAINT `npwd_messages_groups_participant_identifier` FOREIGN KEY (`participant_identifier`) REFERENCES `users` (`identifier`),
CONSTRAINT `npwd_messages_groups_user_identifier` FOREIGN KEY (`user_identifier`) REFERENCES `users` (`identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
`id` int NOT NULL AUTO_INCREMENT,
`user_identifier` varchar(40) NOT NULL,
`label` varchar(60) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`group_id` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
KEY `npwd_messages_labels_group_id_idx` (`group_id`),
KEY `npwd_messages_labels_group_id_idx1` (`user_identifier`),
CONSTRAINT `npwd_messages_labels_group_id` FOREIGN KEY (`group_id`) REFERENCES `npwd_messages_groups` (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `npwd_messages` (
`id` int NOT NULL AUTO_INCREMENT,
`message` varchar(512) NOT NULL,
`user_identifier` varchar(40) NOT NULL,
`group_id` varchar(60) NOT NULL,
`isRead` tinyint NOT NULL DEFAULT '0',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`visible` tinyint NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `messages_identifier_idx` (`user_identifier`),
KEY `npwd_messages_group_id_idx` (`group_id`),
CONSTRAINT `npwd_messages_group_id` FOREIGN KEY (`group_id`) REFERENCES `npwd_messages_groups` (`group_id`),
CONSTRAINT `npwd_messages_user_identifier` FOREIGN KEY (`user_identifier`) REFERENCES `users` (`identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;