openvk/install/init-event-db.sql

40 lines
1.5 KiB
MySQL
Raw Permalink Normal View History

2020-06-07 21:36:36 +03:00
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
CREATE TABLE `notifications` (
`recipientType` tinyint(3) UNSIGNED NOT NULL,
`recipientId` bigint(20) UNSIGNED NOT NULL,
`originModelType` tinyint(3) UNSIGNED NOT NULL,
`originModelId` bigint(20) UNSIGNED NOT NULL,
`targetModelType` tinyint(3) UNSIGNED NOT NULL,
`targetModelId` bigint(20) UNSIGNED NOT NULL,
`modelAction` tinyint(3) UNSIGNED NOT NULL,
`additionalData` char(24) NOT NULL,
`timestamp` bigint(20) UNSIGNED NOT NULL
) ENGINE=Aria DEFAULT CHARSET=utf8;
CREATE TABLE `postViews` (
`profile` bigint(20) UNSIGNED NOT NULL,
`post` bigint(20) UNSIGNED NOT NULL,
`owner` bigint(20) UNSIGNED NOT NULL,
`group` tinyint(3) UNSIGNED NOT NULL,
`subscribed` tinyint(3) UNSIGNED NOT NULL,
`timestamp` bigint(20) UNSIGNED NOT NULL,
`verified` tinyint(3) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=Aria DEFAULT CHARSET=utf8;
2021-11-04 21:32:20 +03:00
ALTER TABLE `postViews` ADD INDEX(`owner`, `group`, `subscribed`);
ALTER TABLE `notifications` ADD INDEX(`recipientType`, `recipientId`, `timestamp`);
2020-06-07 21:36:36 +03:00
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;