-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8f3e7e
commit b73844f
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE TABLE IF NOT EXISTS TGUser | ||
( | ||
id BIGINT PRIMARY KEY NOT NULL , | ||
hash VARCHAR(999) NOT NULL, | ||
first_name VARCHAR(255) NULL, | ||
username VARCHAR(255) NULL, | ||
language_code VARCHAR(255) NULL, | ||
is_bot BOOLEAN NOT NULL | ||
|
||
); | ||
|
||
CREATE TABLE IF NOT EXISTS TGChat | ||
( | ||
id BIGINT PRIMARY KEY NOT NULL , | ||
hash VARCHAR(999) NOT NULL, | ||
full_name VARCHAR(255) NOT NULL , | ||
type VARCHAR(255) NULL | ||
|
||
); | ||
|
||
CREATE TABLE IF NOT EXISTS TGMessage | ||
( | ||
true_id UUID PRIMARY KEY NOT NULL , | ||
id BIGINT NOT NULL, | ||
author_id BIGINT, | ||
chat_id BIGINT, | ||
text TEXT, | ||
created_at TIMESTAMPTZ NOT NULL, | ||
FOREIGN KEY (author_id) REFERENCES TGUser (id) ON DELETE CASCADE, | ||
FOREIGN KEY (chat_id) REFERENCES TGChat (id) ON DELETE CASCADE | ||
); |