masonite-orm 2.20.0__tar.gz → 2.22.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.
- {masonite-orm-2.20.0/src/masonite_orm.egg-info → masonite-orm-2.22.0}/PKG-INFO +1 -1
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/setup.py +1 -1
- {masonite-orm-2.20.0 → masonite-orm-2.22.0/src/masonite_orm.egg-info}/PKG-INFO +1 -1
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/collection/Collection.py +32 -6
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/MySQLConnection.py +3 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/models/Model.py +17 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/QueryBuilder.py +17 -4
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/BelongsTo.py +2 -4
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/HasMany.py +1 -1
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/MorphTo.py +1 -1
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/TimeStampsScope.py +3 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/MANIFEST.in +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/README.md +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/setup.cfg +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masonite_orm.egg-info/SOURCES.txt +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masonite_orm.egg-info/dependency_links.txt +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masonite_orm.egg-info/entry_points.txt +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masonite_orm.egg-info/requires.txt +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masonite_orm.egg-info/top_level.txt +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/collection/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/CanOverrideConfig.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/CanOverrideOptionsDefault.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/Command.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/Entry.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeMigrationCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeModelCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeModelDocstringCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeObserverCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeSeedCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateFreshCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateRefreshCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateResetCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateRollbackCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateStatusCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/SeedRunCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/ShellCommand.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/create_migration.stub +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/create_seed.stub +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/model.stub +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/observer.stub +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/table_migration.stub +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/config.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/BaseConnection.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/ConnectionFactory.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/ConnectionResolver.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/MSSQLConnection.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/PostgresConnection.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/SQLiteConnection.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/exceptions.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/expressions/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/expressions/expressions.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/factories/Factory.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/factories/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/helpers/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/helpers/misc.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/migrations/Migration.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/migrations/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/models/MigrationModel.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/models/Pivot.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/models/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/observers/ObservesEvents.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/observers/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/pagination/BasePaginator.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/pagination/LengthAwarePaginator.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/pagination/SimplePaginator.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/pagination/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/providers/ORMProvider.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/providers/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/EagerRelation.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/BaseGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/MSSQLGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/MySQLGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/PostgresGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/SQLiteGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/MSSQLPostProcessor.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/MySQLPostProcessor.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/PostgresPostProcessor.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/SQLitePostProcessor.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/BaseRelationship.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/BelongsToMany.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/HasManyThrough.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/HasOne.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/HasOneThrough.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/MorphMany.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/MorphOne.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/MorphToMany.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Blueprint.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Column.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/ColumnDiff.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Constraint.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/ForeignKeyConstraint.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Index.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Schema.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/Table.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/TableDiff.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/MSSQLPlatform.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/MySQLPlatform.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/Platform.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/PostgresPlatform.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/SQLitePlatform.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/BaseScope.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/SoftDeleteScope.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/SoftDeletesMixin.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/TimeStampsMixin.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/UUIDPrimaryKeyMixin.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/UUIDPrimaryKeyScope.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/scopes/scope.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/seeds/Seeder.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/seeds/__init__.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/testing/BaseTestCaseSelectGrammar.py +0 -0
- {masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/testing/__init__.py +0 -0
|
@@ -8,7 +8,7 @@ setup(
|
|
|
8
8
|
# Versions should comply with PEP440. For a discussion on single-sourcing
|
|
9
9
|
# the version across setup.py and the project code, see
|
|
10
10
|
# https://packaging.python.org/en/latest/single_source_version.html
|
|
11
|
-
version="2.
|
|
11
|
+
version="2.22.0",
|
|
12
12
|
package_dir={"": "src"},
|
|
13
13
|
description="The Official Masonite ORM",
|
|
14
14
|
long_description=long_description,
|
|
@@ -40,6 +40,7 @@ class Collection:
|
|
|
40
40
|
if callback:
|
|
41
41
|
filtered = self.filter(callback)
|
|
42
42
|
response = None
|
|
43
|
+
|
|
43
44
|
if filtered:
|
|
44
45
|
response = filtered[0]
|
|
45
46
|
return response
|
|
@@ -91,15 +92,15 @@ class Collection:
|
|
|
91
92
|
return result
|
|
92
93
|
|
|
93
94
|
def max(self, key=None):
|
|
94
|
-
"""Returns the
|
|
95
|
+
"""Returns the max of the items.
|
|
95
96
|
|
|
96
|
-
If a key is given it will return the
|
|
97
|
+
If a key is given it will return the max of all the values of the key.
|
|
97
98
|
|
|
98
99
|
Keyword Arguments:
|
|
99
|
-
key {string} -- The key to use to find the
|
|
100
|
+
key {string} -- The key to use to find the max of all the values of that key. (default: {None})
|
|
100
101
|
|
|
101
102
|
Returns:
|
|
102
|
-
int -- Returns the
|
|
103
|
+
int -- Returns the max.
|
|
103
104
|
"""
|
|
104
105
|
result = 0
|
|
105
106
|
items = self._get_value(key) or self._items
|
|
@@ -110,6 +111,26 @@ class Collection:
|
|
|
110
111
|
pass
|
|
111
112
|
return result
|
|
112
113
|
|
|
114
|
+
def min(self, key=None):
|
|
115
|
+
"""Returns the min of the items.
|
|
116
|
+
|
|
117
|
+
If a key is given it will return the min of all the values of the key.
|
|
118
|
+
|
|
119
|
+
Keyword Arguments:
|
|
120
|
+
key {string} -- The key to use to find the min of all the values of that key. (default: {None})
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
int -- Returns the min.
|
|
124
|
+
"""
|
|
125
|
+
result = 0
|
|
126
|
+
items = self._get_value(key) or self._items
|
|
127
|
+
|
|
128
|
+
try:
|
|
129
|
+
return min(items)
|
|
130
|
+
except (TypeError, ValueError):
|
|
131
|
+
pass
|
|
132
|
+
return result
|
|
133
|
+
|
|
113
134
|
def chunk(self, size: int):
|
|
114
135
|
"""Chunks the items.
|
|
115
136
|
|
|
@@ -323,7 +344,7 @@ class Collection:
|
|
|
323
344
|
|
|
324
345
|
def add_relation(self, result=None):
|
|
325
346
|
for model in self._items:
|
|
326
|
-
model.
|
|
347
|
+
model.add_relation(result or {})
|
|
327
348
|
|
|
328
349
|
return self
|
|
329
350
|
|
|
@@ -512,8 +533,13 @@ class Collection:
|
|
|
512
533
|
def __getitem__(self, item):
|
|
513
534
|
if isinstance(item, slice):
|
|
514
535
|
return self.__class__(self._items[item])
|
|
536
|
+
if isinstance(item, dict):
|
|
537
|
+
return self._items.get(item, None)
|
|
515
538
|
|
|
516
|
-
|
|
539
|
+
try:
|
|
540
|
+
return self._items[item]
|
|
541
|
+
except KeyError:
|
|
542
|
+
return None
|
|
517
543
|
|
|
518
544
|
def __setitem__(self, key, value):
|
|
519
545
|
self._items[key] = value
|
|
@@ -124,6 +124,9 @@ class MySQLConnection(BaseConnection):
|
|
|
124
124
|
"""Transaction"""
|
|
125
125
|
self._connection.rollback()
|
|
126
126
|
self.transaction_level -= 1
|
|
127
|
+
if self.get_transaction_level() <= 0:
|
|
128
|
+
self.open = 0
|
|
129
|
+
self._connection.close()
|
|
127
130
|
|
|
128
131
|
def get_transaction_level(self):
|
|
129
132
|
"""Transaction"""
|
|
@@ -810,6 +810,23 @@ class Model(TimeStampsMixin, ObservesEvents, metaclass=ModelMeta):
|
|
|
810
810
|
|
|
811
811
|
return None
|
|
812
812
|
|
|
813
|
+
def only(self, attributes: list) -> dict:
|
|
814
|
+
if isinstance(attributes, str):
|
|
815
|
+
attributes = [attributes]
|
|
816
|
+
results: dict[str, Any] = {}
|
|
817
|
+
for attribute in attributes:
|
|
818
|
+
if " as " in attribute:
|
|
819
|
+
attribute, alias = attribute.split(" as ")
|
|
820
|
+
alias = alias.strip()
|
|
821
|
+
attribute = attribute.strip()
|
|
822
|
+
else:
|
|
823
|
+
alias = attribute.strip()
|
|
824
|
+
attribute = attribute.strip()
|
|
825
|
+
|
|
826
|
+
results[alias] = self.get_raw_attribute(attribute)
|
|
827
|
+
|
|
828
|
+
return results
|
|
829
|
+
|
|
813
830
|
def __setattr__(self, attribute, value):
|
|
814
831
|
if hasattr(self, "set_" + attribute + "_attribute"):
|
|
815
832
|
method = getattr(self, "set_" + attribute + "_attribute")
|
|
@@ -1441,10 +1441,16 @@ class QueryBuilder(ObservesEvents):
|
|
|
1441
1441
|
date_fields = model.get_dates()
|
|
1442
1442
|
for key, value in updates.items():
|
|
1443
1443
|
if key in date_fields:
|
|
1444
|
-
|
|
1444
|
+
if value:
|
|
1445
|
+
updates[key] = model.get_new_datetime_string(value)
|
|
1446
|
+
else:
|
|
1447
|
+
updates[key] = value
|
|
1445
1448
|
# Cast value if necessary
|
|
1446
1449
|
if cast:
|
|
1447
|
-
|
|
1450
|
+
if value:
|
|
1451
|
+
updates[key] = model.cast_value(value)
|
|
1452
|
+
else:
|
|
1453
|
+
updates[key] = value
|
|
1448
1454
|
elif not updates:
|
|
1449
1455
|
# Do not perform query if there are no updates
|
|
1450
1456
|
return self
|
|
@@ -1945,16 +1951,23 @@ class QueryBuilder(ObservesEvents):
|
|
|
1945
1951
|
Returns:
|
|
1946
1952
|
self
|
|
1947
1953
|
"""
|
|
1948
|
-
if isinstance(hydrated_model, Collection):
|
|
1954
|
+
if related_result and isinstance(hydrated_model, Collection):
|
|
1955
|
+
map_related = self._map_related(related_result, related)
|
|
1949
1956
|
for model in hydrated_model:
|
|
1950
1957
|
if isinstance(related_result, Collection):
|
|
1951
|
-
related.register_related(relation_key, model,
|
|
1958
|
+
related.register_related(relation_key, model, map_related)
|
|
1952
1959
|
else:
|
|
1953
1960
|
model.add_relation({relation_key: related_result or None})
|
|
1954
1961
|
else:
|
|
1955
1962
|
hydrated_model.add_relation({relation_key: related_result or None})
|
|
1956
1963
|
return self
|
|
1957
1964
|
|
|
1965
|
+
def _map_related(self, related_result, related):
|
|
1966
|
+
if related.__class__.__name__ == 'MorphTo':
|
|
1967
|
+
return related_result
|
|
1968
|
+
|
|
1969
|
+
return related_result.group_by(related.foreign_key)
|
|
1970
|
+
|
|
1958
1971
|
def all(self, selects=[], query=False):
|
|
1959
1972
|
"""Returns all records from the table.
|
|
1960
1973
|
|
|
@@ -63,8 +63,6 @@ class BelongsTo(BaseRelationship):
|
|
|
63
63
|
).first()
|
|
64
64
|
|
|
65
65
|
def register_related(self, key, model, collection):
|
|
66
|
-
related = collection.
|
|
67
|
-
self.foreign_key, getattr(model, self.local_key)
|
|
68
|
-
).first()
|
|
66
|
+
related = collection.get(getattr(model, self.local_key), None)
|
|
69
67
|
|
|
70
|
-
model.add_relation({key: related
|
|
68
|
+
model.add_relation({key: related[0] if related else None})
|
|
@@ -28,5 +28,5 @@ class HasMany(BaseRelationship):
|
|
|
28
28
|
|
|
29
29
|
def register_related(self, key, model, collection):
|
|
30
30
|
model.add_relation(
|
|
31
|
-
{key: collection.
|
|
31
|
+
{key: collection.get(getattr(model, self.local_key)) or Collection()}
|
|
32
32
|
)
|
|
@@ -50,7 +50,7 @@ class MorphTo(BaseRelationship):
|
|
|
50
50
|
|
|
51
51
|
def __getattr__(self, attribute):
|
|
52
52
|
relationship = self.fn(self)()
|
|
53
|
-
return getattr(relationship.
|
|
53
|
+
return getattr(relationship._related_builder, attribute)
|
|
54
54
|
|
|
55
55
|
def apply_query(self, builder, instance):
|
|
56
56
|
"""Apply the query and return a dictionary to be hydrated
|
|
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
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/CanOverrideOptionsDefault.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeMigrationCommand.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MakeModelDocstringCommand.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateRefreshCommand.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateRollbackCommand.py
RENAMED
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/MigrateStatusCommand.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/create_migration.stub
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/commands/stubs/table_migration.stub
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/ConnectionFactory.py
RENAMED
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/ConnectionResolver.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/connections/PostgresConnection.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
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/pagination/LengthAwarePaginator.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
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/grammars/PostgresGrammar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/MSSQLPostProcessor.py
RENAMED
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/MySQLPostProcessor.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/query/processors/SQLitePostProcessor.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/relationships/BaseRelationship.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
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/MSSQLPlatform.py
RENAMED
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/MySQLPlatform.py
RENAMED
|
File without changes
|
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/PostgresPlatform.py
RENAMED
|
File without changes
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/schema/platforms/SQLitePlatform.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
|
{masonite-orm-2.20.0 → masonite-orm-2.22.0}/src/masoniteorm/testing/BaseTestCaseSelectGrammar.py
RENAMED
|
File without changes
|
|
File without changes
|