masonite-framework-orm 3.0.1__py3-none-any.whl
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_framework_orm-3.0.1.dist-info/METADATA +87 -0
- masonite_framework_orm-3.0.1.dist-info/RECORD +116 -0
- masonite_framework_orm-3.0.1.dist-info/WHEEL +5 -0
- masonite_framework_orm-3.0.1.dist-info/entry_points.txt +3 -0
- masonite_framework_orm-3.0.1.dist-info/licenses/LICENSE +21 -0
- masonite_framework_orm-3.0.1.dist-info/top_level.txt +1 -0
- masoniteorm/__init__.py +1 -0
- masoniteorm/collection/Collection.py +605 -0
- masoniteorm/collection/__init__.py +1 -0
- masoniteorm/commands/CanOverrideConfig.py +16 -0
- masoniteorm/commands/CanOverrideOptionsDefault.py +22 -0
- masoniteorm/commands/Command.py +6 -0
- masoniteorm/commands/Entry.py +43 -0
- masoniteorm/commands/MakeMigrationCommand.py +57 -0
- masoniteorm/commands/MakeModelCommand.py +78 -0
- masoniteorm/commands/MakeModelDocstringCommand.py +37 -0
- masoniteorm/commands/MakeObserverCommand.py +54 -0
- masoniteorm/commands/MakeSeedCommand.py +54 -0
- masoniteorm/commands/MigrateCommand.py +46 -0
- masoniteorm/commands/MigrateFreshCommand.py +41 -0
- masoniteorm/commands/MigrateRefreshCommand.py +41 -0
- masoniteorm/commands/MigrateResetCommand.py +25 -0
- masoniteorm/commands/MigrateRollbackCommand.py +26 -0
- masoniteorm/commands/MigrateStatusCommand.py +51 -0
- masoniteorm/commands/SeedRunCommand.py +35 -0
- masoniteorm/commands/ShellCommand.py +205 -0
- masoniteorm/commands/__init__.py +18 -0
- masoniteorm/commands/stubs/create_migration.stub +20 -0
- masoniteorm/commands/stubs/create_seed.stub +9 -0
- masoniteorm/commands/stubs/model.stub +9 -0
- masoniteorm/commands/stubs/observer.stub +101 -0
- masoniteorm/commands/stubs/table_migration.stub +19 -0
- masoniteorm/config.py +123 -0
- masoniteorm/connections/BaseConnection.py +101 -0
- masoniteorm/connections/ConnectionFactory.py +59 -0
- masoniteorm/connections/ConnectionResolver.py +132 -0
- masoniteorm/connections/MSSQLConnection.py +176 -0
- masoniteorm/connections/MySQLConnection.py +232 -0
- masoniteorm/connections/PostgresConnection.py +225 -0
- masoniteorm/connections/SQLiteConnection.py +179 -0
- masoniteorm/connections/__init__.py +6 -0
- masoniteorm/exceptions.py +38 -0
- masoniteorm/expressions/__init__.py +1 -0
- masoniteorm/expressions/expressions.py +288 -0
- masoniteorm/factories/Factory.py +112 -0
- masoniteorm/factories/__init__.py +1 -0
- masoniteorm/helpers/__init__.py +0 -0
- masoniteorm/helpers/misc.py +22 -0
- masoniteorm/migrations/Migration.py +330 -0
- masoniteorm/migrations/__init__.py +1 -0
- masoniteorm/models/MigrationModel.py +9 -0
- masoniteorm/models/Model.py +1209 -0
- masoniteorm/models/Model.pyi +1366 -0
- masoniteorm/models/Pivot.py +5 -0
- masoniteorm/models/__init__.py +1 -0
- masoniteorm/observers/ObservesEvents.py +27 -0
- masoniteorm/observers/__init__.py +1 -0
- masoniteorm/pagination/BasePaginator.py +10 -0
- masoniteorm/pagination/LengthAwarePaginator.py +34 -0
- masoniteorm/pagination/SimplePaginator.py +28 -0
- masoniteorm/pagination/__init__.py +2 -0
- masoniteorm/providers/ORMProvider.py +39 -0
- masoniteorm/providers/__init__.py +1 -0
- masoniteorm/query/EagerRelation.py +42 -0
- masoniteorm/query/QueryBuilder.py +2486 -0
- masoniteorm/query/__init__.py +1 -0
- masoniteorm/query/grammars/BaseGrammar.py +1027 -0
- masoniteorm/query/grammars/MSSQLGrammar.py +194 -0
- masoniteorm/query/grammars/MySQLGrammar.py +238 -0
- masoniteorm/query/grammars/PostgresGrammar.py +213 -0
- masoniteorm/query/grammars/SQLiteGrammar.py +228 -0
- masoniteorm/query/grammars/__init__.py +4 -0
- masoniteorm/query/processors/MSSQLPostProcessor.py +58 -0
- masoniteorm/query/processors/MySQLPostProcessor.py +48 -0
- masoniteorm/query/processors/PostgresPostProcessor.py +49 -0
- masoniteorm/query/processors/SQLitePostProcessor.py +49 -0
- masoniteorm/query/processors/__init__.py +4 -0
- masoniteorm/relationships/BaseRelationship.py +161 -0
- masoniteorm/relationships/BelongsTo.py +124 -0
- masoniteorm/relationships/BelongsToMany.py +604 -0
- masoniteorm/relationships/HasMany.py +66 -0
- masoniteorm/relationships/HasManyThrough.py +269 -0
- masoniteorm/relationships/HasOne.py +111 -0
- masoniteorm/relationships/HasOneThrough.py +275 -0
- masoniteorm/relationships/MorphMany.py +152 -0
- masoniteorm/relationships/MorphOne.py +156 -0
- masoniteorm/relationships/MorphTo.py +111 -0
- masoniteorm/relationships/MorphToMany.py +108 -0
- masoniteorm/relationships/__init__.py +10 -0
- masoniteorm/schema/Blueprint.py +1161 -0
- masoniteorm/schema/Column.py +144 -0
- masoniteorm/schema/ColumnDiff.py +0 -0
- masoniteorm/schema/Constraint.py +5 -0
- masoniteorm/schema/ForeignKeyConstraint.py +28 -0
- masoniteorm/schema/Index.py +5 -0
- masoniteorm/schema/Schema.py +359 -0
- masoniteorm/schema/Table.py +94 -0
- masoniteorm/schema/TableDiff.py +86 -0
- masoniteorm/schema/__init__.py +3 -0
- masoniteorm/schema/platforms/MSSQLPlatform.py +367 -0
- masoniteorm/schema/platforms/MySQLPlatform.py +513 -0
- masoniteorm/schema/platforms/Platform.py +97 -0
- masoniteorm/schema/platforms/PostgresPlatform.py +551 -0
- masoniteorm/schema/platforms/SQLitePlatform.py +481 -0
- masoniteorm/schema/platforms/__init__.py +4 -0
- masoniteorm/scopes/BaseScope.py +6 -0
- masoniteorm/scopes/SoftDeleteScope.py +56 -0
- masoniteorm/scopes/SoftDeletesMixin.py +13 -0
- masoniteorm/scopes/TimeStampsMixin.py +12 -0
- masoniteorm/scopes/TimeStampsScope.py +47 -0
- masoniteorm/scopes/UUIDPrimaryKeyMixin.py +8 -0
- masoniteorm/scopes/UUIDPrimaryKeyScope.py +51 -0
- masoniteorm/scopes/__init__.py +8 -0
- masoniteorm/scopes/scope.py +15 -0
- masoniteorm/seeds/Seeder.py +42 -0
- masoniteorm/seeds/__init__.py +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from .BaseScope import BaseScope
|
|
2
|
+
from .scope import scope
|
|
3
|
+
from .SoftDeleteScope import SoftDeleteScope
|
|
4
|
+
from .SoftDeletesMixin import SoftDeletesMixin
|
|
5
|
+
from .TimeStampsMixin import TimeStampsMixin
|
|
6
|
+
from .TimeStampsScope import TimeStampsScope
|
|
7
|
+
from .UUIDPrimaryKeyMixin import UUIDPrimaryKeyMixin
|
|
8
|
+
from .UUIDPrimaryKeyScope import UUIDPrimaryKeyScope
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class scope:
|
|
2
|
+
def __init__(self, callback, *params, **kwargs):
|
|
3
|
+
self.fn = callback
|
|
4
|
+
|
|
5
|
+
def __set_name__(self, cls, name):
|
|
6
|
+
if cls not in cls._scopes:
|
|
7
|
+
cls._scopes[cls] = {name: self.fn}
|
|
8
|
+
else:
|
|
9
|
+
cls._scopes[cls].update({name: self.fn})
|
|
10
|
+
self.cls = cls
|
|
11
|
+
|
|
12
|
+
def __call__(self, *args, **kwargs):
|
|
13
|
+
instantiated = self.cls()
|
|
14
|
+
builder = instantiated.get_builder()
|
|
15
|
+
return self.fn(instantiated, builder, *args, **kwargs)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import pydoc
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Seeder:
|
|
5
|
+
def __init__(
|
|
6
|
+
self, dry=False, seed_path="databases/seeds", connection=None
|
|
7
|
+
):
|
|
8
|
+
self.ran_seeds = []
|
|
9
|
+
self.dry = dry
|
|
10
|
+
self.seed_path = seed_path
|
|
11
|
+
self.connection = connection
|
|
12
|
+
self.seed_module = seed_path.replace("/", ".").replace("\\", ".")
|
|
13
|
+
|
|
14
|
+
def call(self, *seeder_classes):
|
|
15
|
+
for seeder_class in seeder_classes:
|
|
16
|
+
self.ran_seeds.append(seeder_class)
|
|
17
|
+
if not self.dry:
|
|
18
|
+
seeder_class(connection=self.connection).run()
|
|
19
|
+
|
|
20
|
+
def run_database_seed(self):
|
|
21
|
+
database_seeder = pydoc.locate(
|
|
22
|
+
f"{self.seed_module}.database_seeder.DatabaseSeeder"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
self.ran_seeds.append(database_seeder)
|
|
26
|
+
|
|
27
|
+
if not self.dry:
|
|
28
|
+
database_seeder(connection=self.connection).run()
|
|
29
|
+
|
|
30
|
+
def run_specific_seed(self, seed):
|
|
31
|
+
file_name = f"{self.seed_module}.{seed}"
|
|
32
|
+
database_seeder = pydoc.locate(file_name)
|
|
33
|
+
|
|
34
|
+
if not database_seeder:
|
|
35
|
+
raise ValueError(f"Could not find the {file_name} seeder file")
|
|
36
|
+
|
|
37
|
+
self.ran_seeds.append(database_seeder)
|
|
38
|
+
|
|
39
|
+
if not self.dry:
|
|
40
|
+
database_seeder(connection=self.connection).run()
|
|
41
|
+
else:
|
|
42
|
+
print(f"Running {database_seeder}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Seeder import Seeder
|