This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues or pull requests.
l9_stud_bot/database/database.sql

30 lines
989 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE DATABASE IF NOT EXISTS `l9_db`;
USE `l9_db`;
-- Пользователи системы
CREATE TABLE IF NOT EXISTS `users` (
`l9Id` bigint NOT NULL,
-- Идентификатор пользователя системы
PRIMARY KEY (`l9Id`)
);
-- Сведения о пользователях бота Telegram
CREATE TABLE IF NOT EXISTS `tg_users` (
`l9Id` bigint NOT NULL,
-- Идентификатор пользователя системы
`tgId` bigint NOT NULL,
-- ID пользователя в Telegram
`name` TEXT,
-- (optional) Имя пользователя в Telegram
`posTag` varchar(30) DEFAULT 'not_started',
-- Позиция пользователя в диалоге с ботом:
-- (default) not_started - не вступил в диалог
-- started - вступил в диалог
PRIMARY KEY (`l9Id`),
CONSTRAINT `l9_tg` FOREIGN KEY (`l9Id`) REFERENCES `users` (`l9Id`) ON DELETE CASCADE ON UPDATE CASCADE
);