Skip to content

Structure.sql #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions structure.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier',
`id` bigint COMMENT 'Unique user identifier',
`first_name` CHAR(255) NOT NULL DEFAULT '' COMMENT 'User first name',
`last_name` CHAR(255) DEFAULT NULL COMMENT 'User last name',
`username` CHAR(255) DEFAULT NULL COMMENT 'User username',
Expand All @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `chat` (
`id` bigint NULL DEFAULT NULL COMMENT 'Unique user or chat identifier',
`id` bigint COMMENT 'Unique user or chat identifier',
`type` ENUM('private', 'group', 'supergroup', 'channel') NOT NULL COMMENT 'chat type private, group, supergroup or channel',
`title` CHAR(255) DEFAULT '' COMMENT 'chat title null if case of single chat with the bot',
`created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
Expand All @@ -20,8 +20,8 @@ CREATE TABLE IF NOT EXISTS `chat` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `user_chat` (
`user_id` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier',
`chat_id` bigint NULL DEFAULT NULL COMMENT 'Unique user or chat identifier',
`user_id` bigint COMMENT 'Unique user identifier',
`chat_id` bigint COMMENT 'Unique user or chat identifier',
PRIMARY KEY (`user_id`, `chat_id`),
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
Expand All @@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `user_chat` (


CREATE TABLE IF NOT EXISTS `inline_query` (
`id` bigint UNSIGNED NULL COMMENT 'Unique identifier for this query.',
`id` bigint UNSIGNED COMMENT 'Unique identifier for this query.',
`user_id` bigint NULL COMMENT 'Sender',
`query` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Text of the query',
`offset` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Offset of the result',
Expand All @@ -45,7 +45,7 @@ CREATE TABLE IF NOT EXISTS `inline_query` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `chosen_inline_query` (
`id` bigint UNSIGNED NULL AUTO_INCREMENT COMMENT 'Unique identifier for chosen query.',
`id` bigint UNSIGNED AUTO_INCREMENT COMMENT 'Unique identifier for chosen query.',
`result_id` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Id of the chosen result',
`user_id` bigint NULL COMMENT 'Sender',
`query` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Text of the query',
Expand All @@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS `chosen_inline_query` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE IF NOT EXISTS `message` (
`id` bigint UNSIGNED NULL COMMENT 'Unique message identifier',
`id` bigint UNSIGNED COMMENT 'Unique message identifier',
`user_id` bigint NULL COMMENT 'User identifier',
`chat_id` bigint NULL DEFAULT NULL COMMENT 'Chat identifier.',
`date` timestamp NULL DEFAULT NULL COMMENT 'Date the message was sent in timestamp format',
Expand Down Expand Up @@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS `message` (


CREATE TABLE IF NOT EXISTS `telegram_update` (
`id` bigint UNSIGNED NULL COMMENT 'The update\'s unique identifier.',
`id` bigint UNSIGNED COMMENT 'The update\'s unique identifier.',
`message_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Unique message identifier',
`inline_query_id` bigint UNSIGNED DEFAULT NULL COMMENT 'The query unique identifier.',
`chosen_inline_query_id` bigint UNSIGNED DEFAULT NULL COMMENT 'The chosen query unique identifier.',
Expand Down