postgresdb3 1.0.1__tar.gz → 1.0.3__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.
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/PKG-INFO +1 -1
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/migrations/engine.py +3 -2
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/models.py +0 -44
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3.egg-info/PKG-INFO +1 -1
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/setup.py +1 -1
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/README.md +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/__init__.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/cli.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/core/__init__.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/core/async_db.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/core/sync_db.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/migrations/__init__.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/__init__.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/base.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/expressions.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/__init__.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/base.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/datetime.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/foreign.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/misc.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/numeric.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/fields/text.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/meta.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/query.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3/orm/relations.py +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3.egg-info/SOURCES.txt +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3.egg-info/dependency_links.txt +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3.egg-info/requires.txt +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/postgresdb3.egg-info/top_level.txt +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/pyproject.toml +0 -0
- {postgresdb3-1.0.1 → postgresdb3-1.0.3}/setup.cfg +0 -0
|
@@ -22,9 +22,10 @@ class MigrationEngine:
|
|
|
22
22
|
if getattr(field, "primary_key", False):
|
|
23
23
|
fields[field_name] += " PRIMARY KEY"
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
if not any(getattr(f, "primary_key", False) for f in model._fields.values()):
|
|
27
|
-
|
|
26
|
+
ordered_fields = {model.get_pk_name(): "SERIAL PRIMARY KEY"}
|
|
27
|
+
ordered_fields.update(fields)
|
|
28
|
+
fields = ordered_fields
|
|
28
29
|
|
|
29
30
|
meta_options = getattr(model, "_meta_options", {})
|
|
30
31
|
state[table_name] = {
|
|
@@ -149,28 +149,6 @@ class Model(BaseModel, metaclass=ModelMeta):
|
|
|
149
149
|
|
|
150
150
|
cls.db._manager(sql, values_list, commit=True, many=True)
|
|
151
151
|
|
|
152
|
-
@classmethod
|
|
153
|
-
def create_table(cls):
|
|
154
|
-
cls._check_setup()
|
|
155
|
-
|
|
156
|
-
columns_sql = []
|
|
157
|
-
has_primary_key = False
|
|
158
|
-
|
|
159
|
-
for field_name, field in cls._fields.items():
|
|
160
|
-
if getattr(field, "primary_key", False):
|
|
161
|
-
has_primary_key = True
|
|
162
|
-
columns_sql.append(field.to_sql())
|
|
163
|
-
|
|
164
|
-
if not has_primary_key:
|
|
165
|
-
columns_sql.insert(0, f"{cls.get_pk_name()} SERIAL PRIMARY KEY")
|
|
166
|
-
|
|
167
|
-
cls.db.create(cls.table, ", ".join(columns_sql))
|
|
168
|
-
|
|
169
|
-
@classmethod
|
|
170
|
-
def drop_table(cls, cascade=False):
|
|
171
|
-
cls._check_setup()
|
|
172
|
-
cls.db.drop(cls.table, cascade=cascade)
|
|
173
|
-
|
|
174
152
|
def save(self):
|
|
175
153
|
self.__class__._check_setup()
|
|
176
154
|
|
|
@@ -385,28 +363,6 @@ class AsyncModel(BaseModel, metaclass=ModelMeta):
|
|
|
385
363
|
|
|
386
364
|
await cls.db._manager(sql, values_list, commit=True, many=True)
|
|
387
365
|
|
|
388
|
-
@classmethod
|
|
389
|
-
async def create_table(cls):
|
|
390
|
-
cls._check_setup()
|
|
391
|
-
|
|
392
|
-
columns_sql = []
|
|
393
|
-
has_primary_key = False
|
|
394
|
-
|
|
395
|
-
for field_name, field in cls._fields.items():
|
|
396
|
-
if getattr(field, "primary_key", False):
|
|
397
|
-
has_primary_key = True
|
|
398
|
-
columns_sql.append(field.to_sql())
|
|
399
|
-
|
|
400
|
-
if not has_primary_key:
|
|
401
|
-
columns_sql.insert(0, f"{cls.get_pk_name()} SERIAL PRIMARY KEY")
|
|
402
|
-
|
|
403
|
-
await cls.db.create(cls.table, ", ".join(columns_sql))
|
|
404
|
-
|
|
405
|
-
@classmethod
|
|
406
|
-
async def drop_table(cls, cascade=False):
|
|
407
|
-
cls._check_setup()
|
|
408
|
-
await cls.db.drop(cls.table, cascade=cascade)
|
|
409
|
-
|
|
410
366
|
async def save(self):
|
|
411
367
|
self.__class__._check_setup()
|
|
412
368
|
|
|
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
|