plain.models 0.43.0__tar.gz → 0.45.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plain_models-0.43.0 → plain_models-0.45.0}/.gitignore +0 -2
- {plain_models-0.43.0 → plain_models-0.45.0}/PKG-INFO +1 -1
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/CHANGELOG.md +21 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/base.py +7 -1
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/features.py +1 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backups/clients.py +31 -13
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/base.py +1 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/pyproject.toml +1 -1
- {plain_models-0.43.0 → plain_models-0.45.0}/LICENSE +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/README.md +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/AGENTS.md +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/README.md +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/aggregates.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/base.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/client.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/creation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/features.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/introspection.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/operations.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/schema.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/base/validation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/ddl_references.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/base.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/client.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/compiler.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/creation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/features.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/introspection.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/operations.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/schema.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/mysql/validation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/base.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/client.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/creation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/features.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/introspection.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/operations.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/schema.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/_functions.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/client.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/creation.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/introspection.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/operations.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/sqlite3/schema.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/utils.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backups/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backups/cli.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backups/core.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/cli.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/config.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/connections.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/constants.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/constraints.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/database_url.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/db.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/default_settings.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/deletion.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/entrypoints.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/enums.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/exceptions.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/expressions.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/json.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/mixins.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/related.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/related_descriptors.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/related_lookups.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/related_managers.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/fields/reverse_related.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/forms.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/comparison.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/datetime.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/math.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/mixins.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/text.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/functions/window.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/indexes.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/lookups.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/autodetector.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/exceptions.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/executor.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/graph.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/loader.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/migration.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/operations/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/operations/base.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/operations/fields.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/operations/models.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/operations/special.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/optimizer.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/questioner.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/recorder.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/serializer.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/state.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/utils.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/migrations/writer.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/options.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/otel.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/preflight.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/query.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/query_utils.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/registry.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/compiler.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/constants.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/datastructures.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/query.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/subqueries.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/sql/where.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/test/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/test/pytest.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/test/utils.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/transaction.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/plain/models/utils.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/migrations/0001_initial.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/migrations/0002_test_field_removed.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/migrations/0003_deleteparent_childsetnull_childsetdefault_and_more.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/migrations/__init__.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/models.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/settings.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/app/urls.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_database_url.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_delete_behaviors.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_exceptions.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_manager_assignment.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_models.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_related_descriptors.py +0 -0
- {plain_models-0.43.0 → plain_models-0.45.0}/tests/test_related_manager_api.py +0 -0
@@ -1,5 +1,26 @@
|
|
1
1
|
# plain-models changelog
|
2
2
|
|
3
|
+
## [0.45.0](https://github.com/dropseed/plain/releases/plain-models@0.45.0) (2025-09-21)
|
4
|
+
|
5
|
+
### What's changed
|
6
|
+
|
7
|
+
- Added unlimited varchar support to SQLite - CharField fields without a max_length now generate `varchar` columns instead of `varchar()` with no length specified ([c5c0c3a](https://github.com/dropseed/plain/commit/c5c0c3a743))
|
8
|
+
|
9
|
+
### Upgrade instructions
|
10
|
+
|
11
|
+
- No changes required
|
12
|
+
|
13
|
+
## [0.44.0](https://github.com/dropseed/plain/releases/plain-models@0.44.0) (2025-09-19)
|
14
|
+
|
15
|
+
### What's changed
|
16
|
+
|
17
|
+
- PostgreSQL backup restoration now drops and recreates the database instead of using `pg_restore --clean`, providing more reliable restoration by terminating active connections and ensuring a completely clean database state ([a8865fe](https://github.com/dropseed/plain/commit/a8865fe5d6))
|
18
|
+
- Added `_meta` type annotation to the `Model` class for improved type checking and IDE support ([387b92e](https://github.com/dropseed/plain/commit/387b92e08b))
|
19
|
+
|
20
|
+
### Upgrade instructions
|
21
|
+
|
22
|
+
- No changes required
|
23
|
+
|
3
24
|
## [0.43.0](https://github.com/dropseed/plain/releases/plain-models@0.43.0) (2025-09-12)
|
4
25
|
|
5
26
|
### What's changed
|
@@ -39,6 +39,12 @@ def adapt_datetime(val):
|
|
39
39
|
return val.isoformat(" ")
|
40
40
|
|
41
41
|
|
42
|
+
def _get_varchar_column(data):
|
43
|
+
if data["max_length"] is None:
|
44
|
+
return "varchar"
|
45
|
+
return "varchar({max_length})".format(**data)
|
46
|
+
|
47
|
+
|
42
48
|
Database.register_converter("bool", b"1".__eq__)
|
43
49
|
Database.register_converter("date", decoder(parse_date))
|
44
50
|
Database.register_converter("time", decoder(parse_time))
|
@@ -60,7 +66,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
60
66
|
"PrimaryKeyField": "integer",
|
61
67
|
"BinaryField": "BLOB",
|
62
68
|
"BooleanField": "bool",
|
63
|
-
"CharField":
|
69
|
+
"CharField": _get_varchar_column,
|
64
70
|
"DateField": "date",
|
65
71
|
"DateTimeField": "datetime",
|
66
72
|
"DecimalField": "decimal",
|
@@ -31,6 +31,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|
31
31
|
supports_json_field_contains = False
|
32
32
|
supports_update_conflicts = Database.sqlite_version_info >= (3, 24, 0)
|
33
33
|
supports_update_conflicts_with_target = supports_update_conflicts
|
34
|
+
supports_unlimited_charfield = True
|
34
35
|
|
35
36
|
@cached_property
|
36
37
|
def supports_atomic_references_rename(self):
|
@@ -64,29 +64,47 @@ class PostgresBackupClient:
|
|
64
64
|
cmd, env={**os.environ, **self.get_env()}, check=True, shell=True
|
65
65
|
)
|
66
66
|
|
67
|
-
def restore_backup(self, backup_path, *, pg_restore="pg_restore"):
|
67
|
+
def restore_backup(self, backup_path, *, pg_restore="pg_restore", psql="psql"):
|
68
68
|
settings_dict = self.connection.settings_dict
|
69
69
|
|
70
|
-
args = pg_restore.split()
|
71
|
-
options = settings_dict.get("OPTIONS", {})
|
72
|
-
|
73
70
|
host = settings_dict.get("HOST")
|
74
71
|
port = settings_dict.get("PORT")
|
75
72
|
dbname = settings_dict.get("NAME")
|
76
73
|
user = settings_dict.get("USER")
|
77
|
-
service = options.get("service")
|
78
74
|
|
79
|
-
|
80
|
-
|
81
|
-
dbname = "postgres"
|
75
|
+
# Build common connection args
|
76
|
+
conn_args = []
|
82
77
|
if user:
|
83
|
-
|
78
|
+
conn_args += ["-U", user]
|
84
79
|
if host:
|
85
|
-
|
80
|
+
conn_args += ["-h", host]
|
86
81
|
if port:
|
87
|
-
|
88
|
-
|
89
|
-
|
82
|
+
conn_args += ["-p", str(port)]
|
83
|
+
|
84
|
+
# First, drop and recreate the database
|
85
|
+
# Connect to 'template1' database to do this (works for all databases including 'postgres')
|
86
|
+
drop_create_cmds = [
|
87
|
+
f"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '{dbname}' AND pid <> pg_backend_pid()",
|
88
|
+
f'DROP DATABASE IF EXISTS "{dbname}"',
|
89
|
+
f'CREATE DATABASE "{dbname}"',
|
90
|
+
]
|
91
|
+
|
92
|
+
for cmd in drop_create_cmds:
|
93
|
+
psql_args = (
|
94
|
+
psql.split()
|
95
|
+
+ conn_args
|
96
|
+
+ [
|
97
|
+
"-d",
|
98
|
+
"template1", # Always use template1
|
99
|
+
"-c",
|
100
|
+
cmd,
|
101
|
+
]
|
102
|
+
)
|
103
|
+
subprocess.run(psql_args, env={**os.environ, **self.get_env()}, check=True)
|
104
|
+
|
105
|
+
# Now restore into the fresh database
|
106
|
+
args = pg_restore.split()
|
107
|
+
args += conn_args
|
90
108
|
args += ["-d", dbname]
|
91
109
|
|
92
110
|
# Using stdin/stdout let's us use executables from within a docker container too
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{plain_models-0.43.0 → plain_models-0.45.0}/plain/models/backends/postgresql/introspection.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{plain_models-0.43.0 → plain_models-0.45.0}/tests/app/examples/migrations/0002_test_field_removed.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|