From db90f919b4492740e4153375d4f6ef84a628cd36 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Thu, 26 Dec 2024 14:08:32 +0300 Subject: [PATCH] Feat: removed migrations --- migrations/001_initial.py | 52 --------------------------------------- poetry.lock | 42 +------------------------------ pyproject.toml | 1 - 3 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 migrations/001_initial.py diff --git a/migrations/001_initial.py b/migrations/001_initial.py deleted file mode 100644 index c22e2a6..0000000 --- a/migrations/001_initial.py +++ /dev/null @@ -1,52 +0,0 @@ -"""Peewee migrations -- 001_initial.py. - -Some examples (model - class or model name):: - - > Model = migrator.orm['table_name'] # Return model in current state by name - > Model = migrator.ModelClass # Return model in current state by name - - > migrator.sql(sql) # Run custom SQL - > migrator.run(func, *args, **kwargs) # Run python function with the given args - > migrator.create_model(Model) # Create a model (could be used as decorator) - > migrator.remove_model(model, cascade=True) # Remove a model - > migrator.add_fields(model, **fields) # Add fields to a model - > migrator.change_fields(model, **fields) # Change fields - > migrator.remove_fields(model, *field_names, cascade=True) - > migrator.rename_field(model, old_field_name, new_field_name) - > migrator.rename_table(model, new_table_name) - > migrator.add_index(model, *col_names, unique=False) - > migrator.add_not_null(model, *field_names) - > migrator.add_default(model, field_name, default) - > migrator.add_constraint(model, name, sql) - > migrator.drop_index(model, *col_names) - > migrator.drop_not_null(model, *field_names) - > migrator.drop_constraints(model, *constraints) - -""" - -from contextlib import suppress - -import peewee as pw -from peewee_migrate import Migrator - - -with suppress(ImportError): - import playhouse.postgres_ext as pw_pext - - -def migrate(migrator: Migrator, database: pw.Database, *, fake=False): - """Write your migrations here.""" - - @migrator.create_model - class User(pw.Model): - name = pw.CharField(max_length=255) - url = pw.CharField(max_length=255) - - class Meta: - table_name = "user" - - -def rollback(migrator: Migrator, database: pw.Database, *, fake=False): - """Write your rollback migrations here.""" - - migrator.remove_model('user') diff --git a/poetry.lock b/poetry.lock index 1272c3a..40127c9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -231,20 +231,6 @@ files = [ {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, ] -[[package]] -name = "click" -version = "8.1.8" -description = "Composable command line interface toolkit" -optional = false -python-versions = ">=3.7" -files = [ - {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, - {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - [[package]] name = "codefind" version = "0.1.7" @@ -256,17 +242,6 @@ files = [ {file = "codefind-0.1.7.tar.gz", hash = "sha256:a2ec8a2c0180399ea838dfcdcc344ca89f97b8aa293bc17b22b2c023aba06fbc"}, ] -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - [[package]] name = "frozenlist" version = "1.5.0" @@ -552,21 +527,6 @@ files = [ {file = "peewee-3.17.8.tar.gz", hash = "sha256:ce1d05db3438830b989a1b9d0d0aa4e7f6134d5f6fd57686eeaa26a3e6485a8c"}, ] -[[package]] -name = "peewee-migrate" -version = "1.13.0" -description = "Support for migrations in Peewee ORM" -optional = false -python-versions = "<4.0,>=3.8" -files = [ - {file = "peewee_migrate-1.13.0-py3-none-any.whl", hash = "sha256:66597f5b8549a8ff456915db60e8382daf7839eef79352027e7cf54feec56860"}, - {file = "peewee_migrate-1.13.0.tar.gz", hash = "sha256:1ab67f72a0936006155e1b310c18a32f79e4dff3917cfeb10112ca92518721e5"}, -] - -[package.dependencies] -click = "*" -peewee = ">=3,<4" - [[package]] name = "propcache" version = "0.2.1" @@ -1125,4 +1085,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = "^3.13" -content-hash = "b188ccad172039aff2c87caff7eb3cbfe16e400453521bae06b3770fef5a752d" +content-hash = "9b455b4a27b4038063fad5d023c0d2af06d7277a9b7ee02cc2d366e458f195b4" diff --git a/pyproject.toml b/pyproject.toml index 1b57c50..c50a0dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ peewee = "^3.17.8" uvloop = "^0.21.0" jurigged = "^0.6.0" psycopg2-binary = "^2.9.10" -peewee-migrate = "^1.13.0" [build-system]