From 1dbb35c5051ae592909d28c93d1a1bb879948758 Mon Sep 17 00:00:00 2001 From: quojama Date: Sun, 23 Jul 2023 05:03:34 +0900 Subject: [PATCH 1/4] cd --- db_insert_data.py | 22 ---------------- .../db_create_table.py | 0 scripts/db_delete_data.py | 20 ++++++++++++++ scripts/db_insert_data.py | 26 +++++++++++++++++++ 4 files changed, 46 insertions(+), 22 deletions(-) delete mode 100644 db_insert_data.py rename db_create_table.py => scripts/db_create_table.py (100%) create mode 100644 scripts/db_delete_data.py create mode 100644 scripts/db_insert_data.py diff --git a/db_insert_data.py b/db_insert_data.py deleted file mode 100644 index 4530cc8..0000000 --- a/db_insert_data.py +++ /dev/null @@ -1,22 +0,0 @@ -import sqlite3 - -# データベースに接続 -conn = sqlite3.connect("data/takohachi.db") - -# カーソルを取得 -cur = conn.cursor() - -# 新しいレコードを追加 -cur.execute( - """ - INSERT INTO val_puuids (puuid, region, name, tag, yesterday_elo) - VALUES (?, ?, ?, ?, ?) -""", - ("xxxxx", "ap", "xxxxx", "xxxxx", 1000), -) - -# 変更をコミット -conn.commit() - -# データベースとの接続を閉じる -conn.close() diff --git a/db_create_table.py b/scripts/db_create_table.py similarity index 100% rename from db_create_table.py rename to scripts/db_create_table.py diff --git a/scripts/db_delete_data.py b/scripts/db_delete_data.py new file mode 100644 index 0000000..a714dce --- /dev/null +++ b/scripts/db_delete_data.py @@ -0,0 +1,20 @@ +import sqlite3 + +puuid_input = input("削除するPUUIDを入力してください。") + +conn = sqlite3.connect("data/takohachi.db") + +cur = conn.cursor() + +cur.execute( + """ + DELETE FROM val_puuids + WHERE puuid = ? +""", + (puuid_input,), +) + +conn.commit() +conn.close() + +print("done!") diff --git a/scripts/db_insert_data.py b/scripts/db_insert_data.py new file mode 100644 index 0000000..ff43368 --- /dev/null +++ b/scripts/db_insert_data.py @@ -0,0 +1,26 @@ +import sqlite3 + +puuid_input = input("タスクに追加するPUUIDを入力してください。") + +try: + elo_input = int(input("現在のELOを入力してください。")) +except ValueError: + print("ELOは整数でなければなりません。") + exit(1) + +conn = sqlite3.connect("data/takohachi.db") + +cur = conn.cursor() + +cur.execute( + """ + INSERT INTO val_puuids (puuid, region, name, tag, yesterday_elo) + VALUES (?, ?, ?, ?, ?) +""", + (puuid_input, "ap", "xxxxx", "xxxxx", elo_input), +) + +conn.commit() +conn.close() + +print("done!") From fbba9beaf431a79331780f7afc91a4488ba881a6 Mon Sep 17 00:00:00 2001 From: quojama Date: Sun, 23 Jul 2023 05:03:41 +0900 Subject: [PATCH 2/4] delete --- flow.md | 107 -------------------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 flow.md diff --git a/flow.md b/flow.md deleted file mode 100644 index 7f0649f..0000000 --- a/flow.md +++ /dev/null @@ -1,107 +0,0 @@ -### Now - -```mermaid -flowchart LR - -Z(Codes) -A(Docker) -B(main
branch) -C(Docker) -D[(SQLite)] -F(Codes) -G[(SQLite)] -H(.env) -I(.env) -J(((Discord))) - -subgraph Host Machine -Z -G -A -H -end - -subgraph GitHub -B -end - -subgraph AWS Lightsail -subgraph Ubuntu -C -D -F -I -end -end - -Z o--o H -H -- run --> A -Z -- Push --> B -A o--o G -B -- Auto
deploy --> F -F o--o I -I -- run --> C -C o--o D -C <--> J -``` - -### Future Enchantment - -```mermaid - -flowchart LR - -Z(Codes) -A(Docker) -B(main
branch) -C(Docker) -D[(SQLite)] -F(Codes) -G[(SQLite)] -H(.env) -I(.env) -J[(SQLite)] -K(((Discord))) - - - -subgraph Host Machine -Z -G -A -H -end - -subgraph GitHub -B -end - -subgraph AWS Lightsail -subgraph Ubuntu -C -D -F -I -end -end - -subgraph Enchantment -subgraph AWS-S3 -J -end -end -style Enchantment fill:forestgreen -style AWS-S3 fill:forestgreen - -Z o--o H -H -- run --> A -Z -- Push --> B -A o--o J -B -- Auto
deploy --> F -F o--o I -I -- run --> C -C o--o D -D -- mirror --> J -A x-.-x G -C <--> K -``` From 6c6ac36b4896971361dcd9633c415f6af24ae376 Mon Sep 17 00:00:00 2001 From: quojama Date: Sun, 23 Jul 2023 05:03:53 +0900 Subject: [PATCH 3/4] add runner --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 13a2e90..3fcaa4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,8 @@ dev-dependencies = [ [tool.rye.scripts] check = "pre-commit run --all-files" tox = "tox" +add = "sudo python3 scripts/db_insert_data.py" +delete = "sudo python3 scripts/db_delete_data.py" [tool.hatch.metadata] allow-direct-references = true From 960a12c1b34cfbee2aa2e2a559969d6e472ff299 Mon Sep 17 00:00:00 2001 From: quojama Date: Mon, 24 Jul 2023 00:44:53 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8C=BEtkm=20review=20for=20rye?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3fcaa4e..8fcbf40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,8 @@ dev-dependencies = [ [tool.rye.scripts] check = "pre-commit run --all-files" tox = "tox" -add = "sudo python3 scripts/db_insert_data.py" -delete = "sudo python3 scripts/db_delete_data.py" +add = "python scripts/db_insert_data.py" +delete = "python scripts/db_delete_data.py" [tool.hatch.metadata] allow-direct-references = true