Skip to content

Commit acd93f3

Browse files
committed
chore(rewrite-v2): update dependencies and add PostgreSQL schema
- Changed psycopg dependency to include binary support. - Updated README with instructions for creating the PostgreSQL schema. - Added schema.sql file for PostgreSQL database structure.
1 parent 03a0b97 commit acd93f3

4 files changed

Lines changed: 73 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ Official Telegram bot for the main Italian Python group and local sub-groups in
3232
# Edit .env and set TELEGRAM_BOT_TOKEN
3333
```
3434

35-
4. Run the bot:
35+
4. If using PostgreSQL (`DATABASE_URL` set), create the schema:
36+
```bash
37+
psql "$DATABASE_URL" -f schema.sql
38+
```
39+
40+
5. Run the bot:
3641
```bash
3742
uv run python-italy-bot
3843
# or: uv run python -m python_italy_bot.main

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = { text = "MIT" }
88
dependencies = [
99
"python-telegram-bot>=22.0",
1010
"python-dotenv>=1.0",
11-
"psycopg[pool]>=3.2",
11+
"psycopg[binary,pool]>=3.2",
1212
]
1313

1414
[project.optional-dependencies]

schema.sql

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
-- PostgreSQL schema for Python Italy Telegram Bot
2+
-- Run against your DATABASE_URL before using PostgresRepository
3+
4+
CREATE TABLE IF NOT EXISTS pending_verifications (
5+
user_id BIGINT NOT NULL,
6+
chat_id BIGINT NOT NULL,
7+
PRIMARY KEY (user_id, chat_id)
8+
);
9+
10+
CREATE TABLE IF NOT EXISTS verified_users (
11+
user_id BIGINT NOT NULL,
12+
chat_id BIGINT NOT NULL,
13+
PRIMARY KEY (user_id, chat_id)
14+
);
15+
16+
CREATE TABLE IF NOT EXISTS bans (
17+
user_id BIGINT NOT NULL,
18+
chat_id BIGINT NOT NULL,
19+
admin_id BIGINT NOT NULL,
20+
reason TEXT,
21+
created_at TIMESTAMPTZ DEFAULT NOW(),
22+
PRIMARY KEY (user_id, chat_id)
23+
);
24+
25+
CREATE TABLE IF NOT EXISTS mutes (
26+
user_id BIGINT NOT NULL,
27+
chat_id BIGINT NOT NULL,
28+
admin_id BIGINT NOT NULL,
29+
reason TEXT,
30+
until_ts TIMESTAMPTZ,
31+
created_at TIMESTAMPTZ DEFAULT NOW(),
32+
PRIMARY KEY (user_id, chat_id)
33+
);
34+
35+
CREATE TABLE IF NOT EXISTS reports (
36+
id SERIAL PRIMARY KEY,
37+
reporter_id BIGINT NOT NULL,
38+
reported_user_id BIGINT NOT NULL,
39+
chat_id BIGINT NOT NULL,
40+
message_id BIGINT,
41+
reason TEXT,
42+
created_at TIMESTAMPTZ DEFAULT NOW()
43+
);

uv.lock

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)