From 3609205a577a3ab53959bf0b75c04f2f89f74aab Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Wed, 4 Jun 2025 01:59:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9E=95=20=E6=B7=BB=E5=8A=A0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E4=BE=9D=E8=B5=96=20nonebot-plugin-orm[postgresql]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + uv.lock | 79 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a7a7210..5686fe2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,6 +59,7 @@ dev = [ "nonebot-adapter-kaiheila>=0.3.4", "nonebot-adapter-onebot>=2.4.6", "nonebot-adapter-qq>=1.5.3", + "nonebot-plugin-orm[postgresql]>=0.8.0", "nonebot-plugin-tarina-lang-turbo>=0.1.1", "ruff>=0.7.1", ] diff --git a/uv.lock b/uv.lock index 304b0ee..35e0b36 100644 --- a/uv.lock +++ b/uv.lock @@ -1933,6 +1933,9 @@ wheels = [ default = [ { name = "sqlalchemy", extra = ["aiosqlite"] }, ] +postgresql = [ + { name = "sqlalchemy", extra = ["postgresql-psycopgbinary"] }, +] [[package]] name = "nonebot-plugin-session" @@ -1966,7 +1969,7 @@ wheels = [ [[package]] name = "nonebot-plugin-tetris-stats" -version = "1.8.3" +version = "1.9.0" source = { editable = "." } dependencies = [ { name = "aiocache" }, @@ -2010,6 +2013,7 @@ dev = [ { name = "nonebot-adapter-kaiheila" }, { name = "nonebot-adapter-onebot" }, { name = "nonebot-adapter-qq" }, + { name = "nonebot-plugin-orm", extra = ["postgresql"] }, { name = "nonebot-plugin-tarina-lang-turbo" }, { name = "ruff" }, ] @@ -2074,6 +2078,7 @@ dev = [ { name = "nonebot-adapter-kaiheila", specifier = ">=0.3.4" }, { name = "nonebot-adapter-onebot", specifier = ">=2.4.6" }, { name = "nonebot-adapter-qq", specifier = ">=1.5.3" }, + { name = "nonebot-plugin-orm", extras = ["postgresql"], specifier = ">=0.8.0" }, { name = "nonebot-plugin-tarina-lang-turbo", specifier = ">=0.1.1" }, { name = "ruff", specifier = ">=0.7.1" }, ] @@ -2564,6 +2569,75 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/50/1b/6921afe68c74868b4c9fa424dad3be35b095e16687989ebbb50ce4fceb7c/psutil-7.0.0-cp37-abi3-win_amd64.whl", hash = "sha256:4cf3d4eb1aa9b348dec30105c55cd9b7d4629285735a102beb4441e38db90553", size = 244885, upload-time = "2025-02-13T21:54:37.486Z" }, ] +[[package]] +name = "psycopg" +version = "3.2.9" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, + { name = "tzdata", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/27/4a/93a6ab570a8d1a4ad171a1f4256e205ce48d828781312c0bbaff36380ecb/psycopg-3.2.9.tar.gz", hash = "sha256:2fbb46fcd17bc81f993f28c47f1ebea38d66ae97cc2dbc3cad73b37cefbff700", size = 158122, upload-time = "2025-05-13T16:11:15.533Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/44/b0/a73c195a56eb6b92e937a5ca58521a5c3346fb233345adc80fd3e2f542e2/psycopg-3.2.9-py3-none-any.whl", hash = "sha256:01a8dadccdaac2123c916208c96e06631641c0566b22005493f09663c7a8d3b6", size = 202705, upload-time = "2025-05-13T16:06:26.584Z" }, +] + +[package.optional-dependencies] +binary = [ + { name = "psycopg-binary", marker = "implementation_name != 'pypy'" }, +] + +[[package]] +name = "psycopg-binary" +version = "3.2.9" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b6/ce/d677bc51f9b180986e5515268603519cee682eb6b5e765ae46cdb8526579/psycopg_binary-3.2.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:528239bbf55728ba0eacbd20632342867590273a9bacedac7538ebff890f1093", size = 4033081, upload-time = "2025-05-13T16:06:29.666Z" }, + { url = "https://files.pythonhosted.org/packages/de/f4/b56263eb20dc36d71d7188622872098400536928edf86895736e28546b3c/psycopg_binary-3.2.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e4978c01ca4c208c9d6376bd585e2c0771986b76ff7ea518f6d2b51faece75e8", size = 4082141, upload-time = "2025-05-13T16:06:33.81Z" }, + { url = "https://files.pythonhosted.org/packages/68/47/5316c3b0a2b1ff5f1d440a27638250569994534874a2ce88bf24f5c51c0f/psycopg_binary-3.2.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ed2bab85b505d13e66a914d0f8cdfa9475c16d3491cf81394e0748b77729af2", size = 4678993, upload-time = "2025-05-13T16:06:36.309Z" }, + { url = "https://files.pythonhosted.org/packages/53/24/b2c667b59f07fd7d7805c0c2074351bf2b98a336c5030d961db316512ffb/psycopg_binary-3.2.9-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:799fa1179ab8a58d1557a95df28b492874c8f4135101b55133ec9c55fc9ae9d7", size = 4500117, upload-time = "2025-05-13T16:06:38.847Z" }, + { url = "https://files.pythonhosted.org/packages/ae/91/a08f8878b0fe0b34b083c149df950bce168bc1b18b2fe849fa42bf4378d4/psycopg_binary-3.2.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bb37ac3955d19e4996c3534abfa4f23181333974963826db9e0f00731274b695", size = 4766985, upload-time = "2025-05-13T16:06:42.502Z" }, + { url = "https://files.pythonhosted.org/packages/10/be/3a45d5b7d8f4c4332fd42465f2170b5aef4d28a7c79e79ac7e5e1dac74d7/psycopg_binary-3.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:001e986656f7e06c273dd4104e27f4b4e0614092e544d950c7c938d822b1a894", size = 4461990, upload-time = "2025-05-13T16:06:45.971Z" }, + { url = "https://files.pythonhosted.org/packages/03/ce/20682b9a4fc270d8dc644a0b16c1978732146c6ff0abbc48fbab2f4a70aa/psycopg_binary-3.2.9-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:fa5c80d8b4cbf23f338db88a7251cef8bb4b68e0f91cf8b6ddfa93884fdbb0c1", size = 3777947, upload-time = "2025-05-13T16:06:49.134Z" }, + { url = "https://files.pythonhosted.org/packages/07/5c/f6d486e00bcd8709908ccdd436b2a190d390dfd61e318de4060bc6ee2a1e/psycopg_binary-3.2.9-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:39a127e0cf9b55bd4734a8008adf3e01d1fd1cb36339c6a9e2b2cbb6007c50ee", size = 3337502, upload-time = "2025-05-13T16:06:51.378Z" }, + { url = "https://files.pythonhosted.org/packages/0b/a1/086508e929c0123a7f532840bb0a0c8a1ebd7e06aef3ee7fa44a3589bcdf/psycopg_binary-3.2.9-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:fb7599e436b586e265bea956751453ad32eb98be6a6e694252f4691c31b16edb", size = 3440809, upload-time = "2025-05-13T16:06:54.552Z" }, + { url = "https://files.pythonhosted.org/packages/40/f2/3a347a0f894355a6b173fca2202eca279b6197727b24e4896cf83f4263ee/psycopg_binary-3.2.9-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5d2c9fe14fe42b3575a0b4e09b081713e83b762c8dc38a3771dd3265f8f110e7", size = 3497231, upload-time = "2025-05-13T16:06:58.858Z" }, + { url = "https://files.pythonhosted.org/packages/18/31/0845a385eb6f4521b398793293b5f746a101e80d5c43792990442d26bc2e/psycopg_binary-3.2.9-cp310-cp310-win_amd64.whl", hash = "sha256:7e4660fad2807612bb200de7262c88773c3483e85d981324b3c647176e41fdc8", size = 2936845, upload-time = "2025-05-13T16:07:02.712Z" }, + { url = "https://files.pythonhosted.org/packages/b6/84/259ea58aca48e03c3c793b4ccfe39ed63db7b8081ef784d039330d9eed96/psycopg_binary-3.2.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2504e9fd94eabe545d20cddcc2ff0da86ee55d76329e1ab92ecfcc6c0a8156c4", size = 4040785, upload-time = "2025-05-13T16:07:07.569Z" }, + { url = "https://files.pythonhosted.org/packages/25/22/ce58ffda2b7e36e45042b4d67f1bbd4dd2ccf4cfd2649696685c61046475/psycopg_binary-3.2.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:093a0c079dd6228a7f3c3d82b906b41964eaa062a9a8c19f45ab4984bf4e872b", size = 4087601, upload-time = "2025-05-13T16:07:11.75Z" }, + { url = "https://files.pythonhosted.org/packages/c6/4f/b043e85268650c245025e80039b79663d8986f857bc3d3a72b1de67f3550/psycopg_binary-3.2.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:387c87b51d72442708e7a853e7e7642717e704d59571da2f3b29e748be58c78a", size = 4676524, upload-time = "2025-05-13T16:07:17.038Z" }, + { url = "https://files.pythonhosted.org/packages/da/29/7afbfbd3740ea52fda488db190ef2ef2a9ff7379b85501a2142fb9f7dd56/psycopg_binary-3.2.9-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d9ac10a2ebe93a102a326415b330fff7512f01a9401406896e78a81d75d6eddc", size = 4495671, upload-time = "2025-05-13T16:07:21.709Z" }, + { url = "https://files.pythonhosted.org/packages/ea/eb/df69112d18a938cbb74efa1573082248437fa663ba66baf2cdba8a95a2d0/psycopg_binary-3.2.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:72fdbda5b4c2a6a72320857ef503a6589f56d46821592d4377c8c8604810342b", size = 4768132, upload-time = "2025-05-13T16:07:25.818Z" }, + { url = "https://files.pythonhosted.org/packages/76/fe/4803b20220c04f508f50afee9169268553f46d6eed99640a08c8c1e76409/psycopg_binary-3.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f34e88940833d46108f949fdc1fcfb74d6b5ae076550cd67ab59ef47555dba95", size = 4458394, upload-time = "2025-05-13T16:07:29.148Z" }, + { url = "https://files.pythonhosted.org/packages/0f/0f/5ecc64607ef6f62b04e610b7837b1a802ca6f7cb7211339f5d166d55f1dd/psycopg_binary-3.2.9-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a3e0f89fe35cb03ff1646ab663dabf496477bab2a072315192dbaa6928862891", size = 3776879, upload-time = "2025-05-13T16:07:32.503Z" }, + { url = "https://files.pythonhosted.org/packages/c8/d8/1c3d6e99b7db67946d0eac2cd15d10a79aa7b1e3222ce4aa8e7df72027f5/psycopg_binary-3.2.9-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:6afb3e62f2a3456f2180a4eef6b03177788df7ce938036ff7f09b696d418d186", size = 3333329, upload-time = "2025-05-13T16:07:35.555Z" }, + { url = "https://files.pythonhosted.org/packages/d7/02/a4e82099816559f558ccaf2b6945097973624dc58d5d1c91eb1e54e5a8e9/psycopg_binary-3.2.9-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:cc19ed5c7afca3f6b298bfc35a6baa27adb2019670d15c32d0bb8f780f7d560d", size = 3435683, upload-time = "2025-05-13T16:07:37.863Z" }, + { url = "https://files.pythonhosted.org/packages/91/e4/f27055290d58e8818bed8a297162a096ef7f8ecdf01d98772d4b02af46c4/psycopg_binary-3.2.9-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bc75f63653ce4ec764c8f8c8b0ad9423e23021e1c34a84eb5f4ecac8538a4a4a", size = 3497124, upload-time = "2025-05-13T16:07:40.567Z" }, + { url = "https://files.pythonhosted.org/packages/67/3d/17ed07579625529534605eeaeba34f0536754a5667dbf20ea2624fc80614/psycopg_binary-3.2.9-cp311-cp311-win_amd64.whl", hash = "sha256:3db3ba3c470801e94836ad78bf11fd5fab22e71b0c77343a1ee95d693879937a", size = 2939520, upload-time = "2025-05-13T16:07:45.467Z" }, + { url = "https://files.pythonhosted.org/packages/29/6f/ec9957e37a606cd7564412e03f41f1b3c3637a5be018d0849914cb06e674/psycopg_binary-3.2.9-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:be7d650a434921a6b1ebe3fff324dbc2364393eb29d7672e638ce3e21076974e", size = 4022205, upload-time = "2025-05-13T16:07:48.195Z" }, + { url = "https://files.pythonhosted.org/packages/6b/ba/497b8bea72b20a862ac95a94386967b745a472d9ddc88bc3f32d5d5f0d43/psycopg_binary-3.2.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6a76b4722a529390683c0304501f238b365a46b1e5fb6b7249dbc0ad6fea51a0", size = 4083795, upload-time = "2025-05-13T16:07:50.917Z" }, + { url = "https://files.pythonhosted.org/packages/42/07/af9503e8e8bdad3911fd88e10e6a29240f9feaa99f57d6fac4a18b16f5a0/psycopg_binary-3.2.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:96a551e4683f1c307cfc3d9a05fec62c00a7264f320c9962a67a543e3ce0d8ff", size = 4655043, upload-time = "2025-05-13T16:07:54.857Z" }, + { url = "https://files.pythonhosted.org/packages/28/ed/aff8c9850df1648cc6a5cc7a381f11ee78d98a6b807edd4a5ae276ad60ad/psycopg_binary-3.2.9-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:61d0a6ceed8f08c75a395bc28cb648a81cf8dee75ba4650093ad1a24a51c8724", size = 4477972, upload-time = "2025-05-13T16:07:57.925Z" }, + { url = "https://files.pythonhosted.org/packages/5c/bd/8e9d1b77ec1a632818fe2f457c3a65af83c68710c4c162d6866947d08cc5/psycopg_binary-3.2.9-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ad280bbd409bf598683dda82232f5215cfc5f2b1bf0854e409b4d0c44a113b1d", size = 4737516, upload-time = "2025-05-13T16:08:01.616Z" }, + { url = "https://files.pythonhosted.org/packages/46/ec/222238f774cd5a0881f3f3b18fb86daceae89cc410f91ef6a9fb4556f236/psycopg_binary-3.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76eddaf7fef1d0994e3d536ad48aa75034663d3a07f6f7e3e601105ae73aeff6", size = 4436160, upload-time = "2025-05-13T16:08:04.278Z" }, + { url = "https://files.pythonhosted.org/packages/37/78/af5af2a1b296eeca54ea7592cd19284739a844974c9747e516707e7b3b39/psycopg_binary-3.2.9-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:52e239cd66c4158e412318fbe028cd94b0ef21b0707f56dcb4bdc250ee58fd40", size = 3753518, upload-time = "2025-05-13T16:08:07.567Z" }, + { url = "https://files.pythonhosted.org/packages/ec/ac/8a3ed39ea069402e9e6e6a2f79d81a71879708b31cc3454283314994b1ae/psycopg_binary-3.2.9-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:08bf9d5eabba160dd4f6ad247cf12f229cc19d2458511cab2eb9647f42fa6795", size = 3313598, upload-time = "2025-05-13T16:08:09.999Z" }, + { url = "https://files.pythonhosted.org/packages/da/43/26549af068347c808fbfe5f07d2fa8cef747cfff7c695136172991d2378b/psycopg_binary-3.2.9-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1b2cf018168cad87580e67bdde38ff5e51511112f1ce6ce9a8336871f465c19a", size = 3407289, upload-time = "2025-05-13T16:08:12.66Z" }, + { url = "https://files.pythonhosted.org/packages/67/55/ea8d227c77df8e8aec880ded398316735add8fda5eb4ff5cc96fac11e964/psycopg_binary-3.2.9-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:14f64d1ac6942ff089fc7e926440f7a5ced062e2ed0949d7d2d680dc5c00e2d4", size = 3472493, upload-time = "2025-05-13T16:08:15.672Z" }, + { url = "https://files.pythonhosted.org/packages/3c/02/6ff2a5bc53c3cd653d281666728e29121149179c73fddefb1e437024c192/psycopg_binary-3.2.9-cp312-cp312-win_amd64.whl", hash = "sha256:7a838852e5afb6b4126f93eb409516a8c02a49b788f4df8b6469a40c2157fa21", size = 2927400, upload-time = "2025-05-13T16:08:18.652Z" }, + { url = "https://files.pythonhosted.org/packages/28/0b/f61ff4e9f23396aca674ed4d5c9a5b7323738021d5d72d36d8b865b3deaf/psycopg_binary-3.2.9-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:98bbe35b5ad24a782c7bf267596638d78aa0e87abc7837bdac5b2a2ab954179e", size = 4017127, upload-time = "2025-05-13T16:08:21.391Z" }, + { url = "https://files.pythonhosted.org/packages/bc/00/7e181fb1179fbfc24493738b61efd0453d4b70a0c4b12728e2b82db355fd/psycopg_binary-3.2.9-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:72691a1615ebb42da8b636c5ca9f2b71f266be9e172f66209a361c175b7842c5", size = 4080322, upload-time = "2025-05-13T16:08:24.049Z" }, + { url = "https://files.pythonhosted.org/packages/58/fd/94fc267c1d1392c4211e54ccb943be96ea4032e761573cf1047951887494/psycopg_binary-3.2.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25ab464bfba8c401f5536d5aa95f0ca1dd8257b5202eede04019b4415f491351", size = 4655097, upload-time = "2025-05-13T16:08:27.376Z" }, + { url = "https://files.pythonhosted.org/packages/41/17/31b3acf43de0b2ba83eac5878ff0dea5a608ca2a5c5dd48067999503a9de/psycopg_binary-3.2.9-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0e8aeefebe752f46e3c4b769e53f1d4ad71208fe1150975ef7662c22cca80fab", size = 4482114, upload-time = "2025-05-13T16:08:30.781Z" }, + { url = "https://files.pythonhosted.org/packages/85/78/b4d75e5fd5a85e17f2beb977abbba3389d11a4536b116205846b0e1cf744/psycopg_binary-3.2.9-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b7e4e4dd177a8665c9ce86bc9caae2ab3aa9360b7ce7ec01827ea1baea9ff748", size = 4737693, upload-time = "2025-05-13T16:08:34.625Z" }, + { url = "https://files.pythonhosted.org/packages/3b/95/7325a8550e3388b00b5e54f4ced5e7346b531eb4573bf054c3dbbfdc14fe/psycopg_binary-3.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7fc2915949e5c1ea27a851f7a472a7da7d0a40d679f0a31e42f1022f3c562e87", size = 4437423, upload-time = "2025-05-13T16:08:37.444Z" }, + { url = "https://files.pythonhosted.org/packages/1a/db/cef77d08e59910d483df4ee6da8af51c03bb597f500f1fe818f0f3b925d3/psycopg_binary-3.2.9-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a1fa38a4687b14f517f049477178093c39c2a10fdcced21116f47c017516498f", size = 3758667, upload-time = "2025-05-13T16:08:40.116Z" }, + { url = "https://files.pythonhosted.org/packages/95/3e/252fcbffb47189aa84d723b54682e1bb6d05c8875fa50ce1ada914ae6e28/psycopg_binary-3.2.9-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:5be8292d07a3ab828dc95b5ee6b69ca0a5b2e579a577b39671f4f5b47116dfd2", size = 3320576, upload-time = "2025-05-13T16:08:43.243Z" }, + { url = "https://files.pythonhosted.org/packages/1c/cd/9b5583936515d085a1bec32b45289ceb53b80d9ce1cea0fef4c782dc41a7/psycopg_binary-3.2.9-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:778588ca9897b6c6bab39b0d3034efff4c5438f5e3bd52fda3914175498202f9", size = 3411439, upload-time = "2025-05-13T16:08:47.321Z" }, + { url = "https://files.pythonhosted.org/packages/45/6b/6f1164ea1634c87956cdb6db759e0b8c5827f989ee3cdff0f5c70e8331f2/psycopg_binary-3.2.9-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f0d5b3af045a187aedbd7ed5fc513bd933a97aaff78e61c3745b330792c4345b", size = 3477477, upload-time = "2025-05-13T16:08:51.166Z" }, + { url = "https://files.pythonhosted.org/packages/7b/1d/bf54cfec79377929da600c16114f0da77a5f1670f45e0c3af9fcd36879bc/psycopg_binary-3.2.9-cp313-cp313-win_amd64.whl", hash = "sha256:2290bc146a1b6a9730350f695e8b670e1d1feb8446597bed0bbe7c3c30e0abcb", size = 2928009, upload-time = "2025-05-13T16:08:53.67Z" }, +] + [[package]] name = "pycares" version = "4.8.0" @@ -3126,6 +3200,9 @@ aiosqlite = [ { name = "greenlet" }, { name = "typing-extensions" }, ] +postgresql-psycopgbinary = [ + { name = "psycopg", extra = ["binary"] }, +] [[package]] name = "starlette" From c1a567f2a6022e3536b8dcbd2b8864cee7ec3b92 Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Wed, 4 Jun 2025 02:02:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=BF=81=E7=A7=BB=E8=84=9A=E6=9C=AC=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpgsql=2063=E5=AD=97=E6=AE=B5=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3c25a5a8c050_refactor_historical.py | 83 +++++++++++-------- .../9f6582279ce2_recreate_historical_data.py | 24 +++--- ...44837693_migrate_to_nonobot_plugin_user.py | 10 +-- ...9a_add_user_unique_identifier_field_to_.py | 2 +- ...eab6961dce_extend_api_type_field_length.py | 4 +- .../f5b4a6d1325b_tetr_io_new_season.py | 32 +++---- 6 files changed, 86 insertions(+), 69 deletions(-) diff --git a/nonebot_plugin_tetris_stats/config/migrations/3c25a5a8c050_refactor_historical.py b/nonebot_plugin_tetris_stats/config/migrations/3c25a5a8c050_refactor_historical.py index 00e5c17..7e1b151 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/3c25a5a8c050_refactor_historical.py +++ b/nonebot_plugin_tetris_stats/config/migrations/3c25a5a8c050_refactor_historical.py @@ -17,6 +17,7 @@ from rich.progress import BarColumn, MofNCompleteColumn, Progress, TaskProgressColumn, TextColumn, TimeRemainingColumn from sqlalchemy import desc, select from sqlalchemy.dialects import sqlite +from sqlalchemy.exc import IdentifierError from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session @@ -205,12 +206,16 @@ def upgrade(name: str = '') -> None: migrate_old_data() - with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_command_type') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_game_platform') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_source_account') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_source_type') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_user_unique_identifier') + try: + with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_command_type') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_game_platform') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_source_account') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_source_type') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_user_unique_identifier') + except IdentifierError: + with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_historicaldata_user_uniq_5301') op.drop_table('nonebot_plugin_tetris_stats_historicaldata') # ### end Alembic commands ### @@ -222,40 +227,48 @@ def downgrade(name: str = '') -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'nonebot_plugin_tetris_stats_historicaldata', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('trigger_time', sa.DATETIME(), nullable=False), - sa.Column('bot_platform', sa.VARCHAR(length=32), nullable=True), - sa.Column('bot_account', sa.VARCHAR(), nullable=True), - sa.Column('source_type', sa.VARCHAR(length=32), nullable=True), - sa.Column('source_account', sa.VARCHAR(), nullable=True), - sa.Column('message', sa.BLOB(), nullable=True), - sa.Column('game_platform', sa.VARCHAR(length=32), nullable=False), - sa.Column('command_type', sa.VARCHAR(length=16), nullable=False), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('trigger_time', sa.DateTime(), nullable=False), + sa.Column('bot_platform', sa.String(length=32), nullable=True), + sa.Column('bot_account', sa.String(), nullable=True), + sa.Column('source_type', sa.String(length=32), nullable=True), + sa.Column('source_account', sa.String(), nullable=True), + sa.Column('message', sa.PickleType(), nullable=True), + sa.Column('game_platform', sa.String(length=32), nullable=False), + sa.Column('command_type', sa.String(length=16), nullable=False), sa.Column('command_args', sqlite.JSON(), nullable=False), sa.Column('game_user', sqlite.JSON(), nullable=False), sa.Column('processed_data', sqlite.JSON(), nullable=False), - sa.Column('finish_time', sa.DATETIME(), nullable=False), - sa.Column('user_unique_identifier', sa.VARCHAR(length=32), nullable=False), + sa.Column('finish_time', sa.DateTime(), nullable=False), + sa.Column('user_unique_identifier', sa.String(length=32), nullable=False), sa.PrimaryKeyConstraint('id', name='pk_nonebot_plugin_tetris_stats_historicaldata'), ) - with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: - batch_op.create_index( - 'ix_nonebot_plugin_tetris_stats_historicaldata_user_unique_identifier', - ['user_unique_identifier'], - unique=False, - ) - batch_op.create_index( - 'ix_nonebot_plugin_tetris_stats_historicaldata_source_type', ['source_type'], unique=False - ) - batch_op.create_index( - 'ix_nonebot_plugin_tetris_stats_historicaldata_source_account', ['source_account'], unique=False - ) - batch_op.create_index( - 'ix_nonebot_plugin_tetris_stats_historicaldata_game_platform', ['game_platform'], unique=False - ) - batch_op.create_index( - 'ix_nonebot_plugin_tetris_stats_historicaldata_command_type', ['command_type'], unique=False - ) + try: + with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_source_type', ['source_type'], unique=False + ) + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_source_account', ['source_account'], unique=False + ) + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_game_platform', ['game_platform'], unique=False + ) + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_command_type', ['command_type'], unique=False + ) + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_user_unique_identifier', + ['user_unique_identifier'], + unique=False, + ) + except IdentifierError: + with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: + batch_op.create_index( + 'ix_nonebot_plugin_tetris_stats_historicaldata_user_uniq_5301', + ['user_unique_identifier'], + unique=False, + ) with op.batch_alter_table('nonebot_plugin_tetris_stats_triggerhistoricaldata', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_nonebot_plugin_tetris_stats_triggerhistoricaldata_game_platform')) diff --git a/nonebot_plugin_tetris_stats/config/migrations/9f6582279ce2_recreate_historical_data.py b/nonebot_plugin_tetris_stats/config/migrations/9f6582279ce2_recreate_historical_data.py index 8d835fb..508bb46 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/9f6582279ce2_recreate_historical_data.py +++ b/nonebot_plugin_tetris_stats/config/migrations/9f6582279ce2_recreate_historical_data.py @@ -82,19 +82,19 @@ def downgrade(name: str = '') -> None: op.create_table( 'nonebot_plugin_tetris_stats_historicaldata', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('trigger_time', sa.DATETIME(), nullable=False), - sa.Column('bot_platform', sa.VARCHAR(length=32), nullable=True), - sa.Column('bot_account', sa.VARCHAR(), nullable=True), - sa.Column('source_type', sa.VARCHAR(length=32), nullable=True), - sa.Column('source_account', sa.VARCHAR(), nullable=True), - sa.Column('message', sa.BLOB(), nullable=True), - sa.Column('game_platform', sa.VARCHAR(length=32), nullable=False), - sa.Column('command_type', sa.VARCHAR(length=16), nullable=False), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('trigger_time', sa.DateTime(), nullable=False), + sa.Column('bot_platform', sa.String(length=32), nullable=True), + sa.Column('bot_account', sa.String(), nullable=True), + sa.Column('source_type', sa.String(length=32), nullable=True), + sa.Column('source_account', sa.String(), nullable=True), + sa.Column('message', sa.PickleType(), nullable=True), + sa.Column('game_platform', sa.String(length=32), nullable=False), + sa.Column('command_type', sa.String(length=16), nullable=False), sa.Column('command_args', sqlite.JSON(), nullable=False), - sa.Column('game_user', sa.BLOB(), nullable=False), - sa.Column('processed_data', sa.BLOB(), nullable=False), - sa.Column('finish_time', sa.DATETIME(), nullable=False), + sa.Column('game_user', sa.PickleType(), nullable=False), + sa.Column('processed_data', sa.PickleType(), nullable=False), + sa.Column('finish_time', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id', name='pk_nonebot_plugin_tetris_stats_historicaldata'), ) with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: diff --git a/nonebot_plugin_tetris_stats/config/migrations/b15844837693_migrate_to_nonobot_plugin_user.py b/nonebot_plugin_tetris_stats/config/migrations/b15844837693_migrate_to_nonobot_plugin_user.py index 0c6fc75..654538a 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/b15844837693_migrate_to_nonobot_plugin_user.py +++ b/nonebot_plugin_tetris_stats/config/migrations/b15844837693_migrate_to_nonobot_plugin_user.py @@ -57,11 +57,11 @@ def downgrade(name: str = '') -> None: op.create_table( 'nonebot_plugin_tetris_stats_bind', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('chat_platform', sa.VARCHAR(length=32), nullable=False), - sa.Column('chat_account', sa.VARCHAR(), nullable=False), - sa.Column('game_platform', sa.VARCHAR(length=32), nullable=False), - sa.Column('game_account', sa.VARCHAR(), nullable=False), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('chat_platform', sa.String(length=32), nullable=False), + sa.Column('chat_account', sa.String(), nullable=False), + sa.Column('game_platform', sa.String(length=32), nullable=False), + sa.Column('game_account', sa.String(), nullable=False), sa.PrimaryKeyConstraint('id', name='pk_nonebot_plugin_tetris_stats_bind'), ) with op.batch_alter_table('nonebot_plugin_tetris_stats_bind', schema=None) as batch_op: diff --git a/nonebot_plugin_tetris_stats/config/migrations/b7fbdafc339a_add_user_unique_identifier_field_to_.py b/nonebot_plugin_tetris_stats/config/migrations/b7fbdafc339a_add_user_unique_identifier_field_to_.py index 544aadb..894fa87 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/b7fbdafc339a_add_user_unique_identifier_field_to_.py +++ b/nonebot_plugin_tetris_stats/config/migrations/b7fbdafc339a_add_user_unique_identifier_field_to_.py @@ -96,7 +96,7 @@ def json_to_model(value: str) -> BaseUser: progress.update(task_id, advance=1) session.commit() with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op: - batch_op.alter_column('user_unique_identifier', existing_type=sa.VARCHAR(length=32), nullable=False) + batch_op.alter_column('user_unique_identifier', existing_type=sa.String(length=32), nullable=False) logger.success('database upgrade success') diff --git a/nonebot_plugin_tetris_stats/config/migrations/cfeab6961dce_extend_api_type_field_length.py b/nonebot_plugin_tetris_stats/config/migrations/cfeab6961dce_extend_api_type_field_length.py index 981f9a5..d2427be 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/cfeab6961dce_extend_api_type_field_length.py +++ b/nonebot_plugin_tetris_stats/config/migrations/cfeab6961dce_extend_api_type_field_length.py @@ -29,7 +29,7 @@ def upgrade(name: str = '') -> None: # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('nonebot_plugin_tetris_stats_tetriohistoricaldata', schema=None) as batch_op: batch_op.alter_column( - 'api_type', existing_type=sa.VARCHAR(length=16), type_=sa.String(length=32), existing_nullable=False + 'api_type', existing_type=sa.String(length=16), type_=sa.String(length=32), existing_nullable=False ) # ### end Alembic commands ### @@ -44,7 +44,7 @@ def downgrade(name: str = '') -> None: input('如果确认可以迁移, 请按回车键继续!') with op.batch_alter_table('nonebot_plugin_tetris_stats_tetriohistoricaldata', schema=None) as batch_op: batch_op.alter_column( - 'api_type', existing_type=sa.String(length=32), type_=sa.VARCHAR(length=16), existing_nullable=False + 'api_type', existing_type=sa.String(length=32), type_=sa.String(length=16), existing_nullable=False ) # ### end Alembic commands ### diff --git a/nonebot_plugin_tetris_stats/config/migrations/f5b4a6d1325b_tetr_io_new_season.py b/nonebot_plugin_tetris_stats/config/migrations/f5b4a6d1325b_tetr_io_new_season.py index 554b6f9..e430fd3 100644 --- a/nonebot_plugin_tetris_stats/config/migrations/f5b4a6d1325b_tetr_io_new_season.py +++ b/nonebot_plugin_tetris_stats/config/migrations/f5b4a6d1325b_tetr_io_new_season.py @@ -12,6 +12,7 @@ import sqlalchemy as sa from alembic import op +from sqlalchemy.exc import IdentifierError if TYPE_CHECKING: from collections.abc import Sequence @@ -31,11 +32,14 @@ def upgrade(name: str = '') -> None: batch_op.drop_index('ix_nonebot_plugin_tetris_stats_iorank_update_time') op.drop_table('nonebot_plugin_tetris_stats_iorank') - - with op.batch_alter_table('nonebot_plugin_tetris_stats_tetriohistoricaldata', schema=None) as batch_op: - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_api_type') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_update_time') - batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_user_unique_identifier') + try: + with op.batch_alter_table('nonebot_plugin_tetris_stats_tetriohistoricaldata', schema=None) as batch_op: + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_api_type') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_update_time') + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_user_unique_identifier') + except IdentifierError: + with op.batch_alter_table('nonebot_plugin_tetris_stats_tetriohistoricaldata', schema=None) as batch_op: + batch_op.drop_index('ix_nonebot_plugin_tetris_stats_tetriohistoricaldata_use_4888') op.drop_table('nonebot_plugin_tetris_stats_tetriohistoricaldata') @@ -68,21 +72,21 @@ def downgrade(name: str = '') -> None: return op.create_table( 'nonebot_plugin_tetris_stats_iorank', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('rank', sa.VARCHAR(length=2), nullable=False), - sa.Column('tr_line', sa.FLOAT(), nullable=False), - sa.Column('player_count', sa.INTEGER(), nullable=False), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('rank', sa.String(length=2), nullable=False), + sa.Column('tr_line', sa.Float(), nullable=False), + sa.Column('player_count', sa.Integer(), nullable=False), sa.Column('low_pps', sa.JSON(), nullable=False), sa.Column('low_apm', sa.JSON(), nullable=False), sa.Column('low_vs', sa.JSON(), nullable=False), - sa.Column('avg_pps', sa.FLOAT(), nullable=False), - sa.Column('avg_apm', sa.FLOAT(), nullable=False), - sa.Column('avg_vs', sa.FLOAT(), nullable=False), + sa.Column('avg_pps', sa.Float(), nullable=False), + sa.Column('avg_apm', sa.Float(), nullable=False), + sa.Column('avg_vs', sa.Float(), nullable=False), sa.Column('high_pps', sa.JSON(), nullable=False), sa.Column('high_apm', sa.JSON(), nullable=False), sa.Column('high_vs', sa.JSON(), nullable=False), - sa.Column('update_time', sa.DATETIME(), nullable=False), - sa.Column('file_hash', sa.VARCHAR(length=128), nullable=True), + sa.Column('update_time', sa.DateTime(), nullable=False), + sa.Column('file_hash', sa.String(length=128), nullable=True), sa.PrimaryKeyConstraint('id', name='pk_nonebot_plugin_tetris_stats_iorank'), ) with op.batch_alter_table('nonebot_plugin_tetris_stats_iorank', schema=None) as batch_op: