Full Code of MasoniteFramework/orm for AI

2.0 0d31e53f1881 cached
224 files
1020.6 KB
232.3k tokens
3071 symbols
1 requests
Download .txt
Showing preview only (1,090K chars total). Download the full file or copy to clipboard to get everything.
Repository: MasoniteFramework/orm
Branch: 2.0
Commit: 0d31e53f1881
Files: 224
Total size: 1020.6 KB

Directory structure:
gitextract_q9lmgekj/

├── .deepsource.toml
├── .env-example
├── .envrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   └── workflows/
│       ├── pythonapp.yml
│       └── pythonpublish.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .pypirc
├── .tool-versions
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── TODO.md
├── app/
│   └── observers/
│       └── UserObserver.py
├── cc.py
├── conda/
│   ├── conda_build_config.yaml
│   └── meta.yaml
├── config/
│   └── test-database.py
├── databases/
│   ├── migrations/
│   │   ├── 2018_01_09_043202_create_users_table.py
│   │   ├── 2020_04_17_000000_create_friends_table.py
│   │   ├── 2020_04_17_00000_create_articles_table.py
│   │   ├── 2020_10_20_152904_create_table_schema_migration.py
│   │   └── __init__.py
│   └── seeds/
│       ├── database_seeder.py
│       └── user_table_seeder.py
├── makefile
├── orm
├── pyproject.toml
├── pytest.ini
├── requirements.dev
├── requirements.txt
├── setup.py
├── src/
│   └── masoniteorm/
│       ├── .gitignore
│       ├── __init__.py
│       ├── collection/
│       │   ├── Collection.py
│       │   └── __init__.py
│       ├── commands/
│       │   ├── CanOverrideConfig.py
│       │   ├── CanOverrideOptionsDefault.py
│       │   ├── Command.py
│       │   ├── Entry.py
│       │   ├── MakeMigrationCommand.py
│       │   ├── MakeModelCommand.py
│       │   ├── MakeModelDocstringCommand.py
│       │   ├── MakeObserverCommand.py
│       │   ├── MakeSeedCommand.py
│       │   ├── MigrateCommand.py
│       │   ├── MigrateFreshCommand.py
│       │   ├── MigrateRefreshCommand.py
│       │   ├── MigrateResetCommand.py
│       │   ├── MigrateRollbackCommand.py
│       │   ├── MigrateStatusCommand.py
│       │   ├── SeedRunCommand.py
│       │   ├── ShellCommand.py
│       │   ├── __init__.py
│       │   └── stubs/
│       │       ├── create_migration.stub
│       │       ├── create_seed.stub
│       │       ├── model.stub
│       │       ├── observer.stub
│       │       └── table_migration.stub
│       ├── config.py
│       ├── connections/
│       │   ├── .gitignore
│       │   ├── BaseConnection.py
│       │   ├── ConnectionFactory.py
│       │   ├── ConnectionResolver.py
│       │   ├── MSSQLConnection.py
│       │   ├── MySQLConnection.py
│       │   ├── PostgresConnection.py
│       │   ├── SQLiteConnection.py
│       │   └── __init__.py
│       ├── exceptions.py
│       ├── expressions/
│       │   ├── __init__.py
│       │   └── expressions.py
│       ├── factories/
│       │   ├── Factory.py
│       │   └── __init__.py
│       ├── helpers/
│       │   ├── __init__.py
│       │   └── misc.py
│       ├── migrations/
│       │   ├── Migration.py
│       │   └── __init__.py
│       ├── models/
│       │   ├── MigrationModel.py
│       │   ├── Model.py
│       │   ├── Model.pyi
│       │   ├── Pivot.py
│       │   └── __init__.py
│       ├── observers/
│       │   ├── ObservesEvents.py
│       │   └── __init__.py
│       ├── pagination/
│       │   ├── BasePaginator.py
│       │   ├── LengthAwarePaginator.py
│       │   ├── SimplePaginator.py
│       │   └── __init__.py
│       ├── providers/
│       │   ├── ORMProvider.py
│       │   └── __init__.py
│       ├── query/
│       │   ├── EagerRelation.py
│       │   ├── QueryBuilder.py
│       │   ├── __init__.py
│       │   ├── grammars/
│       │   │   ├── BaseGrammar.py
│       │   │   ├── MSSQLGrammar.py
│       │   │   ├── MySQLGrammar.py
│       │   │   ├── PostgresGrammar.py
│       │   │   ├── SQLiteGrammar.py
│       │   │   └── __init__.py
│       │   └── processors/
│       │       ├── MSSQLPostProcessor.py
│       │       ├── MySQLPostProcessor.py
│       │       ├── PostgresPostProcessor.py
│       │       ├── SQLitePostProcessor.py
│       │       └── __init__.py
│       ├── relationships/
│       │   ├── BaseRelationship.py
│       │   ├── BelongsTo.py
│       │   ├── BelongsToMany.py
│       │   ├── HasMany.py
│       │   ├── HasManyThrough.py
│       │   ├── HasOne.py
│       │   ├── HasOneThrough.py
│       │   ├── MorphMany.py
│       │   ├── MorphOne.py
│       │   ├── MorphTo.py
│       │   ├── MorphToMany.py
│       │   └── __init__.py
│       ├── schema/
│       │   ├── Blueprint.py
│       │   ├── Column.py
│       │   ├── ColumnDiff.py
│       │   ├── Constraint.py
│       │   ├── ForeignKeyConstraint.py
│       │   ├── Index.py
│       │   ├── Schema.py
│       │   ├── Table.py
│       │   ├── TableDiff.py
│       │   ├── __init__.py
│       │   └── platforms/
│       │       ├── MSSQLPlatform.py
│       │       ├── MySQLPlatform.py
│       │       ├── Platform.py
│       │       ├── PostgresPlatform.py
│       │       ├── SQLitePlatform.py
│       │       └── __init__.py
│       ├── scopes/
│       │   ├── BaseScope.py
│       │   ├── SoftDeleteScope.py
│       │   ├── SoftDeletesMixin.py
│       │   ├── TimeStampsMixin.py
│       │   ├── TimeStampsScope.py
│       │   ├── UUIDPrimaryKeyMixin.py
│       │   ├── UUIDPrimaryKeyScope.py
│       │   ├── __init__.py
│       │   └── scope.py
│       ├── seeds/
│       │   ├── Seeder.py
│       │   └── __init__.py
│       ├── stubs/
│       │   ├── create-migration.html
│       │   └── table-migration.html
│       └── testing/
│           ├── BaseTestCaseSelectGrammar.py
│           └── __init__.py
└── tests/
    ├── User.py
    ├── collection/
    │   └── test_collection.py
    ├── commands/
    │   └── test_shell.py
    ├── config/
    │   └── test_db_url.py
    ├── connections/
    │   └── test_base_connections.py
    ├── eagers/
    │   └── test_eager.py
    ├── factories/
    │   └── test_factories.py
    ├── integrations/
    │   └── config/
    │       ├── __init__.py
    │       └── database.py
    ├── models/
    │   └── test_models.py
    ├── mssql/
    │   ├── builder/
    │   │   ├── test_mssql_query_builder.py
    │   │   └── test_mssql_query_builder_relationships.py
    │   ├── grammar/
    │   │   ├── test_mssql_delete_grammar.py
    │   │   ├── test_mssql_insert_grammar.py
    │   │   ├── test_mssql_qmark.py
    │   │   ├── test_mssql_select_grammar.py
    │   │   └── test_mssql_update_grammar.py
    │   └── schema/
    │       ├── test_mssql_schema_builder.py
    │       └── test_mssql_schema_builder_alter.py
    ├── mysql/
    │   ├── builder/
    │   │   ├── test_mysql_builder_transaction.py
    │   │   ├── test_query_builder.py
    │   │   ├── test_query_builder_scopes.py
    │   │   └── test_transactions.py
    │   ├── connections/
    │   │   └── test_mysql_connection_selects.py
    │   ├── grammar/
    │   │   ├── test_mysql_delete_grammar.py
    │   │   ├── test_mysql_insert_grammar.py
    │   │   ├── test_mysql_qmark.py
    │   │   ├── test_mysql_select_grammar.py
    │   │   └── test_mysql_update_grammar.py
    │   ├── model/
    │   │   ├── test_accessors_and_mutators.py
    │   │   └── test_model.py
    │   ├── relationships/
    │   │   ├── test_belongs_to_many.py
    │   │   ├── test_has_many_through.py
    │   │   ├── test_has_one_through.py
    │   │   └── test_relationships.py
    │   ├── schema/
    │   │   ├── test_mysql_schema_builder.py
    │   │   └── test_mysql_schema_builder_alter.py
    │   └── scopes/
    │       ├── test_can_use_global_scopes.py
    │       ├── test_can_use_scopes.py
    │       └── test_soft_delete.py
    ├── postgres/
    │   ├── builder/
    │   │   ├── test_postgres_query_builder.py
    │   │   └── test_postgres_transaction.py
    │   ├── grammar/
    │   │   ├── test_delete_grammar.py
    │   │   ├── test_insert_grammar.py
    │   │   ├── test_select_grammar.py
    │   │   └── test_update_grammar.py
    │   ├── relationships/
    │   │   └── test_postgres_relationships.py
    │   └── schema/
    │       ├── test_postgres_schema_builder.py
    │       └── test_postgres_schema_builder_alter.py
    ├── scopes/
    │   └── test_default_global_scopes.py
    ├── seeds/
    │   └── test_seeds.py
    ├── sqlite/
    │   ├── builder/
    │   │   ├── test_sqlite_builder_insert.py
    │   │   ├── test_sqlite_builder_pagination.py
    │   │   ├── test_sqlite_query_builder.py
    │   │   ├── test_sqlite_query_builder_eager_loading.py
    │   │   ├── test_sqlite_query_builder_relationships.py
    │   │   └── test_sqlite_transaction.py
    │   ├── grammar/
    │   │   ├── test_sqlite_delete_grammar.py
    │   │   ├── test_sqlite_insert_grammar.py
    │   │   ├── test_sqlite_select_grammar.py
    │   │   └── test_sqlite_update_grammar.py
    │   ├── models/
    │   │   ├── test_attach_detach.py
    │   │   ├── test_observers.py
    │   │   └── test_sqlite_model.py
    │   ├── relationships/
    │   │   ├── test_sqlite_has_many_through_relationship.py
    │   │   ├── test_sqlite_has_one_through_relationship.py
    │   │   ├── test_sqlite_polymorphic.py
    │   │   └── test_sqlite_relationships.py
    │   └── schema/
    │       ├── test_sqlite_schema_builder.py
    │       ├── test_sqlite_schema_builder_alter.py
    │       ├── test_table.py
    │       └── test_table_diff.py
    └── utils.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .deepsource.toml
================================================
# generated by deepsource.io
version = 1

test_patterns = [
  'tests/**/*.py'
]

exclude_patterns = [
  'databases/migrations/*'
]

[[analyzers]]
name = "python"
enabled = true
runtime_version = "3.x.x"


================================================
FILE: .env-example
================================================

RUN_MYSQL_DATABASE=False

MYSQL_DATABASE_HOST=
MYSQL_DATABASE_USER=
MYSQL_DATABASE_PASSWORD=
MYSQL_DATABASE_DATABASE=
MYSQL_DATABASE_PORT=

POSTGRES_DATABASE_HOST=
POSTGRES_DATABASE_USER=
POSTGRES_DATABASE_PASSWORD=
POSTGRES_DATABASE_DATABASE=
POSTGRES_DATABASE_PORT=

DATABASE_URL=

================================================
FILE: .envrc
================================================
use asdf
layout python


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: A bug would be defined as an issue / problem in the original requirement. If the feature works but could be enhanced please use the feature request option.
title: ''
labels: 'bug'
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
What do you believe should be happening?

**Screenshots or code snippets**
Screenshots help a lot. If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: [e.g. Mac OSX, Windows]
 - Version [e.g. Big Sur, 10]

**What database are you using?**
 - Type: [e.g. Postgres, MySQL, SQLite]
 - Version [e.g. 8, 9.1, 10.5]
 - Masonite ORM [e.g. v1.0.26, v1.0.27]

**Additional context**
Any other steps you are doing or any other related information that will help us debug the problem please put here.


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request or enhancement
about: Suggest an idea or improvement for this project.
title: ''
labels: enhancement, feature request
assignees: ''

---

**Describe the feature as you'd like to see it**
A clear and concise description of what you want to happen.

**What do we currently have to do now?** 
Give some examples or code snippets on the current way of doing things.

**Additional context**
Add any other context or screenshots about the feature request here.

- [ ] Is this a breaking change?


================================================
FILE: .github/workflows/pythonapp.yml
================================================
name: Test Application

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-20.04

    services:
      postgres:
        image: postgres:10.8
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        ports:
          # will assign a random free host port
          - 5432/tcp
        # needed because the postgres container does not provide a healthcheck
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

      mysql:
        image: mysql:5.7
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: orm
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    strategy:
      matrix:
        python-version: ["3.6", "3.7", "3.8", "3.9"]
    name: Python ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          make init-ci
      - name: Test with pytest
        env:
          POSTGRES_DATABASE_HOST: localhost
          POSTGRES_DATABASE_DATABASE: postgres
          POSTGRES_DATABASE_USER: postgres
          POSTGRES_DATABASE_PASSWORD: postgres
          POSTGRES_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }}
          MYSQL_DATABASE_HOST: localhost
          MYSQL_DATABASE_DATABASE: orm
          MYSQL_DATABASE_USER: root
          MYSQL_DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
          DB_CONFIG_PATH: tests/integrations/config/database.py
        run: |
          python orm migrate --connection postgres
          python orm migrate --connection mysql
          make test
  lint:
    runs-on: ubuntu-20.04
    name: Lint
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python 3.6
        uses: actions/setup-python@v4
        with:
          python-version: 3.6
      - name: Install Flake8
        run: |
          pip install flake8-pyproject
      - name: Lint
        run: make lint


================================================
FILE: .github/workflows/pythonpublish.yml
================================================
name: Upload Python Package

on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ubuntu-20.04

    services:
      postgres:
        image: postgres:10.8
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        ports:
          # will assign a random free host port
          - 5432/tcp
        # needed because the postgres container does not provide a healthcheck
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

      mysql:
        image: mysql:5.7
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: orm
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    strategy:
      matrix:
        python-version: ["3.6"]
    name: Python ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          make init-ci
      - name: Test with Pytest and Publish to PYPI
        env:
          POSTGRES_DATABASE_HOST: localhost
          POSTGRES_DATABASE_DATABASE: postgres
          POSTGRES_DATABASE_USER: postgres
          POSTGRES_DATABASE_PASSWORD: postgres
          POSTGRES_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }}
          MYSQL_DATABASE_HOST: localhost
          MYSQL_DATABASE_DATABASE: orm
          MYSQL_DATABASE_USER: root
          MYSQL_DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
          DB_CONFIG_PATH: tests/integrations/config/database.py
        run: |
          python orm migrate --connection postgres
          python orm migrate --connection mysql
          make publish
      - name: Discord notification
        env:
          DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
        uses: Ilshidur/action-discord@master
        with:
          args: "{{ EVENT_PAYLOAD.repository.full_name }} {{ EVENT_PAYLOAD.release.tag_name }} has been released. Checkout the full release notes here: {{ EVENT_PAYLOAD.release.html_url }}"

  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: publish-to-conda
        uses: fcakyon/conda-publish-action@v1.3
        with:
          subdir: "conda"
          anacondatoken: ${{ secrets.ANACONDA_TOKEN }}
          platforms: "win osx linux"


================================================
FILE: .gitignore
================================================
venv
.direnv
.python-version
.vscode
.pytest_*
**/*__pycache__*
**/*.DS_Store*
masonite_validation*
dist
.env
*.db
*.sqlite3
.idea
**/*.egg-info
htmlcov/*
coverage.xml
.coverage
*.log
build
/orm.sqlite3
/.bootstrapped-pip
/.ignore-pre-commit


================================================
FILE: .pre-commit-config.yaml
================================================
repos:
  - repo: https://github.com/psf/black
    rev: 25.1.0
    hooks:
      - id: black
        exclude: |
            (?x)(
                ^build|
                ^conda
            )

  - repo: https://github.com/pycqa/isort
    rev: 6.0.1
    hooks:
      - id: isort
        exclude: |
            (?x)(
                ^build|
                ^conda
            )


  - repo: https://github.com/pycqa/flake8
    rev: 7.1.2
    hooks:
      - id: flake8
        additional_dependencies: [flake8-pyproject]
        exclude: |
            (?x)(
                ^build|
                ^conda
            )


================================================
FILE: .pypirc
================================================
[distutils]
index-servers =
  pypi
  pypitest

[pypi]
username=username
password=password


================================================
FILE: .tool-versions
================================================
python 3.8.10


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing Guide

This guide is intended to explain how to contribute to this project.

## Preface

Note that you do not need to write code in order to contribute to the project. You can contribute your voice, your ideas, past experiences or just join general discussions we are having in GitHub or the Slack channel. Whether its 1 hour per day or 1 minute per week. All input and ideas are important for the success of the project. That one sentence could lead to more discussion and ideas.

If you have any questions at all then be sure to join the [Slack Channel](https://slack.masoniteproject.com).

If you are interested in the project then it would be a great idea to read the "White Paper". This is a document about how the project works and how the classes all work together. The White Paper can be [Found Here](https://orm.masoniteproject.com/white-page)

## Issues

Everything really should start with opening an issue or finding an issue. If you feel you have an idea for how the project can be improved, no matter how small, you should open an issue so we can have an open discussion with the maintainers of the project.

We can discuss in that issue the solution to the problem or feature you have. If we do not feel it fits within the project then we will close the issue. Feel free to open a new issue if new information comes up.

If there is already an issue open that you want to contribute ideas to, have information to add to the discussion, or want to contribute to the issue by writing code to complete the issue then please comment on the issue saying you would like to contribute to it.

## Labels

To improve the quality of issues, please add any related labels to the issue you think are most relevant. You may add as many as you think make sense. There are tag descriptions on the labels section of the repo so please read those descriptions to choose which labels best work for the issue.

**Please do not use any of the difficulty labels (easy, medium or hard). A maintainer will label the issue with the difficulty level after reviewing the issue**

## Difficulty Levels

Before contributing, it is assumed you have basic Python or programming skills and you are able to understand the issues enough to have a discussion about it without much information direction. All issues are marked with a difficulty level to determine how much effort will be involved in closing the issue. There are several difficulty level issues:

**good first issue** - Issues marked with this label are great issues to take if you have never contributed to open source before. These issues typically have a step by step solution in the issues are are intended for first time contributors to expand the pool of maintainers.

**easy** - Issues marked as easy are great issues to take if you have never contributed to this project before. Take this opportunity to take a simple issue to understand how some of the code works together and a simple test.

**medium** - Issues marked with this should not be worked on by someone who has not contributed to the project before. These issues assume you have basic knowledge of the codebase and can work on the issue with little direction. Discussions should be had on these issues on the best way to solve and close them.

**hard** - These issues should really not be worked on unless you are a maintainer of the Masonite organization. These issues are very involved and assume advanced knowledge of the codebase. You may contribute your voice to the issue but it is not advised you work on these issues unless you are a maintainer or have contributed to the past and have completed a medium difficulty task

## Pull Request Flow

If you choose to contribute to an issue via code contribution then please follow the steps below:

* First you will need to fork the repository. You can do this directly in GitHub by clicking the fork icon in the top right corner of the repository.
* You should then checkout the repository to your computer
* Make the code change and push up your changes to a local branch.
* **The branch should should follow a common naming convention. If the issue is #123 then your branch should be called `feature/123`. This helps me identify which issue the branch is supposed to fix.**
* You should then open a pull request to the repository.
* **All tests are required to be written before merging a pull request.** If you do not know how to write tests you can open the pull request without tests and we can discuss the best way to test the code you wrote. A maintainer or contributor could also step in and write tests for you

Once the pull request is open, the code will be reviewed and we will discuss how this particular solution to the problem solves the original issue. If there are code improvements or corrections to be made then they will be discussed with maintainers of the project.



## Running Tests

You should run all tests locally and make sure they pass before writing any code. This way you can be sure if your code is not breaking any tests that may be failing for other reasons.

You should set up a virtual environment and run tests via pytest:

```
$ python -m venv venv
$ source venv/bin/activate
$ python -m pytest
```

This should run all tests successfully. The code was written in a way where you do not need a database to test the code so all tests should run fine.


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2020 Joseph Mancuso

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: MANIFEST.in
================================================
# include src/package/some/directory/*
include src/masoniteorm/commands/stubs/*

================================================
FILE: README.md
================================================
<p align="center">
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4trhpkkdbbzutc5ufxi9.png" width="160px">
  <h1 align="center">Masonite ORM</h1>
</p>

<p align="center">
  <a href="https://docs.masoniteproject.com">
    <img alt="Masonite Package" src="https://img.shields.io/static/v1?label=Masonite&message=package&labelColor=grey&color=blue&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA6gAwAEAAAAAQAAAA4AAAAATspU+QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAnxJREFUKBVNUl1IVEEUPjPObdd1VdxWM0rMIl3bzbVWLSofVm3th0AhMakHHyqRiNSHEAq5b2HSVvoQRUiEECQUQkkPbRslRGigG8auoon2oPSjpev+3PWeZq7eaC5nDt93vplz5txDQJYpNxX4st4JFiwj9aCqmswUFQNS/A2YskrZJPYefkECC2GhQwAqvLYybwXrwBvq8HSNOXRO92+aH7nW8vc/wS2Z9TqneYt2KHjlf9Iv+43wFJMExzO0YE5OKe60N+AOW6OmE+WJTBrg23jjzWxMBauOlfyycsV24F+cH+zAXYUOGl+DaiDxfl245/W9OnVrSY+O2eqPkyz4sVvHoKp9gOihf5KoAVv3hkQgbj/ihG9fI3RixKcUVx7lJVaEc0vnyf2FFll+ny80ZHZiGhIKowWJBCEAKr+FSuNDLt+lxybSF51lo74arqs113dOZqwsptxNs5bwi7Q3q8npSC2AWmvjTncZf1l61e5DEizNn5mtufpsqk5+CZTuq00sP1wkNPv8jeEikVVlJso+GEwRtNs3QeBt2YP2V2ZI3Tx0e+7T89zK5tNASOLEytJAryGtkLc2PcBM5byyUWYkMQpMioYcDcchC6xN220Iv36Ot8pV0454RHLEwmmD7UWfIdX0zq3GjMPG5NKBtv5qiPEPekK2U51j1451BZoc3i+1ohSQ/UzzG5uYFFn2mwVUnO4O3JblXA91T51l3pB3QweDl7sNXMyEjbguSjrPcQNmwDkNc8CbCvDd0+xCC7RFi9wFulD3mJeXqxQevB4prrqgc0TmQ85NG/K43e2UwnMVAJIEBNfWRYR3HfnvivrIzMyo4Hgy+hfscvLo53jItAAAAABJRU5ErkJggg==">
  </a>
  <img src="https://img.shields.io/badge/python-3.6+-blue.svg" alt="Python Version">
  <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/MasoniteFramework/orm">
  <img alt="License" src="https://img.shields.io/github/license/MasoniteFramework/orm">
  <a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

## Installation & Usage

All documentation can be found here [https://orm.masoniteproject.com](https://orm.masoniteproject.com).

Hop on [Masonite Discord Community](https://discord.gg/TwKeFahmPZ) to ask any questions you need!

## Contributing

If you would like to contribute please read the [Contributing Documentation](CONTRIBUTING.md) here.

## License

Masonite ORM is open-sourced software licensed under the [MIT License](LICENSE).


================================================
FILE: TODO.md
================================================
- [x] fix scopes - need to find a new way to perform scopes

- [x] scopes need to be set on the model and then passed off to the query builder

- [x] global scopes
    - on select need to call a scope
    - on delete need to call a scope
    - need to be able to remove global scopes
    - need to be able to able to call something like with_trashed()
        - this needs to remove global scopes only from the soft deletes class 

================================================
FILE: app/observers/UserObserver.py
================================================
"""User Observer"""

from masoniteorm.models import Model


class UserObserver:
    def created(self, clients):
        """Handle the Clients "created" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def creating(self, clients):
        """Handle the Clients "creating" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def saving(self, clients):
        """Handle the Clients "saving" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def saved(self, clients):
        """Handle the Clients "saved" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def updating(self, clients):
        """Handle the Clients "updating" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def updated(self, clients):
        """Handle the Clients "updated" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def booted(self, clients):
        """Handle the Clients "booted" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def booting(self, clients):
        """Handle the Clients "booting" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def hydrating(self, clients):
        """Handle the Clients "hydrating" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def hydrated(self, clients):
        """Handle the Clients "hydrated" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def deleting(self, clients):
        """Handle the Clients "deleting" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass

    def deleted(self, clients):
        """Handle the Clients "deleted" event.

        Args:
            clients (masoniteorm.models.Model): Clients model.
        """
        pass


================================================
FILE: cc.py
================================================
"""Sandbox experimental file used to quickly feature test features of the package
"""

from src.masoniteorm.query import QueryBuilder
from src.masoniteorm.connections import MySQLConnection, PostgresConnection
from src.masoniteorm.query.grammars import MySQLGrammar, PostgresGrammar
from src.masoniteorm.models import Model
from src.masoniteorm.relationships import has_many
import inspect


# builder = QueryBuilder(connection=PostgresConnection, grammar=PostgresGrammar).table("users").on("postgres")



# print(builder.where("id", 1).or_where(lambda q: q.where('id', 2).or_where('id', 3)).get())

class User(Model):
    __connection__ = "t"
    __table__ = "users"
    __dates__ = ["verified_at"]

    @has_many("id", "user_id")
    def articles(self):
        return Article
class Company(Model):
    __connection__ = "sqlite"


# user = User.create({"name": "phill", "email": "phill"})
# print(inspect.isclass(User))
user = User.first()
# user.update({"verified_at": None, "updated_at": None})
print(user.serialize())

# print(user.serialize())
# print(User.first())

================================================
FILE: conda/conda_build_config.yaml
================================================
python:
  - 3.6
  - 3.7
  - 3.8
  - 3.9


================================================
FILE: conda/meta.yaml
================================================
{% set data = load_setup_py_data() %}

package:
  name: masonite-orm
  version: {{ data['version'] }}

source:
  path: ..

build:
  number: 0
  script: python setup.py install --single-version-externally-managed --record=record.txt

requirements:
  build:
    - python

  run:
    - python

test:
  run:
    - python -m pytest

about:
  home: {{ data['url'] }}
  license: {{ data['license'] }}
summary: {{ data['description'] }}

================================================
FILE: config/test-database.py
================================================
from src.masoniteorm.connections import ConnectionResolver

DATABASES = {
  "default": "mysql",
  "mysql": {
    "host": "127.0.0.1",
    "driver": "mysql",
    "database": "masonite",
    "user": "root",
    "password": "",
    "port": 3306,
    "log_queries": False,
    "options": {
      #
    }
  },
  "postgres": {
    "host": "127.0.0.1",
    "driver": "postgres",
    "database": "masonite",
    "user": "root",
    "password": "",
    "port": 5432,
    "log_queries": False,
    "options": {
      #
    }
  },
  "sqlite": {
    "driver": "sqlite",
    "database": "masonite.sqlite3",
  }
}

DB = ConnectionResolver().set_connection_details(DATABASES)


================================================
FILE: databases/migrations/2018_01_09_043202_create_users_table.py
================================================
from src.masoniteorm.migrations import Migration
from tests.User import User


class CreateUsersTable(Migration):

    def up(self):
        """Run the migrations."""
        with self.schema.create('users') as table:
            table.increments('id')
            table.string('name')
            table.string('email').unique()
            table.string('password')
            table.string('second_password').nullable()
            table.string('remember_token').nullable()
            table.timestamp('verified_at').nullable()
            table.timestamps()

        if not self.schema._dry:
            User.on(self.connection).set_schema(self.schema_name).create({
                'name': 'Joe',
                'email': 'joe@email.com',
                'password': 'secret'
            })

    def down(self):
        """Revert the migrations."""
        self.schema.drop('users')


================================================
FILE: databases/migrations/2020_04_17_000000_create_friends_table.py
================================================
from src.masoniteorm.migrations.Migration import Migration

class CreateFriendsTable(Migration):

    def up(self):  
        """
        Run the migrations.
        """

        with self.schema.create('friends') as table:
            table.increments('id')
            table.string('name')
            table.integer('age')

    def down(self):
        """
        Revert the migrations.
        """
        self.schema.drop('friends')

================================================
FILE: databases/migrations/2020_04_17_00000_create_articles_table.py
================================================
from src.masoniteorm.migrations.Migration import Migration

class CreateArticlesTable(Migration):

    def up(self):  
        """
        Run the migrations.
        """
        with self.schema.create('fans') as table:
            table.increments('id')
            table.string('name')
            table.integer('age')

    def down(self):
        """
        Revert the migrations.
        """
        self.schema.drop('fans')

================================================
FILE: databases/migrations/2020_10_20_152904_create_table_schema_migration.py
================================================
"""CreateTableSchemaMigration Migration."""

from src.masoniteorm.migrations import Migration


class CreateTableSchemaMigration(Migration):

    def up(self):
        """
        Run the migrations.
        """
        with self.schema.create("table_schema") as table:
            table.increments('id')
            table.string('name')
            table.timestamps()

    def down(self):
        """
        Revert the migrations.
        """
        self.schema.drop("table_schema")


================================================
FILE: databases/migrations/__init__.py
================================================
import os
import sys
sys.path.append(os.getcwd())


================================================
FILE: databases/seeds/database_seeder.py
================================================
"""Base Database Seeder Module."""

from src.masoniteorm.seeds import Seeder
from .user_table_seeder import UserTableSeeder

class DatabaseSeeder(Seeder):

    def run(self):
        """Run the database seeds."""
        self.call(UserTableSeeder)


================================================
FILE: databases/seeds/user_table_seeder.py
================================================
"""UserTableSeeder Seeder."""

from src.masoniteorm.seeds import Seeder
from src.masoniteorm.factories import Factory as factory
from tests.User import User

factory.register(User, lambda faker: {'email': faker.email()})

class UserTableSeeder(Seeder):

    def run(self):
        """Run the database seeds."""
        factory(User, 5).create({
            'name': 'Joe',
            'password': 'joe',
        })


================================================
FILE: makefile
================================================
SHELL := /bin/bash

init: .env .bootstrapped-pip .git/hooks/pre-commit
init-ci:
	touch .ignore-pre-commit
	make init

.bootstrapped-pip: requirements.txt requirements.dev
	pip install -r requirements.txt -r requirements.dev
	touch .bootstrapped-pip

.git/hooks/pre-commit:
	@if ! test -e ".ignore-pre-commit"; then \
  		pip install pre-commit; \
  		pre-commit install --install-hooks; \
	fi

.env:
	cp .env-example .env

# 	Create MySQL Database
# 	Create Postgres Database
test: init
	python -m pytest tests
ci:
	make test
check: format sort lint
lint:
	flake8 src/masoniteorm/
format: init
	black src/masoniteorm tests/
sort: init
	isort src/masoniteorm tests/
coverage:
	python -m pytest --cov-report term --cov-report xml --cov=src/masoniteorm tests/
	python -m coveralls
show:
	python -m pytest --cov-report term --cov-report html --cov=src/masoniteorm tests/
cov:
	python -m pytest --cov-report term --cov-report xml --cov=src/masoniteorm tests/
publish:
	pip install twine
	make test
	python setup.py sdist
	twine upload dist/*
	rm -fr build dist .egg masonite.egg-info
	rm -rf dist/*
pub:
	python setup.py sdist
	twine upload dist/*
	rm -fr build dist .egg masonite.egg-info
	rm -rf dist/*
pypirc:
	cp .pypirc ~/.pypirc


================================================
FILE: orm
================================================
"""Craft Command.

This module is really used for backup only if the masonite CLI cannot import this for you.
This can be used by running "python craft". This module is not ran when the CLI can
successfully import commands for you.
"""

from cleo import Application
from src.masoniteorm.commands import (
    MigrateCommand,
    MigrateRollbackCommand,
    MigrateRefreshCommand,
    MigrateFreshCommand,
    MakeMigrationCommand,
    MakeObserverCommand,
    MakeModelCommand,
    MigrateStatusCommand,
    MigrateResetCommand,
    MakeSeedCommand,
    MakeModelDocstringCommand,
    SeedRunCommand,
)

application = Application("ORM Version:", 0.1)

application.add(MigrateCommand())
application.add(MigrateRollbackCommand())
application.add(MigrateRefreshCommand())
application.add(MigrateFreshCommand())
application.add(MakeMigrationCommand())
application.add(MakeModelCommand())
application.add(MakeModelDocstringCommand())
application.add(MakeObserverCommand())
application.add(MigrateResetCommand())
application.add(MigrateStatusCommand())
application.add(MakeSeedCommand())

application.add(SeedRunCommand())

if __name__ == "__main__":
    application.run()


================================================
FILE: pyproject.toml
================================================
[tool.black]
target-version = ['py38']
include = '\.pyi?$'
line-length = 79

[tool.isort]
profile = "black"
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true

[tool.flake8]
ignore = ['E501', 'E203', 'E128', 'E402', 'E731', 'F821', 'E712', 'W503', 'F811']
#max-line-length = 79
#max-complexity = 18
per-file-ignores = [
    '__init__.py:F401',
]


================================================
FILE: pytest.ini
================================================
[pytest]
env = 
    D:DB_CONFIG_PATH=config/test-database

================================================
FILE: requirements.dev
================================================
flake8-pyproject
black
faker
pytest
pytest-cov
pytest-env
pymysql
isort


================================================
FILE: requirements.txt
================================================
inflection==0.3.1
psycopg2-binary
pyodbc
pendulum>=2.1,<3.1
cleo>=0.8.0,<0.9
python-dotenv==0.14.0

================================================
FILE: setup.py
================================================
from setuptools import setup

with open("README.md", "r") as fh:
    long_description = fh.read()

setup(
    name="masonite-orm",
    # Versions should comply with PEP440.  For a discussion on single-sourcing
    # the version across setup.py and the project code, see
    # https://packaging.python.org/en/latest/single_source_version.html
    version="2.24.0",
    package_dir={"": "src"},
    description="The Official Masonite ORM",
    long_description=long_description,
    long_description_content_type="text/markdown",
    # The project's main homepage.
    url="https://github.com/masoniteframework/orm",
    # Author details
    author="Joe Mancuso",
    author_email="joe@masoniteproject.com",
    # Choose your license
    license="MIT",
    # If your package should include things you specify in your MANIFEST.in file
    # Use this option if your package needs to include files that are not python files
    # like html templates or css files
    include_package_data=True,
    # List run-time dependencies here.  These will be installed by pip when
    # your project is installed. For an analysis of "install_requires" vs pip's
    # requirements files see:
    # https://packaging.python.org/en/latest/requirements.html
    install_requires=[
        "inflection>=0.3,<0.6",
        "pendulum>=2.1,<3.1",
        "faker>=4.1.0,<14.0",
        "cleo>=0.8.0,<0.9",
    ],
    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        "Development Status :: 5 - Production/Stable",
        # Indicate who your project is intended for
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Build Tools",
        "Environment :: Web Environment",
        # Pick your license as you wish (should match "license" above)
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Framework :: Masonite",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Framework :: Masonite",
    ],
    # What does your project relate to?
    keywords="Masonite, MasoniteFramework, Python, ORM",
    # You can just specify the packages manually here if your project is
    # simple. Or you can use find_packages().
    packages=[
        "masoniteorm",
        "masoniteorm.collection",
        "masoniteorm.commands",
        "masoniteorm.connections",
        "masoniteorm.expressions",
        "masoniteorm.factories",
        "masoniteorm.helpers",
        "masoniteorm.migrations",
        "masoniteorm.models",
        "masoniteorm.observers",
        "masoniteorm.pagination",
        "masoniteorm.providers",
        "masoniteorm.query",
        "masoniteorm.query.grammars",
        "masoniteorm.query.processors",
        "masoniteorm.relationships",
        "masoniteorm.schema",
        "masoniteorm.schema.platforms",
        "masoniteorm.scopes",
        "masoniteorm.seeds",
        "masoniteorm.testing",
    ],
    # List additional groups of dependencies here (e.g. development
    # dependencies). You can install these using the following syntax,
    # for example:
    # $ pip install -e .[dev,test]
    # $ pip install your-package[dev,test]
    extras_require={
        "test": ["coverage", "pytest"],
    },
    # If there are data files included in your packages that need to be
    # installed, specify them here.  If using Python 2.6 or less, then these
    # have to be included in MANIFEST.in as well.
    ## package_data={
    ##     'sample': [],
    ## },
    # Although 'package_data' is the preferred approach, in some case you may
    # need to place data files outside of your packages. See:
    # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
    # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
    ## data_files=[('my_data', ['data/data_file.txt'])],
    # To provide executable scripts, use entry points in preference to the
    # "scripts" keyword. Entry points provide cross-platform support and allow
    # pip to create the appropriate form of executable for the target platform.
    entry_points={
        "console_scripts": [
            "masonite-orm = masoniteorm.commands.Entry:application.run",
        ],
    },
)


================================================
FILE: src/masoniteorm/.gitignore
================================================


================================================
FILE: src/masoniteorm/__init__.py
================================================
from .models import Model
from .factories.Factory import Factory


================================================
FILE: src/masoniteorm/collection/Collection.py
================================================
import json
import random
import operator
from functools import reduce


class Collection:
    """Wraps various data types to make working with them easier."""

    def __init__(self, items=None):
        self._items = items or []
        self.__appends__ = []

    def take(self, number: int):
        """Takes a specific number of results from the items.

        Arguments:
            number {integer} -- The number of results to take.

        Returns:
            int
        """
        if number < 0:
            return self[number:]

        return self[:number]

    def first(self, callback=None):
        """Takes the first result in the items.

        If a callback is given then the first result will be the result after the filter.

        Keyword Arguments:
            callback {callable} -- Used to filter the results before returning the first item. (default: {None})

        Returns:
            mixed -- Returns whatever the first item is.
        """
        filtered = self
        if callback:
            filtered = self.filter(callback)
        response = None

        if filtered:
            response = filtered[0]
        return response

    def items(self):
        return self._items.items()

    def last(self, callback=None):
        """Takes the last result in the items.

        If a callback is given then the last result will be the result after the filter.

        Keyword Arguments:
            callback {callable} -- Used to filter the results before returning the last item. (default: {None})

        Returns:
            mixed -- Returns whatever the last item is.
        """
        filtered = self
        if callback:
            filtered = self.filter(callback)
        return filtered[-1]

    def all(self):
        """Returns all the items.

        Returns:
            mixed -- Returns all items.
        """
        return self._items

    def avg(self, key=None):
        """Returns the average of the items.

        If a key is given it will return the average of all the values of the key.

        Keyword Arguments:
            key {string} -- The key to use to find the average of all the values of that key. (default: {None})

        Returns:
            int -- Returns the average.
        """
        result = 0
        items = self._get_value(key) or self._items
        try:
            result = sum(items) / len(items)
        except TypeError:
            pass
        return result

    def max(self, key=None):
        """Returns the max of the items.

        If a key is given it will return the max of all the values of the key.

        Keyword Arguments:
            key {string} -- The key to use to find the max of all the values of that key. (default: {None})

        Returns:
            int -- Returns the max.
        """
        result = 0
        items = self._get_value(key) or self._items

        try:
            return max(items)
        except (TypeError, ValueError):
            pass
        return result

    def min(self, key=None):
        """Returns the min of the items.

        If a key is given it will return the min of all the values of the key.

        Keyword Arguments:
            key {string} -- The key to use to find the min of all the values of that key. (default: {None})

        Returns:
            int -- Returns the min.
        """
        result = 0
        items = self._get_value(key) or self._items

        try:
            return min(items)
        except (TypeError, ValueError):
            pass
        return result

    def chunk(self, size: int):
        """Chunks the items.

        Keyword Arguments:
            size {integer} -- The number of values in each chunk.

        Returns:
            int -- Returns the average.
        """
        items = []
        for i in range(0, self.count(), size):
            items.append(self[i : i + size])
        return self.__class__(items)

    def collapse(self):
        items = []
        for item in self:
            items += self.__get_items(item)
        return self.__class__(items)

    def contains(self, key, value=None):
        if value:
            return self.contains(lambda x: self._data_get(x, key) == value)

        if self._check_is_callable(key, raise_exception=False):
            return self.first(key) is not None

        return key in self

    def count(self):
        return len(self._items)

    def diff(self, items):
        items = self.__get_items(items)
        return self.__class__([x for x in self if x not in items])

    def each(self, callback):
        self._check_is_callable(callback)

        for k, v in enumerate(self):
            result = callback(v)
            if not result:
                break
            self[k] = result

    def every(self, callback):
        self._check_is_callable(callback)
        return all([callback(x) for x in self])

    def filter(self, callback):
        self._check_is_callable(callback)
        return self.__class__(list(filter(callback, self)))

    def flatten(self):
        def _flatten(items):
            if isinstance(items, dict):
                for v in items.values():
                    for x in _flatten(v):
                        yield x
            elif isinstance(items, list):
                for i in items:
                    for j in _flatten(i):
                        yield j
            else:
                yield items

        return self.__class__(list(_flatten(self._items)))

    def forget(self, *keys):
        keys = reversed(sorted(keys))

        for key in keys:
            del self[key]

        return self

    def for_page(self, page, number):
        return self.__class__(self[page:number])

    def get(self, key, default=None):
        try:
            return self[key]
        except IndexError:
            pass

        return self._value(default)

    def implode(self, glue=",", key=None):
        first = self.first()
        if not isinstance(first, str) and key:
            return glue.join(self.pluck(key))
        return glue.join([str(x) for x in self])

    def is_empty(self):
        return not self

    def map(self, callback):
        self._check_is_callable(callback)
        items = [callback(x) for x in self]
        return self.__class__(items)

    def map_into(self, cls, method=None, **kwargs):
        results = []
        for item in self:
            if method:
                results.append(getattr(cls, method)(item, **kwargs))
            else:
                results.append(cls(item))

        return self.__class__(results)

    def merge(self, items):
        if isinstance(items, Collection):
            items = items._items
        elif not isinstance(items, list):
            raise ValueError("Unable to merge uncompatible types")

        items = self.__get_items(items)

        self._items += items
        return self

    def pluck(self, value, key=None, keep_nulls=True):
        if key:
            attributes = {}
        else:
            attributes = []

        if isinstance(self._items, dict):
            return Collection([self._items.get(value)])

        for item in self:
            if isinstance(item, dict):
                iterable = item.items()
            elif hasattr(item, "serialize"):
                iterable = item.serialize().items()
            else:
                iterable = self.all().items()

            for k, v in iterable:
                if keep_nulls is False and v is None:
                    continue

                if k == value:
                    if key:
                        attributes[self._data_get(item, key)] = self._data_get(
                            item, value
                        )
                    else:
                        attributes.append(v)

        return Collection(attributes)

    def pop(self):
        last = self._items.pop()
        return last

    def prepend(self, value):
        self._items.insert(0, value)
        return self

    def pull(self, key):
        value = self.get(key)
        self.forget(key)
        return value

    def push(self, value):
        self._items.append(value)

    def put(self, key, value):
        self._items[key] = value
        return self

    def random(self, count=None):
        """Returns a random item of the collection."""
        collection_count = self.count()
        if collection_count == 0:
            return None
        elif count and count > collection_count:
            raise ValueError("count argument must be inferior to collection length.")
        elif count:
            self._items = random.sample(self._items, k=count)
            return self
        else:
            return random.choice(self._items)

    def reduce(self, callback, initial=0):
        return reduce(callback, self, initial)

    def reject(self, callback):
        self._check_is_callable(callback)

        items = self._get_value(callback) or self._items
        self._items = items

    def reverse(self):
        self._items = self[::-1]

    def serialize(self, *args, **kwargs):
        def _serialize(item):
            if self.__appends__:
                item.set_appends(self.__appends__)

            if hasattr(item, "serialize"):
                return item.serialize(*args, **kwargs)
            elif hasattr(item, "to_dict"):
                return item.to_dict()
            return item

        return list(map(_serialize, self))

    def add_relation(self, result=None):
        for model in self._items:
            model.add_relation(result or {})

        return self

    def shift(self):
        return self.pull(0)

    def sort(self, key=None):
        if key:
            self._items.sort(key=lambda x: x[key], reverse=False)
            return self

        self._items = sorted(self)
        return self

    def sum(self, key=None):
        result = 0
        items = self._get_value(key) or self._items
        try:
            result = sum(items)
        except TypeError:
            pass
        return result

    def to_json(self, **kwargs):
        return json.dumps(self.serialize(), **kwargs)

    def group_by(self, key):
        from itertools import groupby

        self.sort(key)

        new_dict = {}

        for k, v in groupby(self._items, key=lambda x: x[key]):
            new_dict.update({k: list(v)})

        return Collection(new_dict)

    def transform(self, callback):
        self._check_is_callable(callback)
        self._items = self._get_value(callback)

    def unique(self, key=None):
        if not key:
            items = list(set(self._items))
            return self.__class__(items)

        keys = set()
        items = []
        if isinstance(self.all(), dict):
            return self

        for item in self:
            if isinstance(item, dict):
                comparison = item.get(key)
            elif isinstance(item, str):
                comparison = item
            else:
                comparison = getattr(item, key)
            if comparison not in keys:
                items.append(item)
                keys.add(comparison)

        return self.__class__(items)

    def where(self, key, *args):
        op = "=="
        value = args[0]

        if len(args) >= 2:
            op = args[0]
            value = args[1]

        attributes = []

        for item in self._items:
            if isinstance(item, dict):
                comparison = item.get(key)
            else:
                comparison = getattr(item, key) if hasattr(item, key) else False
            if self._make_comparison(comparison, value, op):
                attributes.append(item)
        return self.__class__(attributes)

    def where_in(self, key, args: list) -> "Collection":
        # Compatibility patch - allow numeric strings to match integers
        # (if all args are numeric strings)
        if all(
                [isinstance(arg, str) and arg.isnumeric() for arg in args]
        ):
            return self.where_in(key, [int(arg) for arg in args])

        attributes = []

        for item in self._items:
            if isinstance(item, dict):
                if key not in item:
                    continue
                comparison = item.get(key)
            else:
                if not hasattr(item, key):
                    continue
                comparison = getattr(item, key)

            if comparison in args:
                attributes.append(item)

        return self.__class__(attributes)

    def where_not_in(self, key, args: list) -> "Collection":
        # Compatibility patch - allow numeric strings to match integers
        # (if all args are numeric strings)
        if all(
                [isinstance(arg, str) and arg.isnumeric() for arg in args]
        ):
            return self.where_not_in(key, [int(arg) for arg in args])

        attributes = []

        for item in self._items:
            if isinstance(item, dict):
                if key not in item:
                    continue
                comparison = item.get(key)
            else:
                if not hasattr(item, key):
                    continue
                comparison = getattr(item, key)

            if comparison not in args:
                attributes.append(item)

        return self.__class__(attributes)

    def zip(self, items):
        items = self.__get_items(items)
        if not isinstance(items, list):
            raise ValueError("The 'items' parameter must be a list or a Collection")

        _items = []
        for x, y in zip(self, items):
            _items.append([x, y])
        return self.__class__(_items)

    def set_appends(self, appends):
        """
        Set the attributes that should be appended to the Collection.

        :rtype: list
        """
        self.__appends__ += appends
        return self

    def _get_value(self, key):
        if not key:
            return None

        items = []
        for item in self:
            if isinstance(key, str):
                if hasattr(item, key) or (key in item):
                    items.append(getattr(item, key, item[key]))
            elif callable(key):
                result = key(item)
                if result:
                    items.append(result)
        return items

    def _data_get(self, item, key, default=None):
        try:
            if isinstance(item, (list, tuple, dict)):
                item = item[key]
            elif isinstance(item, object):
                item = getattr(item, key)
        except (IndexError, AttributeError, KeyError, TypeError):
            return self._value(default)

        return item

    def _value(self, value):
        if callable(value):
            return value()
        return value

    def _check_is_callable(self, callback, raise_exception=True):
        if not callable(callback):
            if not raise_exception:
                return False
            raise ValueError("The 'callback' should be a function")
        return True

    def _make_comparison(self, a, b, op):
        operators = {
            "<": operator.lt,
            "<=": operator.le,
            "==": operator.eq,
            "!=": operator.ne,
            ">": operator.gt,
            ">=": operator.ge,
        }
        return operators[op](str(a), str(b))

    def __iter__(self):
        for item in self._items:
            yield item

    def __eq__(self, other):
        other = self.__get_items(other)
        return other == self._items

    def __getitem__(self, item):
        if isinstance(item, slice):
            return self.__class__(self._items[item])
        if isinstance(item, dict):
            return self._items.get(item, None)

        try:
            return self._items[item]
        except KeyError:
            return None

    def __setitem__(self, key, value):
        self._items[key] = value

    def __delitem__(self, key):
        del self._items[key]

    def __ne__(self, other):
        other = self.__get_items(other)
        return other != self._items

    def __len__(self):
        return len(self._items)

    def __le__(self, other):
        other = self.__get_items(other)
        return self._items <= other

    def __lt__(self, other):
        other = self.__get_items(other)
        return self._items < other

    def __ge__(self, other):
        other = self.__get_items(other)
        return self._items >= other

    def __gt__(self, other):
        other = self.__get_items(other)
        return self._items > other

    @classmethod
    def __get_items(cls, items):
        if isinstance(items, Collection):
            items = items.all()

        return items


================================================
FILE: src/masoniteorm/collection/__init__.py
================================================
from .Collection import Collection


================================================
FILE: src/masoniteorm/commands/CanOverrideConfig.py
================================================
from cleo import Command


class CanOverrideConfig(Command):
    def __init__(self):
        super().__init__()
        self.add_option()

    def add_option(self):
        # 8 is the required flag constant in cleo
        self._config.add_option(
            "config",
            "C",
            8,
            description="The path to the ORM configuration file. If not given DB_CONFIG_PATH env variable will be used and finally 'config.database'.",
        )


================================================
FILE: src/masoniteorm/commands/CanOverrideOptionsDefault.py
================================================
from inflection import underscore


class CanOverrideOptionsDefault:
    """Command mixin to allow to override optional argument default values when instantiating the
    command.
    Example: SomeCommand(app, option1="other/default").

    If an argument long name is using - then use _ in keyword argument:
    Example: SomeCommand(app, option_1="other/default") for an option named in option-1
    """

    def __init__(self, **kwargs):
        super().__init__()
        self.overriden_default = kwargs
        for option_name, option in self.config.options.items():
            # Cleo does not authorize _ in option name but - are authorized and unfortunately -
            # cannot be used in Python variables. So underscore() is called to make sure that
            # an option like 'option-a' will be accessible with 'option_a' in kwargs
            default = self.overriden_default.get(underscore(option_name))
            if default:
                option.set_default(default)


================================================
FILE: src/masoniteorm/commands/Command.py
================================================
from .CanOverrideConfig import CanOverrideConfig
from .CanOverrideOptionsDefault import CanOverrideOptionsDefault


class Command(CanOverrideOptionsDefault, CanOverrideConfig):
    pass


================================================
FILE: src/masoniteorm/commands/Entry.py
================================================
"""Craft Command.

This module is really used for backup only if the masonite CLI cannot import this for you.
This can be used by running "python craft". This module is not ran when the CLI can
successfully import commands for you.
"""

from cleo import Application
from . import (
    MigrateCommand,
    MigrateRollbackCommand,
    MigrateRefreshCommand,
    MigrateFreshCommand,
    MakeMigrationCommand,
    MakeModelCommand,
    MakeModelDocstringCommand,
    MakeObserverCommand,
    MigrateStatusCommand,
    MigrateResetCommand,
    MakeSeedCommand,
    SeedRunCommand,
    ShellCommand,
)

application = Application("ORM Version:", 0.1)

application.add(MigrateCommand())
application.add(MigrateRollbackCommand())
application.add(MigrateRefreshCommand())
application.add(MigrateFreshCommand())
application.add(MakeMigrationCommand())
application.add(MakeModelCommand())
application.add(MakeModelDocstringCommand())
application.add(MakeObserverCommand())
application.add(MigrateResetCommand())
application.add(MigrateStatusCommand())
application.add(MakeSeedCommand())
application.add(SeedRunCommand())
application.add(ShellCommand())

if __name__ == "__main__":
    application.run()


================================================
FILE: src/masoniteorm/commands/MakeMigrationCommand.py
================================================
import datetime
import os
import pathlib

from inflection import camelize, tableize

from .Command import Command


class MakeMigrationCommand(Command):
    """
    Creates a new migration file.

    migration
        {name : The name of the migration}
        {--c|create=None : The table to create}
        {--t|table=None : The table to alter}
        {--d|directory=databases/migrations : The location of the migration directory}
    """

    def handle(self):
        name = self.argument("name")
        now = datetime.datetime.today()

        if self.option("create") != "None":
            table = self.option("create")
            stub_file = "create_migration"
        else:
            table = self.option("table")
            stub_file = "table_migration"

        if table == "None":
            table = tableize(name.replace("create_", "").replace("_table", ""))
            stub_file = "create_migration"

        migration_directory = self.option("directory")

        with open(
            os.path.join(
                pathlib.Path(__file__).parent.absolute(), f"stubs/{stub_file}.stub"
            )
        ) as fp:
            output = fp.read()
            output = output.replace("__MIGRATION_NAME__", camelize(name))
            output = output.replace("__TABLE_NAME__", table)

        file_name = f"{now.strftime('%Y_%m_%d_%H%M%S')}_{name}.py"

        with open(os.path.join(os.getcwd(), migration_directory, file_name), "w") as fp:
            fp.write(output)

        self.info(
            f"Migration file created: {os.path.join(migration_directory, file_name)}"
        )


================================================
FILE: src/masoniteorm/commands/MakeModelCommand.py
================================================
import os
import pathlib

from inflection import camelize, tableize, underscore

from .Command import Command


class MakeModelCommand(Command):
    """
    Creates a new model file.

    model
        {name : The name of the model}
        {--m|migration : Optionally create a migration file}
        {--s|seeder : Optionally create a seeder file}
        {--c|create : If the migration file should create a table}
        {--t|table : If the migration file should modify an existing table}
        {--p|pep : Makes the file into pep 8 standards}
        {--d|directory=app : The location of the model directory}
        {--D|migrations-directory=databases/migrations : The location of the migration directory}
        {--S|seeders-directory=databases/seeds : The location of the seeders directory}
    """

    def handle(self):
        name = self.argument("name")

        model_directory = self.option("directory")

        with open(
            os.path.join(pathlib.Path(__file__).parent.absolute(), "stubs/model.stub")
        ) as fp:
            output = fp.read()
            output = output.replace("__CLASS__", camelize(name))

        if self.option("pep"):
            file_name = f"{underscore(name)}.py"
        else:
            file_name = f"{camelize(name)}.py"

        full_directory_path = os.path.join(os.getcwd(), model_directory)

        if os.path.exists(os.path.join(full_directory_path, file_name)):
            self.line(
                f'<error>Model "{name}" Already Exists ({full_directory_path}/{file_name})</error>'
            )
            return

        os.makedirs(os.path.dirname(os.path.join(full_directory_path)), exist_ok=True)

        with open(os.path.join(os.getcwd(), model_directory, file_name), "w+") as fp:
            fp.write(output)

        self.info(f"Model created: {os.path.join(model_directory, file_name)}")
        if self.option("migration"):
            migrations_directory = self.option("migrations-directory")
            if self.option("table"):
                self.call(
                    "migration",
                    f"update_{tableize(name)}_table --table {tableize(name)} --directory {migrations_directory}",
                )
            else:
                self.call(
                    "migration",
                    f"create_{tableize(name)}_table --create {tableize(name)} --directory {migrations_directory}",
                )

        if self.option("seeder"):
            directory = self.option("seeders-directory")
            self.call("seed", f"{self.argument('name')} --directory {directory}")


================================================
FILE: src/masoniteorm/commands/MakeModelDocstringCommand.py
================================================
from ..config import load_config
from .Command import Command


class MakeModelDocstringCommand(Command):
    """
    Generate model docstring and type hints (for auto-completion).

    model:docstring
        {table : The table you want to generate docstring and type hints}
        {--t|type-hints : The table you want to generate docstring and type hints}
        {--c|connection=default : The connection you want to use}
    """

    def handle(self):
        table = self.argument("table")
        DB = load_config(self.option("config")).DB

        schema = DB.get_schema_builder(self.option("connection"))

        if not schema.has_table(table):
            return self.line_error(
                f"There is no such table {table} for this connection."
            )

        self.info(f"Model Docstring for table: {table}")
        print('"""')
        for _, column in schema.get_columns(table).items():
            length = f"({column.length})" if column.length else ""
            default = f" default: {column.default}"
            print(f"{column.name}: {column.column_type}{length}{default}")
        print('"""')

        if self.option("type-hints"):
            self.info(f"Model Type Hints for table: {table}")
            for name, column in schema.get_columns(table).items():
                print(f"    {name}:{column.column_python_type.__name__}")


================================================
FILE: src/masoniteorm/commands/MakeObserverCommand.py
================================================
import os
import pathlib

from inflection import camelize, underscore

from .Command import Command


class MakeObserverCommand(Command):
    """
    Creates a new observer file.

    observer
        {name : The name of the observer}
        {--m|model=None : The name of the model}
        {--d|directory=app/observers : The location of the observers directory}
    """

    def handle(self):
        name = self.argument("name")
        model = self.option("model")
        if model == "None":
            model = name

        observer_directory = self.option("directory")

        with open(
            os.path.join(
                pathlib.Path(__file__).parent.absolute(), "stubs/observer.stub"
            )
        ) as fp:
            output = fp.read()
            output = output.replace("__CLASS__", camelize(name))
            output = output.replace("__MODEL_VARIABLE__", underscore(model))
            output = output.replace("__MODEL__", camelize(model))

        file_name = f"{camelize(name)}Observer.py"

        full_directory_path = os.path.join(os.getcwd(), observer_directory)

        if os.path.exists(os.path.join(full_directory_path, file_name)):
            self.line(
                f'<error>Observer "{name}" Already Exists ({full_directory_path}/{file_name})</error>'
            )
            return

        os.makedirs(os.path.join(full_directory_path), exist_ok=True)

        with open(os.path.join(os.getcwd(), observer_directory, file_name), "w+") as fp:
            fp.write(output)

        self.info(f"Observer created: {file_name}")


================================================
FILE: src/masoniteorm/commands/MakeSeedCommand.py
================================================
import os
import pathlib

from inflection import camelize, underscore

from .Command import Command


class MakeSeedCommand(Command):
    """
    Creates a new seed file.

    seed
        {name : The name of the seed}
        {--d|directory=databases/seeds : The location of the seed directory}
    """

    def handle(self):
        # get the contents of a stub file
        # replace the placeholders of a stub file
        # output the content to a file location
        name = self.argument("name") + "TableSeeder"
        seed_directory = self.option("directory")

        file_name = underscore(name)
        stub_file = "create_seed"

        with open(
            os.path.join(
                pathlib.Path(__file__).parent.absolute(), f"stubs/{stub_file}.stub"
            )
        ) as fp:
            output = fp.read()
            output = output.replace("__SEEDER_NAME__", camelize(name))

        file_name = f"{underscore(name)}.py"
        full_path = pathlib.Path(os.path.join(os.getcwd(), seed_directory, file_name))

        path_normalized = pathlib.Path(seed_directory) / pathlib.Path(file_name)

        if os.path.exists(full_path):
            return self.line(f"<error>{path_normalized} already exists.</error>")

        with open(full_path, "w") as fp:
            fp.write(output)

        self.info(f"Seed file created: {path_normalized}")


================================================
FILE: src/masoniteorm/commands/MigrateCommand.py
================================================
import os

from ..migrations import Migration
from .Command import Command


class MigrateCommand(Command):
    """
    Run migrations.

    migrate
        {--m|migration=all : Migration's name to be migrated}
        {--c|connection=default : The connection you want to run migrations on}
        {--f|force : Force migrations without prompt in production}
        {--s|show : Shows the output of SQL for migrations that would be running}
        {--schema=? : Sets the schema to be migrated}
        {--d|directory=databases/migrations : The location of the migration directory}
    """

    def handle(self):
        # prompt user for confirmation in production
        if os.getenv("APP_ENV") == "production" and not self.option("force"):
            answer = ""
            while answer not in ["y", "n"]:
                answer = input(
                    "Do you want to run migrations in PRODUCTION ? (y/n)\n"
                ).lower()
            if answer != "y":
                self.info("Migrations cancelled")
                exit(0)
        migration = Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        )
        migration.create_table_if_not_exists()
        if not migration.get_unran_migrations():
            self.info("Nothing To Migrate!")
            return

        migration_name = self.option("migration")
        show_output = self.option("show")

        migration.migrate(migration=migration_name, output=show_output)


================================================
FILE: src/masoniteorm/commands/MigrateFreshCommand.py
================================================
from ..migrations import Migration

from .Command import Command


class MigrateFreshCommand(Command):
    """
    Drops all tables and migrates them again.

    migrate:fresh
        {--c|connection=default : The connection you want to run migrations on}
        {--d|directory=databases/migrations : The location of the migration directory}
        {--f|ignore-fk=? : The connection you want to run migrations on}
        {--s|seed=? : Seed database after fresh. The seeder to be ran can be provided in argument}
        {--schema=? : Sets the schema to be migrated}
        {--D|seed-directory=databases/seeds : The location of the seed directory if seed option is used.}
    """

    def handle(self):
        migration = Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        )

        migration.fresh(ignore_fk=self.option("ignore-fk"))

        self.line("")

        if self.option("seed") == "null":
            self.call(
                "seed:run",
                f"None --directory {self.option('seed-directory')} --connection {self.option('connection')}",
            )

        elif self.option("seed"):
            self.call(
                "seed:run",
                f"{self.option('seed')} --directory {self.option('seed-directory')} --connection {self.option('connection')}",
            )


================================================
FILE: src/masoniteorm/commands/MigrateRefreshCommand.py
================================================
from ..migrations import Migration

from .Command import Command


class MigrateRefreshCommand(Command):
    """
    Rolls back migrations and migrates them again.

    migrate:refresh
        {--m|migration=all : Migration's name to be refreshed}
        {--c|connection=default : The connection you want to run migrations on}
        {--d|directory=databases/migrations : The location of the migration directory}
        {--s|seed=? : Seed database after refresh. The seeder to be ran can be provided in argument}
        {--schema=? : Sets the schema to be migrated}
        {--D|seed-directory=databases/seeds : The location of the seed directory if seed option is used.}
    """

    def handle(self):
        migration = Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        )

        migration.refresh(self.option("migration"))

        self.line("")

        if self.option("seed") == "null":
            self.call(
                "seed:run",
                f"None --directory {self.option('seed-directory')} --connection {self.option('connection')}",
            )

        elif self.option("seed"):
            self.call(
                "seed:run",
                f"{self.option('seed')} --directory {self.option('seed-directory')} --connection {self.option('connection')}",
            )


================================================
FILE: src/masoniteorm/commands/MigrateResetCommand.py
================================================
from ..migrations import Migration
from .Command import Command


class MigrateResetCommand(Command):
    """
    Reset migrations.

    migrate:reset
        {--m|migration=all : Migration's name to be rollback}
        {--c|connection=default : The connection you want to run migrations on}
        {--schema=? : Sets the schema to be migrated}
        {--d|directory=databases/migrations : The location of the migration directory}
    """

    def handle(self):
        migration = Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        )

        migration.reset(self.option("migration"))


================================================
FILE: src/masoniteorm/commands/MigrateRollbackCommand.py
================================================
from ..migrations import Migration
from .Command import Command


class MigrateRollbackCommand(Command):
    """
    Rolls back the last batch of migrations.

    migrate:rollback
        {--m|migration=all : Migration's name to be rollback}
        {--c|connection=default : The connection you want to run migrations on}
        {--s|show : Shows the output of SQL for migrations that would be running}
        {--schema=? : Sets the schema to be migrated}
        {--d|directory=databases/migrations : The location of the migration directory}
    """

    def handle(self):
        Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        ).rollback(migration=self.option("migration"), output=self.option("show"))


================================================
FILE: src/masoniteorm/commands/MigrateStatusCommand.py
================================================
from ..migrations import Migration
from .Command import Command


class MigrateStatusCommand(Command):
    """
    Display migrations status.

    migrate:status
        {--c|connection=default : The connection you want to run migrations on}
        {--schema=? : Sets the schema to be migrated}
        {--d|directory=databases/migrations : The location of the migration directory}
    """

    def handle(self):
        migration = Migration(
            command_class=self,
            connection=self.option("connection"),
            migration_directory=self.option("directory"),
            config_path=self.option("config"),
            schema=self.option("schema"),
        )
        migration.create_table_if_not_exists()
        table = self.table()
        table.set_header_row(["Ran?", "Migration", "Batch"])
        migrations = []

        for migration_data in migration.get_ran_migrations():
            migration_file = migration_data["migration_file"]
            batch = migration_data["batch"]

            migrations.append(
                [
                    "<info>Y</info>",
                    f"<comment>{migration_file}</comment>",
                    f"<info>{batch}</info>",
                ]
            )

        for migration_file in migration.get_unran_migrations():
            migrations.append(
                [
                    "<error>N</error>",
                    f"<comment>{migration_file}</comment>",
                    "<info>-</info>",
                ]
            )

        table.set_rows(migrations)

        table.render(self.io)


================================================
FILE: src/masoniteorm/commands/SeedRunCommand.py
================================================
from inflection import camelize, underscore

from ..seeds import Seeder
from .Command import Command


class SeedRunCommand(Command):
    """
    Run seeds.

    seed:run
        {--c|connection=default : The connection you want to run migrations on}
        {--dry : If the seed should run in dry mode}
        {table=None : Name of the table to seed}
        {--d|directory=databases/seeds : The location of the seed directory}
    """

    def handle(self):
        seeder = Seeder(
            dry=self.option("dry"),
            seed_path=self.option("directory"),
            connection=self.option("connection"),
        )

        if self.argument("table") == "None":
            seeder.run_database_seed()
            seeder_seeded = "Database Seeder"

        else:
            table = self.argument("table")
            seeder_file = (
                f"{underscore(table)}_table_seeder.{camelize(table)}TableSeeder"
            )
            seeder.run_specific_seed(seeder_file)
            seeder_seeded = f"{camelize(table)}TableSeeder"

        self.line(f"<info>{seeder_seeded} seeded!</info>")


================================================
FILE: src/masoniteorm/commands/ShellCommand.py
================================================
import subprocess
import os
import re
import shlex
from collections import OrderedDict

from ..config import load_config

from .Command import Command


class ShellCommand(Command):
    """
    Connect to your database interactive terminal.

    shell
        {--c|connection=default : The connection you want to use to connect to interactive terminal}
        {--s|show=? : Display the command which will be called to connect}
    """

    shell_programs = {
        "mysql": "mysql",
        "postgres": "psql",
        "sqlite": "sqlite3",
        "mssql": "sqlcmd",
    }

    def handle(self):
        resolver = load_config(self.option("config")).DB
        connection = self.option("connection")
        if connection == "default":
            connection = resolver.get_connection_details()["default"]
        config = resolver.get_connection_information(connection)
        if not config.get("full_details"):
            self.line(
                f"<error>Connection configuration for '{connection}' not found !</error>"
            )
            exit(-1)

        command, env = self.get_command(config)

        if self.option("show"):
            cleaned_command = self.hide_sensitive_options(config, command)
            self.comment(cleaned_command)
            self.line("")

        # let shlex split command in a list as it's safer
        command_args = shlex.split(command)
        try:
            subprocess.run(command_args, check=True, env=env)
        except FileNotFoundError:
            self.line(
                f"<error>Cannot find {config.get('full_details').get('driver')} program ! Please ensure you can call this program in your shell first.</error>"
            )
            exit(-1)
        except subprocess.CalledProcessError:
            self.line("<error>An error happened calling the command.</error>")
            exit(-1)

    def get_shell_program(self, connection):
        """Get the database shell program to run."""
        return self.shell_programs.get(connection)

    def get_command(self, config):
        """Get the command to run as a string."""
        driver = config.get("full_details").get("driver")
        program = self.get_shell_program(driver)
        try:
            get_driver_args = getattr(self, f"get_{driver}_args")
        except AttributeError:
            self.line(
                f"<error>Connecting with driver '{driver}' is not implemented !</error>"
            )
            exit(-1)
        args, options = get_driver_args(config)
        # process positional arguments
        args = " ".join(args)
        # process optional arguments
        options = self.remove_empty_options(options)
        options_string = " ".join(
            f"{option} {value}" if value else option
            for option, value in options.items()
        )
        # finally build command string
        command = program
        if args:
            command += f" {args}"
        if options_string:
            command += f" {options_string}"

        # prepare environment in which command will be run
        # some drivers need to define env variable such as psql for specifying password
        try:
            driver_env = getattr(self, f"get_{driver}_env")(config)
        except AttributeError:
            driver_env = {}
        command_env = {**os.environ.copy(), **driver_env}

        return command, command_env

    def get_mysql_args(self, config):
        """Get command positional arguments and options for MySQL driver."""
        args = [config.get("database")]
        options = OrderedDict(
            {
                "--host": config.get("host"),
                "--port": config.get("port"),
                "--user": config.get("user"),
                "--password": config.get("password"),
                "--default-character-set": config.get("options", {}).get("charset"),
            }
        )
        return args, options

    def get_postgres_args(self, config):
        """Get command positional arguments and options for PostgreSQL driver."""
        args = [config.get("database")]
        options = OrderedDict(
            {
                "--host": config.get("host"),
                "--port": config.get("port"),
                "--username": config.get("user"),
            }
        )
        return args, options

    def get_postgres_env(self, config):
        return {"PGPASSWORD": config.get("password")}

    def get_mssql_args(self, config):
        """Get command positional arguments and options for MSSQL driver."""
        args = []

        # instance of SQL Server: -S [protocol:]server[instance_name][,port]
        server = f"tcp:{config.get('host')}"
        if config.get("port"):
            server += f",{config.get('port')}"

        trusted_connection = config.get("options").get("trusted_connection") == "Yes"
        options = OrderedDict(
            {
                "-d": config.get("database"),
                "-U": config.get("user"),
                "-P": config.get("password"),
                "-S": server,
                "-E": trusted_connection,
                "-t": config.get("options", {}).get("connection_timeout"),
            }
        )
        return args, options

    def get_sqlite_args(self, config):
        """Get command positional arguments and options for SQLite driver."""
        args = [config.get("database")]
        options = OrderedDict()
        return args, options

    def remove_empty_options(self, options):
        """Remove empty options when value does not evaluate to True.
        Also when value is exactly 'True' we don't want True to be passed as option value but
        we want the option to be passed.
        """
        # remove empty options and remove value when option is True
        cleaned_options = OrderedDict()
        for key, value in options.items():
            if value is True:
                cleaned_options[key] = ""
            elif value:
                cleaned_options[key] = value
        return cleaned_options

    def get_sensitive_options(self, config):
        driver = config.get("full_details").get("driver")
        try:
            sensitive_options = getattr(self, f"get_{driver}_sensitive_options")()
        except AttributeError:
            sensitive_options = []
        return sensitive_options

    def get_mysql_sensitive_options(self):
        return ["--password"]

    def get_mssql_sensitive_options(self):
        return ["-P"]

    def hide_sensitive_options(self, config, command):
        """Hide sensitive options in command string before it's displayed in the shell for
        security reasons. All drivers can declare what options are considered sensitive, their
        values will be then replaced by *** when displayed only."""
        cleaned_command = command
        sensitive_options = self.get_sensitive_options(config)
        for option in sensitive_options:
            # if option is used obfuscate its value
            if option in command:
                match = re.search(rf"{option} (\w+)", command)
                if match.groups():
                    cleaned_command = cleaned_command.replace(match.groups()[0], "***")
        return cleaned_command


================================================
FILE: src/masoniteorm/commands/__init__.py
================================================
import os
import sys

sys.path.append(os.getcwd())

from .MigrateCommand import MigrateCommand
from .MigrateRollbackCommand import MigrateRollbackCommand
from .MigrateRefreshCommand import MigrateRefreshCommand
from .MigrateFreshCommand import MigrateFreshCommand
from .MigrateResetCommand import MigrateResetCommand
from .MakeModelCommand import MakeModelCommand
from .MakeModelDocstringCommand import MakeModelDocstringCommand
from .MakeObserverCommand import MakeObserverCommand
from .MigrateStatusCommand import MigrateStatusCommand
from .MakeMigrationCommand import MakeMigrationCommand
from .MakeSeedCommand import MakeSeedCommand
from .SeedRunCommand import SeedRunCommand
from .ShellCommand import ShellCommand


================================================
FILE: src/masoniteorm/commands/stubs/create_migration.stub
================================================
"""__MIGRATION_NAME__ Migration."""

from masoniteorm.migrations import Migration


class __MIGRATION_NAME__(Migration):
    def up(self):
        """
        Run the migrations.
        """
        with self.schema.create("__TABLE_NAME__") as table:
            table.increments("id")

            table.timestamps()

    def down(self):
        """
        Revert the migrations.
        """
        self.schema.drop("__TABLE_NAME__")


================================================
FILE: src/masoniteorm/commands/stubs/create_seed.stub
================================================
"""__SEEDER_NAME__ Seeder."""

from masoniteorm.seeds import Seeder


class __SEEDER_NAME__(Seeder):
    def run(self):
        """Run the database seeds."""
        pass


================================================
FILE: src/masoniteorm/commands/stubs/model.stub
================================================
""" __CLASS__ Model """

from masoniteorm.models import Model


class __CLASS__(Model):
    """__CLASS__ Model"""

    pass


================================================
FILE: src/masoniteorm/commands/stubs/observer.stub
================================================
"""__CLASS__ Observer"""

from masoniteorm.models import Model


class __CLASS__Observer:
    def created(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "created" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def creating(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "creating" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def saving(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "saving" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def saved(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "saved" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def updating(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "updating" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def updated(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "updated" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def booted(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "booted" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def booting(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "booting" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def hydrating(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "hydrating" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def hydrated(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "hydrated" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def deleting(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "deleting" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass

    def deleted(self, __MODEL_VARIABLE__):
        """Handle the __MODEL__ "deleted" event.

        Args:
            __MODEL_VARIABLE__ (masoniteorm.models.Model): __MODEL__ model.
        """
        pass


================================================
FILE: src/masoniteorm/commands/stubs/table_migration.stub
================================================
"""__MIGRATION_NAME__ Migration."""

from masoniteorm.migrations import Migration


class __MIGRATION_NAME__(Migration):
    def up(self):
        """
        Run the migrations.
        """
        with self.schema.table("__TABLE_NAME__") as table:
            pass

    def down(self):
        """
        Revert the migrations.
        """
        with self.schema.table("__TABLE_NAME__") as table:
            pass


================================================
FILE: src/masoniteorm/config.py
================================================
import os
import pydoc
import urllib.parse as urlparse

from .exceptions import ConfigurationNotFound
from .exceptions import InvalidUrlConfiguration


def load_config(config_path=None):
    """Load ORM configuration from given configuration path (dotted or not).
    If no path is provided:
        1. try to load from DB_CONFIG_PATH environment variable
        2. else try to load from default config_path: config/database
    """
    selected_config_path = (
        os.getenv("DB_CONFIG_PATH", None) or config_path or "config/database"
    )

    os.environ["DB_CONFIG_PATH"] = selected_config_path

    # format path as python module if needed
    selected_config_path = (
        selected_config_path.replace("/", ".").replace("\\", ".").rstrip(".py")
    )
    config_module = pydoc.locate(selected_config_path)
    if config_module is None:
        raise ConfigurationNotFound(
            f"ORM configuration file has not been found in {selected_config_path}."
        )
    return config_module


def db_url(database_url=None, prefix="", options={}, log_queries=False):
    """Parse connection configuration from database url format. If no url is provided,
    DATABASE_URL environment variable will be used instead.

    Reference: Code adapted from https://github.com/jacobian/dj-database-url
    """

    url = database_url or os.getenv("DATABASE_URL")
    if not url:
        raise InvalidUrlConfiguration("Database url is empty !")

    # Register database schemes in URLs.
    urlparse.uses_netloc.append("postgres")
    urlparse.uses_netloc.append("postgresql")
    urlparse.uses_netloc.append("pgsql")
    urlparse.uses_netloc.append("postgis")
    urlparse.uses_netloc.append("mysql")
    urlparse.uses_netloc.append("mysql2")
    urlparse.uses_netloc.append("mysqlgis")
    urlparse.uses_netloc.append("mssql")
    urlparse.uses_netloc.append("sqlite")

    DRIVERS_MAP = {
        "postgres": "postgres",
        "postgresql": "postgres",
        "pgsql": "postgres",
        "postgis": "postgres",
        "mysql": "mysql",
        "mysql2": "mysql",
        "mysqlgis": "mysql",
        "mysql-connector": "mysql",
        "mssql": "mssql",
        "sqlite": "sqlite",
    }

    # this is a special case, because if we pass this URL into
    # urlparse, urlparse will choke trying to interpret "memory"
    # as a port number
    if url in ["sqlite://:memory:", "sqlite://memory"]:
        driver = DRIVERS_MAP["sqlite"]
        path = ":memory:"
    # otherwise parse the url as normal
    else:
        url = urlparse.urlparse(url)
        # remove query string from path (not parsed for now)
        path = url.path[1:]
        if "?" in path and not url.query:
            path, _ = path.split("?", 2)

        # if we are using sqlite and we have no path, then assume we
        # want an in-memory database (this is the behaviour of sqlalchemy)
        if url.scheme == "sqlite" and path == "":
            path = ":memory:"

        # handle postgres percent-encoded paths.
        hostname = url.hostname or ""
        if "%2f" in hostname.lower():
            # Switch to url.netloc to avoid lower cased paths
            hostname = url.netloc
            if "@" in hostname:
                hostname = hostname.rsplit("@", 1)[1]
            if ":" in hostname:
                hostname = hostname.split(":", 1)[0]
            hostname = hostname.replace("%2f", "/").replace("%2F", "/")

        # lookup specified driver
        driver = DRIVERS_MAP[url.scheme]
        port = (
            str(url.port) if url.port and driver in [DRIVERS_MAP["mssql"]] else url.port
        )

    # build final configuration
    config = {
        "driver": driver,
        "database": urlparse.unquote(path or ""),
        "prefix": prefix,
        "options": options,
        "log_queries": log_queries,
    }

    if driver != DRIVERS_MAP["sqlite"]:
        config.update(
            {
                "user": urlparse.unquote(url.username or ""),
                "password": urlparse.unquote(url.password or ""),
                "host": hostname,
                "port": port or "",
            }
        )
    return config


================================================
FILE: src/masoniteorm/connections/.gitignore
================================================


================================================
FILE: src/masoniteorm/connections/BaseConnection.py
================================================
import logging
from timeit import default_timer as timer
from .ConnectionResolver import ConnectionResolver


class BaseConnection:
    _connection = None
    _cursor = None
    _dry = False

    def dry(self):
        self._dry = True
        return self

    def set_schema(self, schema):
        self.schema = schema
        return self

    def log(
        self, query, bindings, query_time=0, logger="masoniteorm.connections.queries"
    ):
        logger = logging.getLogger("masoniteorm.connection.queries")
        logger.propagate = self.full_details.get("propagate", True)

        logger.debug(
            f"Running query {query}, {bindings}. Executed in {query_time}ms",
            extra={"query": query, "bindings": bindings, "query_time": query_time},
        )

    def statement(self, query, bindings=()):
        """Wrapper around calling the cursor query. Helpful for logging output.

        Args:
            query (string): The query to execute on the cursor
            bindings (tuple, optional): Tuple of query bindings. Defaults to ().
        """
        start = timer()
        if not self._cursor:
            raise AttributeError(
                f"Must set the _cursor attribute on the {self.__class__.__name__} class before calling the 'statement' method."
            )

        self._cursor.execute(query, bindings)
        end = "{:.2f}".format(timer() - start)

        if self.full_details and self.full_details.get("log_queries", False):
            self.log(query, bindings, query_time=end)

    def has_global_connection(self):
        return self.name in ConnectionResolver().get_global_connections()

    def get_global_connection(self):
        return ConnectionResolver().get_global_connections()[self.name]

    def enable_query_log(self):
        self.full_details["log_queries"] = True

    def disable_query_log(self):
        self.full_details["log_queries"] = False

    def format_cursor_results(self, cursor_result):
        return cursor_result

    def set_cursor(self):
        self._cursor = self._connection.cursor()
        return self

    def select_many(self, query, bindings, amount):
        self.set_cursor()
        self.statement(query)
        if not self.open:
            self.make_connection()

        result = self.format_cursor_results(self._cursor.fetchmany(amount))
        while result:
            yield result

            result = self.format_cursor_results(self._cursor.fetchmany(amount))

    def enable_disable_foreign_keys(self):
        foreign_keys = self.full_details.get("foreign_keys")
        platform = self.get_default_platform()()

        if foreign_keys:
            self._connection.execute(platform.enable_foreign_key_constraints())
        elif foreign_keys is not None:
            self._connection.execute(platform.disable_foreign_key_constraints())


================================================
FILE: src/masoniteorm/connections/ConnectionFactory.py
================================================
from ..config import load_config


class ConnectionFactory:
    """Class for controlling the registration and creation of connection types."""

    _connections = {}

    def __init__(self, config_path=None):
        self.config_path = config_path

    @classmethod
    def register(cls, key, connection):
        """Registers new connections

        Arguments:
            key {key} -- The key or driver name you want assigned to this connection
            connection {masoniteorm.connections.BaseConnection} -- An instance of a BaseConnection class.

        Returns:
            cls
        """
        cls._connections.update({key: connection})
        return cls

    def make(self, key):
        """Makes already registered connections

        Arguments:
            key {string} -- The name of the connection you want to make

        Raises:
            Exception: Raises exception if there are no driver keys that match

        Returns:
            masoniteorm.connection.BaseConnection -- Returns an instance of a BaseConnection class.
        """

        DB = load_config(config_path=self.config_path).DB

        connections = DB.get_connection_details()

        if key == "default":
            connection_details = connections.get(connections.get("default"))
            connection = self._connections.get(connection_details.get("driver"))
        else:
            connection_details = connections.get(key)
            connection = self._connections.get(key)

        if connection:
            return connection

        raise Exception(
            "The '{connection}' connection does not exist".format(connection=key)
        )


================================================
FILE: src/masoniteorm/connections/ConnectionResolver.py
================================================
from contextlib import contextmanager


class ConnectionResolver:
    _connection_details = {}
    _connections = {}
    _morph_map = {}

    def __init__(self, config_path=None):
        from ..connections import (
            SQLiteConnection,
            PostgresConnection,
            MySQLConnection,
            MSSQLConnection,
        )

        self.config_path = config_path
        from ..connections import ConnectionFactory

        self.connection_factory = ConnectionFactory(config_path=config_path)
        self.register(SQLiteConnection)
        self.register(PostgresConnection)
        self.register(MySQLConnection)
        self.register(MSSQLConnection)

    def morph_map(self, map):
        self._morph_map = map
        return self

    def set_connection_details(self, connection_details):
        self.__class__._connection_details = connection_details
        return self

    def get_connection_details(self):
        return self._connection_details

    def set_connection_option(self, connection: str, options: dict):
        self._connection_details.get(connection).update(options)
        return self

    def get_global_connections(self):
        return self._connections

    def remove_global_connection(self, name=None):
        self._connections.pop(name)

    def register(self, connection):
        self.connection_factory.register(connection.name, connection)

    def begin_transaction(self, name=None):
        if name is None:
            name = self.get_connection_details()["default"]

        driver = self.get_connection_details()[name].get("driver")

        connection = (
            self.connection_factory.make(driver)(
                **self.get_connection_information(name)
            )
            .make_connection()
            .begin()
        )
        self.__class__._connections.update({name: connection})

        return connection

    def commit(self, name=None):
        if name is None:
            name = self.get_connection_details()["default"]
        connection = self.get_global_connections()[name]
        self.remove_global_connection(name)
        connection.commit()

    def rollback(self, name=None):
        if name is None:
            name = self.get_connection_details()["default"]

        connection = self.get_global_connections()[name]
        self.remove_global_connection(name)
        connection.rollback()

    @contextmanager
    def transaction(self, name=None):
        self.begin_transaction(name)
        try:
            yield self
        except Exception:
            self.rollback(name)
            raise

        try:
            self.commit(name)
        except Exception:
            self.rollback(name)
            raise

    def get_connection_information(self, name):
        details = self.get_connection_details()
        return {
            "host": details.get(name, {}).get("host"),
            "database": details.get(name, {}).get("database"),
            "user": details.get(name, {}).get("user"),
            "port": details.get(name, {}).get("port"),
            "password": details.get(name, {}).get("password"),
            "prefix": details.get(name, {}).get("prefix"),
            "options": details.get(name, {}).get("options", {}),
            "full_details": details.get(name, {}),
        }

    def get_schema_builder(self, connection="default", schema=None):
        from ..schema import Schema

        return Schema(
            connection=connection,
            connection_details=self.get_connection_details(),
            schema=schema,
        )

    def get_query_builder(self, connection="default"):
        from ..query import QueryBuilder

        return QueryBuilder(
            connection=connection, connection_details=self.get_connection_details()
        )

    def statement(self, query, bindings=(), connection="default"):
        return self.get_query_builder().on(connection).statement(query, bindings)


================================================
FILE: src/masoniteorm/connections/MSSQLConnection.py
================================================
from ..exceptions import DriverNotFound
from .BaseConnection import BaseConnection
from ..query.grammars import MSSQLGrammar
from ..schema.platforms import MSSQLPlatform
from ..query.processors import MSSQLPostProcessor
from ..exceptions import QueryException


CONNECTION_POOL = []


class MSSQLConnection(BaseConnection):
    """MSSQL Connection class."""

    name = "mssql"

    def __init__(
        self,
        host=None,
        database=None,
        user=None,
        port=None,
        password=None,
        prefix=None,
        options=None,
        full_details=None,
        name=None,
    ):
        self.host = host
        if port:
            self.port = int(port)
        else:
            self.port = port
        self.database = database
        self.user = user
        self.password = password
        self.prefix = prefix
        self.full_details = full_details or {}
        self.options = options or {}
        self._cursor = None
        self.transaction_level = 0
        self.open = 0
        if name:
            self.name = name

    def make_connection(self):
        """This sets the connection on the connection class"""
        try:
            import pyodbc
        except ModuleNotFoundError:
            raise DriverNotFound(
                "You must have the 'pyodbc' package installed to make a connection to Microsoft SQL Server. Please install it using 'pip install pyodbc'"
            )

        if self.has_global_connection():
            return self.get_global_connection()

        driver = self.options.get("driver", "ODBC Driver 17 for SQL Server")
        integrated_security = self.options.get("integrated_security")
        connection_timeout = str(self.options.get("connection_timeout", "30"))
        authentication = self.options.get("authentication")
        instance = self.options.get("instance", "")
        trusted_connection = self.options.get("trusted_connection")

        if instance:
            instance = "\\" + instance

        self._connection = pyodbc.connect(
            f"DRIVER={driver};SERVER={self.host}{instance if instance else ''},{self.port};Connection Timeout={connection_timeout};DATABASE={self.database}{f';Integrated Security={integrated_security}' if integrated_security else ''};UID={self.user};PWD={self.password}{f';Trusted_Connection={trusted_connection}' if trusted_connection else ''}{f';Authentication={authentication}' if authentication else ''}",
            autocommit=True,
        )

        self.enable_disable_foreign_keys()

        self.open = 1
        return self

    def get_database_name(self):
        return self.database

    @classmethod
    def get_default_query_grammar(cls):
        return MSSQLGrammar

    @classmethod
    def get_default_platform(cls):
        return MSSQLPlatform

    @classmethod
    def get_default_post_processor(cls):
        return MSSQLPostProcessor

    def reconnect(self):
        pass

    def commit(self):
        """Transaction"""
        if self.get_transaction_level() == 1:
            self._connection.commit()
            self._connection.autocommit = True

        self.transaction_level -= 1

    def begin(self):
        """MSSQL Transaction"""
        self._connection.autocommit = False
        self.transaction_level += 1
        return self

    def rollback(self):
        """Transaction"""
        if self.get_transaction_level() == 1:
            self._connection.rollback()
            self._connection.autocommit = True

        self.transaction_level -= 1

    def get_transaction_level(self):
        """Transaction"""
        return self.transaction_level

    def get_cursor(self):
        return self._cursor

    def query(self, query, bindings=(), results="*"):
        """Make the actual query that will reach the database and come back with a result.

        Arguments:
            query {string} -- A string query. This could be a qmarked string or a regular query.
            bindings {tuple} -- A tuple of bindings

        Keyword Arguments:
            results {str|1} -- If the results is equal to an asterisks it will call 'fetchAll'
                    else it will return 'fetchOne' and return a single record. (default: {"*"})

        Returns:
            dict|None -- Returns a dictionary of results or None
        """

        try:
            if not self.open:
                self.make_connection()
            self._cursor = self._connection.cursor()
            with self._cursor as cursor:
                if isinstance(query, list) and not self._dry:
                    for q in query:
                        self.statement(q, ())
                    return
                query = query.replace("'?'", "?")
                self.statement(query, bindings)
                if results == 1:
                    if not cursor.description:
                        return {}
                    columnNames = [column[0] for column in cursor.description]
                    result = cursor.fetchone()
                    return dict(zip(columnNames, result)) if result is not None else {}
                else:
                    if not cursor.description:
                        return {}
                    return self.format_cursor_results(cursor.fetchall())

                return {}
        except Exception as e:
            raise QueryException(str(e)) from e
        finally:
            if self.get_transaction_level() <= 0:
                self._connection.close()

    def format_cursor_results(self, cursor_result):
        columnNames = [column[0] for column in self.get_cursor().description]
        results = []
        for record in cursor_result:
            results.append(dict(zip(columnNames, record)))

        return results


================================================
FILE: src/masoniteorm/connections/MySQLConnection.py
================================================
from ..exceptions import DriverNotFound
from .BaseConnection import BaseConnection
from ..query.grammars import MySQLGrammar
from ..schema.platforms import MySQLPlatform
from ..query.processors import MySQLPostProcessor
from ..exceptions import QueryException

CONNECTION_POOL = []


class MySQLConnection(BaseConnection):
    """MYSQL Connection class."""

    name = "mysql"
    _dry = False

    def __init__(
        self,
        host=None,
        database=None,
        user=None,
        port=None,
        password=None,
        prefix=None,
        options=None,
        full_details=None,
        name=None,
    ):
        self.host = host
        self.port = port
        if str(port).isdigit():
            self.port = int(self.port)
        self.database = database

        self.user = user
        self.password = password
        self.prefix = prefix
        self.full_details = full_details or {}
        self.connection_pool_size = full_details.get("connection_pooling_max_size", 100)
        self.options = options or {}
        self._cursor = None
        self.open = 0
        self.transaction_level = 0
        if name:
            self.name = name

    def make_connection(self):
        """This sets the connection on the connection class"""

        if self._dry:
            return

        if self.has_global_connection():
            return self.get_global_connection()

        # Check if there is an available connection in the pool
        self._connection = self.create_connection()
        self.enable_disable_foreign_keys()

        return self

    def close_connection(self):
        if (
            self.full_details.get("connection_pooling_enabled")
            and len(CONNECTION_POOL) < self.connection_pool_size
        ):
            CONNECTION_POOL.append(self._connection)
        self.open = 0
        self._connection = None

    def create_connection(self, autocommit=True):

        try:
            import pymysql
        except ModuleNotFoundError:
            raise DriverNotFound(
                "You must have the 'pymysql' package "
                "installed to make a connection to MySQL. "
                "Please install it using 'pip install pymysql'"
            )
        import pendulum
        import pymysql.converters

        pymysql.converters.conversions[pendulum.DateTime] = (
            pymysql.converters.escape_datetime
        )

        # Initialize the connection pool if the option is set
        initialize_size = self.full_details.get("connection_pooling_min_size")
        if initialize_size and len(CONNECTION_POOL) < initialize_size:
            for _ in range(initialize_size - len(CONNECTION_POOL)):
                connection = pymysql.connect(
                    cursorclass=pymysql.cursors.DictCursor,
                    autocommit=autocommit,
                    host=self.host,
                    user=self.user,
                    password=self.password,
                    port=self.port,
                    database=self.database,
                    **self.options
                )
                CONNECTION_POOL.append(connection)

        if (
            self.full_details.get("connection_pooling_enabled")
            and CONNECTION_POOL
            and len(CONNECTION_POOL) > 0
        ):
            connection = CONNECTION_POOL.pop()
        else:
            connection = pymysql.connect(
                cursorclass=pymysql.cursors.DictCursor,
                autocommit=autocommit,
                host=self.host,
                user=self.user,
                password=self.password,
                port=self.port,
                database=self.database,
                **self.options
            )

        connection.close = self.close_connection

        self.open = 1

        return connection

    def reconnect(self):
        self._connection.connect()
        return self

    @classmethod
    def get_default_query_grammar(cls):
        return MySQLGrammar

    @classmethod
    def get_default_platform(cls):
        return MySQLPlatform

    @classmethod
    def get_default_post_processor(cls):
        return MySQLPostProcessor

    def get_database_name(self):
        return self.database

    def commit(self):
        """Transaction"""
        self._connection.commit()
        self.transaction_level -= 1
        if self.get_transaction_level() <= 0:
            self.open = 0
            self._connection.close()

    def dry(self):
        """Transaction"""
        self._dry = True
        return self

    def begin(self):
        """Mysql Transaction"""
        self._connection.begin()
        self.transaction_level += 1
        return self

    def rollback(self):
        """Transaction"""
        self._connection.rollback()
        self.transaction_level -= 1
        if self.get_transaction_level() <= 0:
            self.open = 0
            self._connection.close()

    def get_transaction_level(self):
        """Transaction"""
        return self.transaction_level

    def get_cursor(self):
        return self._cursor

    def query(self, query, bindings=(), results="*"):
        """Make the actual query that
        will reach the database and come back with a result.

        Arguments:
            query {string} -- A string query.
            This could be a qmarked string or a regular query.
            bindings {tuple} -- A tuple of bindings

        Keyword Arguments:
            results {str|1} -- If the results is equal to an
            asterisks it will call 'fetchAll'
            else it will return 'fetchOne' and
            return a single record. (default: {"*"})

        Returns:
            dict|None -- Returns a dictionary of results or None
        """

        if self._dry:
            return {}

        if not self.open:
            if self._connection is None:
                self._connection = self.create_connection()

            self._connection.connect()

        self._cursor = self._connection.cursor()

        try:
            with self._cursor as cursor:
                if isinstance(query, list):
                    for q in query:
                        q = q.replace("'?'", "%s")
                        self.statement(q, ())
                    return

                query = query.replace("'?'", "%s")
                self.statement(query, bindings)
                if results == 1:
                    return self.format_cursor_results(cursor.fetchone())
                else:
                    return self.format_cursor_results(cursor.fetchall())
        except Exception as e:
            raise QueryException(str(e)) from e
        finally:
            self._cursor.close()
            if self.get_transaction_level() <= 0:
                self.open = 0
                self._connection.close()


================================================
FILE: src/masoniteorm/connections/PostgresConnection.py
================================================
from ..exceptions import DriverNotFound
from .BaseConnection import BaseConnection
from ..query.grammars import PostgresGrammar
from ..schema.platforms import PostgresPlatform
from ..query.processors import PostgresPostProcessor
from ..exceptions import QueryException


CONNECTION_POOL = []


class PostgresConnection(BaseConnection):
    """Postgres Connection class."""

    name = "postgres"

    def __init__(
        self,
        host=None,
        database=None,
        user=None,
        port=None,
        password=None,
        prefix=None,
        options=None,
        full_details=None,
        name=None,
    ):
        self.host = host
        if port:
            self.port = int(port)
        else:
            self.port = port
        self.database = database
        self.user = user
        self.password = password

        self.prefix = prefix
        self.full_details = full_details or {}
        self.connection_pool_size = full_details.get("connection_pooling_max_size", 100)
        self.options = options or {}
        self._cursor = None
        self.transaction_level = 0
        self.open = 0
        self.schema = None
        if name:
            self.name = name

    def make_connection(self):
        """This sets the connection on the connection class"""
        try:
            import psycopg2 # noqa F401
        except ModuleNotFoundError:
            raise DriverNotFound(
                "You must have the 'psycopg2' package installed to make a connection to Postgres. Please install it using 'pip install psycopg2-binary'"
            )

        if self.has_global_connection():
            return self.get_global_connection()

        self._connection = self.create_connection()

        self._connection.autocommit = True

        self.enable_disable_foreign_keys()

        self.open = 1

        return self

    def create_connection(self):
        import psycopg2

        # Initialize the connection pool if the option is set
        initialize_size = self.full_details.get("connection_pooling_min_size")
        if (
            self.full_details.get("connection_pooling_enabled")
            and initialize_size
            and len(CONNECTION_POOL) < initialize_size
        ):
            for _ in range(initialize_size - len(CONNECTION_POOL)):
                connection = psycopg2.connect(
                    database=self.database,
                    user=self.user,
                    password=self.password,
                    host=self.host,
                    port=self.port,
                    sslmode=self.options.get("sslmode"),
                    sslcert=self.options.get("sslcert"),
                    sslkey=self.options.get("sslkey"),
                    sslrootcert=self.options.get("sslrootcert"),
                    options=(
                        f"-c search_path={self.schema or self.full_details.get('schema')}"
                        if self.schema or self.full_details.get("schema")
                        else ""
                    ),
                )
                CONNECTION_POOL.append(connection)

        if (
            self.full_details.get("connection_pooling_enabled")
            and CONNECTION_POOL
            and len(CONNECTION_POOL) > 0
        ):
            connection = CONNECTION_POOL.pop()
        else:
            connection = psycopg2.connect(
                database=self.database,
                user=self.user,
                password=self.password,
                host=self.host,
                port=self.port,
                sslmode=self.options.get("sslmode"),
                sslcert=self.options.get("sslcert"),
                sslkey=self.options.get("sslkey"),
                sslrootcert=self.options.get("sslrootcert"),
                options=(
                    f"-c search_path={self.schema or self.full_details.get('schema')}"
                    if self.schema or self.full_details.get("schema")
                    else ""
                ),
            )

        return connection

    def get_database_name(self):
        return self.database

    @classmethod
    def get_default_query_grammar(cls):
        return PostgresGrammar

    @classmethod
    def get_default_platform(cls):
        return PostgresPlatform

    @classmethod
    def get_default_post_processor(cls):
        return PostgresPostProcessor

    def reconnect(self):
        pass

    def close_connection(self):
        if (
            self.full_details.get("connection_pooling_enabled")
            and len(CONNECTION_POOL) < self.connection_pool_size
        ):
            CONNECTION_POOL.append(self._connection)
        else:
            self._connection.close()

        self._connection = None

    def commit(self):
        """Transaction"""
        if self.get_transaction_level() == 1:
            self._connection.commit()
            self._connection.autocommit = True

        self.transaction_level -= 1

    def begin(self):
        """Postgres Transaction"""
        self._connection.autocommit = False
        self.transaction_level += 1
        return self

    def rollback(self):
        """Transaction"""
        if self.get_transaction_level() == 1:
            self._connection.rollback()
            self._connection.autocommit = True

        self.transaction_level -= 1

    def get_transaction_level(self):
        """Transaction"""
        return self.transaction_level

    def set_cursor(self):
        from psycopg2.extras import RealDictCursor

        self._cursor = self._connection.cursor(cursor_factory=RealDictCursor)
        return self._cursor

    def query(self, query, bindings=(), results="*"):
        """Make the actual query that will reach the database and come back with a result.

        Arguments:
            query {string} -- A string query. This could be a qmarked string or a regular query.
            bindings {tuple} -- A tuple of bindings

        Keyword Arguments:
            results {str|1} -- If the results is equal to an asterisks it will call 'fetchAll'
                    else it will return 'fetchOne' and return a single record. (default: {"*"})

        Returns:
            dict|None -- Returns a dictionary of results or None
        """
        try:
            if not self._connection or self._connection.closed:
                self.make_connection()

            self.set_cursor()

            with self._cursor as cursor:
                if isinstance(query, list) and not self._dry:
                    for q in query:
                        self.statement(q, ())
                    return

                query = query.replace("'?'", "%s")
                self.statement(query, bindings)
                if results == 1:
                    return dict(cursor.fetchone() or {})
                else:
                    if "SELECT" in cursor.statusmessage:
                        return cursor.fetchall()
                    return {}
        except Exception as e:
            raise QueryException(str(e)) from e
        finally:
            if self.get_transaction_level() <= 0:
                self.open = 0
                self.close_connection()
                # self._connection.close()


================================================
FILE: src/masoniteorm/connections/SQLiteConnection.py
================================================
from ..query.grammars import SQLiteGrammar
from .BaseConnection import BaseConnection
from ..schema.platforms import SQLitePlatform
from ..query.processors import SQLitePostProcessor
from ..exceptions import DriverNotFound, QueryException
import re


def regexp(expr, item):
    reg = re.compile(expr)
    return reg.search(item) is not None


class SQLiteConnection(BaseConnection):
    """SQLite Connection class."""

    name = "sqlite"

    _connection = None

    def __init__(
        self,
        host=None,
        database=None,
        user=None,
        port=None,
        password=None,
        prefix=None,
        full_details=None,
        options=None,
        name=None,
    ):
        self.host = host
        if port:
            self.port = int(port)
        else:
            self.port = port
        self.database = database
        self.user = user
        self.password = password
        self.prefix = prefix
        self.full_details = full_details or {}
        self.options = options or {}
        self._cursor = None
        self.transaction_level = 0
        self.open = 0
        if name:
            self.name = name

    def make_connection(self):
        """This sets the connection on the connection class"""
        try:
            import sqlite3
        except ModuleNotFoundError:
            raise DriverNotFound(
                "You must have the 'sqlite3' package installed to make a connection to SQLite."
            )

        if self.has_global_connection():
            return self.get_global_connection()

        self._connection = sqlite3.connect(self.database, isolation_level=None)
        self._connection.create_function("REGEXP", 2, regexp)

        self._connection.row_factory = sqlite3.Row

        self.enable_disable_foreign_keys()

        self.open = 1

        return self

    @classmethod
    def get_default_query_grammar(cls):
        return SQLiteGrammar

    @classmethod
    def get_default_platform(cls):
        return SQLitePlatform

    @classmethod
    def get_default_post_processor(cls):
        return SQLitePostProcessor

    def get_database_name(self):
        return self.database

    def reconnect(self):
        pass

    def commit(self):
        """Transaction"""

        if self.get_transaction_level() == 1:
            self.transaction_level -= 1
            self._connection.commit()
            self._connection.isolation_level = None
            self._connection.close()
            self.open = 0

        self.transaction_level -= 1
        return self

    def begin(self):
        """Sqlite Transaction"""
        self._connection.isolation_level = "DEFERRED"
        self.transaction_level += 1
        return self

    def rollback(self):
        """Transaction"""
        if self.get_transaction_level() == 1:
            self.transaction_level -= 1
            self._connection.rollback()
            self._connection.close()
            self.open = 0

        self.transaction_level -= 1
        return self

    def get_cursor(self):
        return self._cursor

    def get_transaction_level(self):
        return self.transaction_level

    def query(self, query, bindings=(), results="*"):
        """Make the actual query that will reach the database and come back with a result.

        Arguments:
            query {string} -- A string query. This could be a qmarked string or a regular query.
            bindings {tuple} -- A tuple of bindings

        Keyword Arguments:
            results {str|1} -- If the results is equal to an asterisks it will call 'fetchAll'
                    else it will return 'fetchOne' and return a single record. (default: {"*"})

        Returns:
            dict|None -- Returns a dictionary of results or None
        """
        if not self.open:
            self.make_connection()

        try:
            self._cursor = self._connection.cursor()

            if isinstance(query, list):
                for query in query:
                    self.statement(query)
            else:
                query = query.replace("'?'", "?")
                self.statement(query, bindings)
                if results == 1:
                    result = [dict(row) for row in self._cursor.fetchall()]
                    if result:
                        return result[0]
                else:
                    return [dict(row) for row in self._cursor.fetchall()]
        except Exception as e:
            raise QueryException(str(e)) from e
        finally:
            if self.get_transaction_level() <= 0:
                self._connection.close()
                self.open = 0

    def format_cursor_results(self, cursor_result):
        return [dict(row) for row in cursor_result]

    def select_many(self, query, bindings, amount):
        self._cursor = self._connection.cursor()
        self.statement(query)
        if not self.open:
            self.make_connection()

        result = self.format_cursor_results(self._cursor.fetchmany(amount))
        while result:
            yield result

            result = self.format_cursor_results(self._cursor.fetchmany(amount))


================================================
FILE: src/masoniteorm/connections/__init__.py
================================================
from .ConnectionResolver import ConnectionResolver
from .ConnectionFactory import ConnectionFactory
from .MySQLConnection import MySQLConnection
from .PostgresConnection import PostgresConnection
from .SQLiteConnection import SQLiteConnection
from .MSSQLConnection import MSSQLConnection


================================================
FILE: src/masoniteorm/exceptions.py
================================================
class DriverNotFound(Exception):
    pass


class ModelNotFound(Exception):
    pass


class HTTP404(Exception):
    pass


class ConnectionNotRegistered(Exception):
    pass


class QueryException(Exception):
    pass


class MigrationNotFound(Exception):
    pass


class ConfigurationNotFound(Exception):
    pass


class InvalidUrlConfiguration(Exception):
    pass


class MultipleRecordsFound(Exception):
    pass


class InvalidArgument(Exception):
    pass


================================================
FILE: src/masoniteorm/expressions/__init__.py
================================================
from .expressions import Raw
from .expressions import JoinClause


================================================
FILE: src/masoniteorm/expressions/expressions.py
================================================
from ..helpers.misc import deprecated


class QueryExpression:
    """A helper class to manage query expressions."""

    def __init__(
        self,
        column,
        equality,
        value,
        value_type="value",
        keyword=None,
        raw=False,
        bindings=(),
    ):
        self.column = column
        self.equality = equality
        self.value = value
        self.value_type = value_type
        self.keyword = keyword
        self.raw = raw
        self.bindings = bindings


class HavingExpression:
    """A helper class to manage having expressions."""

    def __init__(self, column, equality=None, value=None, raw=False):
        self.column = column
        self.raw = raw

        if equality and not value:
            value = equality
            equality = "="

        self.equality = equality
        self.value = value
        self.value_type = "having"


class FromTable:
    """A helper class to manage having expressions."""

    def __init__(self, name, raw=False):
        self.name = name
        self.raw = raw


class UpdateQueryExpression:
    """A helper class to manage update expressions."""

    def __init__(self, column, value=None, update_type="keyvalue"):
        self.column = column
        self.value = value
        self.update_type = update_type


class BetweenExpression:
    """A helper class to manage where between expressions."""

    def __init__(self, column, low, high, equality="BETWEEN"):
        self.column = column
        self.low = low
        self.high = high
        self.equality = equality
        self.value = None
        self.value_type = "BETWEEN"
        self.raw = False


class SubSelectExpression:
    """A helper class to manage subselect expressions."""

    def __init__(self, builder):
        self.builder = builder


class SubGroupExpression:
    """A helper class to manage subgroup expressions."""

    def __init__(self, builder, alias="group"):
        self.builder = builder
        self.alias = alias


class SelectExpression:
    """A helper class to manage select expressions."""

    def __init__(self, column, raw=False):
        self.column = column.strip()
        self.alias = None
        self.raw = raw
        if raw is False and " as " in self.column:
            self.column, self.alias = self.column.split(" as ")
            self.column = self.column.strip()
            self.alias = self.alias.strip()


class OrderByExpression:
    """A helper class to manage select expressions."""

    def __init__(self, column, direction="ASC", raw=False, bindings=()):
        self.column = column.strip()

        self.raw = raw

        self.direction = direction
        self.bindings = bindings

        if raw is False:
            if self.column.endswith(" desc"):
                self.column = self.column.split(" desc")[0].strip()
                self.direction = "DESC"

            if self.column.endswith(" asc"):
                self.column = self.column.split(" asc")[0].strip()
                self.direction = "ASC"


class GroupByExpression:
    """A helper class to manage select expressions."""

    def __init__(self, column=None, raw=False, bindings=()):
        self.column = column.strip()

        self.raw = raw
        self.bindings = bindings


class AggregateExpression:
    def __init__(self, aggregate=None, column=None, alias=False):
        self.aggregate = aggregate
        self.column = column.strip()
        self.alias = alias
        if " as " in self.column:
            self.column, self.alias = self.column.split(" as ")


class Raw:
    def __init__(self, expression):
        self.expression = expression


class JoinClause:
    def __init__(self, table, clause="join"):
        self.table = table
        self.alias = None
        self.clause = clause
        self.on_clauses = []

        if " as " in self.table:
            self.table = table.split(" as ")[0]
            self.alias = table.split(" as ")[1]

    def on(self, column1, equality, column2):
        self.on_clauses.append(OnClause(column1, equality, column2))
        return self

    def or_on(self, column1, equality, column2):
        self.on_clauses.append(OnClause(column1, equality, column2, "or"))
        return self

    def on_value(self, column, *args):
        equality, value = self._extract_operator_value(*args)
        self.on_clauses += ((OnValueClause(column, equality, value, "value")),)
        return self

    def or_on_value(self, column, *args):
        equality, value = self._extract_operator_value(*args)
        self.on_clauses += (
            (OnValueClause(column, equality, value, "value", operator="or")),
        )
        return self

    def on_null(self, column):
        """Specifies an ON expression where the column IS NULL.

        Arguments:
            column {string} -- The name of the column.

        Returns:
            self
        """
        self.on_clauses += ((OnValueClause(column, "=", None, "NULL")),)
        return self

    def on_not_null(self, column: str):
        """Specifies an ON expression where the column IS NOT NULL.

        Arguments:
            column {string} -- The name of the column.

        Returns:
            self
        """
        self.on_clauses += ((OnValueClause(column, "=", True, "NOT NULL")),)
        return self

    def or_on_null(self, column):
        """Specifies an ON expression where the column IS NULL.

        Arguments:
            column {string} -- The name of the column.

        Returns:
            self
        """
        self.on_clauses += ((OnValueClause(column, "=", None, "NULL", operator="or")),)
        return self

    def or_on_not_null(self, column: str):
        """Specifies an ON expression where the column IS NOT NULL.

        Arguments:
            column {string} -- The name of the column.

        Returns:
            self
        """
        self.on_clauses += (
            (OnValueClause(column, "=", True, "NOT NULL", operator="or")),
        )
        return self

    @deprecated("Using where() in a Join clause has been superceded by on_value()")
    def where(self, column, *args):
        return self.on_value(column, *args)

    def _extract_operator_value(self, *args):
        operators = ["=", ">", ">=", "<", "<=", "!=", "<>", "like", "not like"]

        operator = operators[0]

        value = None

        if (len(args)) >= 2:
            operator = args[0]
            value = args[1]
        elif len(args) == 1:
            value = args[0]

        if operator not in operators:
            raise ValueError(
                "Invalid comparison operator. The operator can be %s"
                % ", ".join(operators)
            )

        return operator, value

    def get_on_clauses(self):
        return self.on_clauses


class OnClause:
    def __init__(self, column1, equality, column2, operator="and"):
        self.column1 = column1
        self.column2 = column2
        self.equality = equality
        self.operator = operator


class OnValueClause:
    """A helper class to manage ON expressions in joins with a value."""

    def __init__(
        self,
        column,
        equality,
        value,
        value_type="value",
        keyword=None,
        raw=False,
        bindings=(),
        operator="and",
    ):
        self.column = column
        self.equality = equality
        self.value = value
        self.value_type = value_type
        self.keyword = keyword
        self.raw = raw
        self.bindings = bindings
        self.operator = operator


================================================
FILE: src/masoniteorm/factories/Factory.py
================================================
from faker import Faker
import random


class Factory:
    _factories = {}
    _after_creates = {}
    _faker = None

    @property
    def faker(self):
        if not Factory._faker:
            Factory._faker = Faker()
            random.seed()
            Factory._faker.seed_instance(random.randint(1, 10000))

        return Factory._faker

    def __init__(self, model, number=1):
        self.model = model
        self.number = number

    def make(self, dictionary=None, name="default"):
        if dictionary is None:
            dictionary = {}

        if self.number == 1 and not isinstance(dictionary, list):
            called = self._factories[self.model][name](self.faker)
            called.update(dictionary)
            model = self.model.hydrate(called)
            self.run_after_creates(model)
            return model
        elif isinstance(dictionary, list):
            results = []
            for index in range(0, len(dictionary)):
                called = self._factories[self.model][name](self.faker)
                called.update(dictionary)
                results.append(called)
            models = self.model.hydrate(results)
            for model in models:
                self.run_after_creates(model)
            return models

        else:
            results = []
            for index in range(0, self.number):
                called = self._factories[self.model][name](self.faker)
                called.update(dictionary)
                results.append(called)
            models = self.model.hydrate(results)
            for model in models:
                self.run_after_creates(model)
            return models

    def create(self, dictionary=None, name="default"):
        if dictionary is None:
            dictionary = {}

        if self.number == 1 and not isinstance(dictionary, list):
            called = self._factories[self.model][name](self.faker)
            called.update(dictionary)
            model = self.model.create(called)
            self.run_after_creates(model)
            return model
        elif isinstance(dictionary, list):
            results = []
            for index in range(0, len(dictionary)):
                called = self._factories[self.model][name](self.faker)
                called.update(dictionary)
                results.append(called)

            models = self.model.create(results)
            for model in models:
                self.run_after_creates(model)
            return models
        else:
            full_collection = []
            for index in range(0, self.number):
                called = self._factories[self.model][name](self.faker)
                called.update(dictionary)
                full_collection.append(called)
                model = self.model.create(called)
                self.run_after_creates(model)

            return self.model.hydrate(full_collection)

    @classmethod
    def register(cls, model, call, name="default"):
        if model not in cls._factories:
            cls._factories[model] = {name: call}
        else:
            cls._factories[model][name] = call

    @classmethod
    def after_creating(cls, model, call, name="default"):
        if model not in cls._after_creates:
            cls._after_creates[model] = {name: call}
        else:
            cls._after_creates[model][name] = call

    def run_after_creates(self, model):
        if self.model not in self._after_creates:
            return model

        for name, callback in self._after_creates[self.model].items():
            callback(model, self.faker)


================================================
FILE: src/masoniteorm/factories/__init__.py
================================================
from .Factory import Factory


================================================
FILE: src/masoniteorm/helpers/__init__.py
================================================


================================================
FILE: src/masoniteorm/helpers/misc.py
================================================
"""Module for miscellaneous helper methods."""

import warnings


def deprecated(message):
    warnings.simplefilter("default", DeprecationWarning)

    def deprecated_decorator(func):
        def deprecated_func(*args, **kwargs):
            warnings.warn(
                "{} is a deprecated function. {}".format(func.__name__, message),
                category=DeprecationWarning,
                stacklevel=2,
            )
            return func(*args, **kwargs)

        return deprecated_func

    return deprecated_decorator


================================================
FILE: src/masoniteorm/migrations/Migration.py
================================================
import os
from os import listdir
from os.path import isfile, join
from pydoc import locate

from inflection import camelize

from ..models.MigrationModel import MigrationModel
from ..schema import Schema
from ..config import load_config

from timeit import default_timer as timer


class Migration:
    def __init__(
        self,
        connection="default",
        dry=False,
        command_class=None,
        migration_directory="databases/migrations",
        config_path=None,
        schema=None,
    ):
        self.connection = connection
        self.migration_directory = migration_directory
        self.last_migrations_ran = []
        self.command_class = command_class

        self.schema_name = schema

        DB = load_config(config_path).DB

        DATABASES = DB.get_connection_details()

        self.schema = Schema(
            connection=connection,
            connection_details=DATABASES,
            dry=dry,
            schema=self.schema_name,
        )

        self.migration_model = MigrationModel.on(self.connection)
        if self.schema_name:
            self.migration_model.set_schema(self.schema_name)

    def create_table_if_not_exists(self):
        if not self.schema.has_table("migrations"):
            with self.schema.create("migrations") as table:
                table.increments("migration_id")
                table.string("migration")
                table.integer("batch")

            return True

        return False

    def get_unran_migrations(self):
        directory_path = os.path.join(os.getcwd(), self.migration_directory)
        all_migrations = [
            f.replace(".py", "")
            for f in listdir(directory_path)
            if isfile(join(directory_path, f))
            and f != "__init__.py"
            and not f.startswith(".")
        ]
        all_migrations.sort()
        unran_migrations = []
        database_migrations = self.migration_model.all()
        for migration in all_migrations:
            if migration not in database_migrations.pluck("migration"):
                unran_migrations.append(migration)
        return unran_migrations

    def get_rollback_migrations(self):
        return (
            self.migration_model.where("batch", self.migration_model.all().max("batch"))
            .order_by("migration_id", "desc")
            .get()
            .pluck("migration")
        )

    def get_all_migrations(self, reverse=False):
        if reverse:
            return (
                self.migration_model.order_by("migration_id", "desc")
                .get()
                .pluck("migration")
            )

        return self.migration_model.all().pluck("migration")

    def get_last_batch_number(self):
        return self.migration_model.select("batch").get().max("batch")

    def delete_migration(self, file_path):
        return self.migration_model.where("migration", file_path).delete()

    def locate(self, file_name):
        migration_name = camelize("_".join(file_name.split("_")[4:]).replace(".py", ""))
        file_name = file_name.replace(".py", "")
        migration_directory = self.migration_directory.replace("/", ".").replace(
            "\\", "."
        )
        return locate(f"{migration_directory}.{file_name}.{migration_name}")

    def get_ran_migrations(self):
        directory_path = os.path.join(os.getcwd(), self.migration_directory)
        all_migrations = [
            f.replace(".py", "")
            for f in listdir(directory_path)
            if isfile(join(directory_path, f))
            and f != "__init__.py"
            and not f.startswith(".")
        ]
        all_migrations.sort()
        ran = []

        database_migrations = self.migration_model.all()
        for migration in all_migrations:
            matched_migration = database_migrations.where(
                "migration", migration
            ).first()
            if matched_migration:
                ran.append(
                    {
                        "migration_file": matched_migration.migration,
                        "batch": matched_migration.batch,
                    }
                )
        return ran

    def migrate(self, migration="all", output=False):
        default_migrations = self.get_unran_migrations()
        migrations = default_migrations if migration == "all" else [migration]

        batch = self.get_last_batch_number() + 1

        for migration in migrations:
            try:
                migration_class = self.locate(migration)

            except TypeError:
                self.command_class.line(f"<error>Not Found: {migration}</error>")
                continue

            self.last_migrations_ran.append(migration)
            if self.command_class:
                self.command_class.line(
                    f"<comment>Migrating:</comment> <question>{migration}</question>"
                )

            migration_class = migration_class(
                connection=self.connection, schema=self.schema_name
            )

            if output:
                migration_class.schema.dry()
            start = timer()
            migration_class.up()
            duration = "{:.2f}".format(timer() - start)

            if output:
                if self.command_class:
                    table = self.command_class.table()
                    table.set_header_row(["SQL"])
                    sql = migration_class.schema._blueprint.to_sql()
                    if isinstance(sql, list):
                        sql = ",".join(sql)
                    table.set_rows([[sql]])
                    table.render(self.command_class.io)
                    continue
                else:
                    print(migration_class.schema._blueprint.to_sql())

            if self.command_class:
                self.command_class.line(
                    f"<info>Migrated:</info> <question>{migration}</question> ({duration}s)"
                )

            self.migration_model.create(
                {"batch": batch, "migration": migration.replace(".py", "")}
            )

    def rollback(self, migration="all", output=False):
        default_migrations = self.get_rollback_migrations()
        migrations = default_migrations if migration == "all" else [migration]

        for migration in migrations:
            if migration.endswith(".py"):
                migration = migration.replace(".py", "")

            if self.command_class:
                self.command_class.line(
                    f"<comment>Rolling back:</comment> <question>{migration}</question>"
                )

            try:
                migration_class = self.locate(migration)
            except TypeError:
                self.command_class.line(f"<error>Not Found: {migration}</error>")
                continue

            migration_class = migration_class(
                connection=self.connection, schema=self.schema_name
            )

            if output:
                migration_class.schema.dry()

            start = timer()
            migration_class.down()
            duration = "{:.2f}".format(timer() - start)

            if output:
                if self.command_class:
                    table = self.command_class.table()
                    table.set_header_row(["SQL"])
                    if (
                        hasattr(migration_class.schema, "_blueprint")
                        and migration_class.schema._blueprint
                    ):
                        sql = migration_class.schema._blueprint.to_sql()
                        if isinstance(sql, list):
                            sql = ",".join(sql)

                        table.set_rows([[sql]])
                    elif migration_class.schema._sql:
                        table.set_rows([[migration_class.schema._sql]])
                    table.render(self.command_class.io)
                    continue
                else:
                    print(migration_class.schema._blueprint.to_sql())

            self.delete_migration(migration)

            if self.command_class:
                self.command_class.line(
                    f"<info>Rolled back:</info> <question>{migration}</question> ({duration}s)"
                )

    def delete_migrations(self, migrations=None):
        return self.migration_model.where_in("migration", migrations or []).delete()

    def delete_last_batch(self):
        return self.migration_model.where(
            "batch", self.get_last_batch_number()
        ).delete()

    def reset(self, migration="all"):
        default_migrations = self.get_all_migrations(reverse=True)
        migrations = default_migrations if migration == "all" else [migration]

        if not len(migrations):
            if self.command_class:
                self.command_class.line("<info>Nothing to reset</info>")
            else:
                print("Nothing to reset")

        for migration in migrations:
            if self.command_class:
                self.command_class.line(
                    f"<comment>Rolling back:</comment> <question>{migration}</question>"
                )

            try:
                self.locate(migration)(
                    connection=self.connection, schema=self.schema_name
                ).down()
            except TypeError:
                self.command_class.line(f"<error>Not Found: {migration}</error>")
                continue

                # raise MigrationNotFound(f"Could not find {migration}")

            self.delete_migration(migration)

            if self.command_class:
                self.command_class.line(
                    f"<info>Rolled back:</info> <question>{migration}</question>"
                )

            self.delete_migrations([migration])

        if self.command_class:
            self.command_class.line("")

    def refresh(self, migration="all"):
        self.reset(migration)
        self.migrate(migration)

    def drop_all_tables(self, ignore_fk=False):
        if self.command_class:
            self.command_class.line("<comment>Dropping all tables</comment>")

        if ignore_fk:
            self.schema.disable_foreign_key_constraints()

        for table in self.schema.get_all_tables():
            self.schema.drop(table)

        if ignore_fk:
            self.schema.enable_foreign_key_constraints()

        if self.command_class:
            self.command_class.line("<info>All tables dropped</info>")

    def fresh(self, ignore_fk=False, migration="all"):
        self.drop_all_tables(ignore_fk=ignore_fk)
        self.create_table_if_not_exists()

        if not self.get_unran_migrations():
            if self.command_class:
                self.command_class.line("<comment>Nothing to migrate</comment>")
            return

        self.migrate(migration)


================================================
FILE: src/masoniteorm/migrations/__init__.py
================================================
from .Migration import Migration


================================================
FILE: src/masoniteorm/models/MigrationModel.py
================================================
from .Model import Model


class MigrationModel(Model):
    __table__ = "migrations"
    __fillable__ = ["migration", "batch"]
    __timestamps__ = None

    __primary_key__ = "migration_id"


================================================
FILE: src/masoniteorm/models/Model.py
================================================
import inspect
import json
import logging
from datetime import date as datetimedate
from datetime import datetime
from datetime import time as datetimetime
from decimal import Decimal
from typing import Any, Dict

import pendulum
from inflection import tableize, underscore

from ..collection import Collection
from ..config import load_config
from ..exceptions import ModelNotFound
from ..observers import ObservesEvents
from ..query import QueryBuilder
from ..scopes import TimeStampsMixin

"""This is a magic class that will help using models like User.first() instead of having to instatiate a class like
User().first()
"""


class ModelMeta(type):
    def __getattr__(self, attribute, *args, **kwargs):
        """This method is called between a Model and accessing a property. This is a quick and easy
        way to instantiate a class before the first method is called. This is to avoid needing
        to do this:

        User().where(..)

        and instead, with this class inherited as a meta class, we can do this:

        User.where(...)

        This class (potentially magically) instantiates the class even though we really didn't instantiate it.

        Args:
            attribute (string): The name of the attribute

        Returns:
            Model|mixed: An instantiated model's attribute
        """
        instantiated = self()
        return getattr(instantiated, attribute)


class BoolCast:
    """Casts a value to a boolean"""

    def get(self, value):
        return bool(value)

    def set(self, value):
        return bool(value)


class JsonCast:
    """Casts a value to JSON"""

    def get(self, value):
        if isinstance(value, str):
            try:
                return json.loads(value)
            except ValueError:
                return None

        return value

    def set(self, value):
        if isinstance(value, str):
            # make sure the string is valid JSON
            json.loads(value)
            return value

        return json.dumps(value, default=str)


class IntCast:
    """Casts a value to a int"""

    def get(self, value):
        return int(value)

    def set(self, value):
        return int(value)


class FloatCast:
    """Casts a value to a float"""

    def get(self, value):
        return float(value)

    def set(self, value):
        return float(value)


class DateCast:
    """Casts a value to a float"""

    def get(self, value):
        return pendulum.parse(value).to_date_string()

    def set(self, value):
        return pendulum.parse(value).to_date_string()


class DecimalCast:
    """Casts a value to Decimal for accuracy"""

    def get(self, value):
        """
        Get the value
        """
        if isinstance(value, Decimal):
            return str(value)

        return Decimal(str(value))

    def set(self, value):
        """
        Set the value
        """
        return Decimal(str(value))


class Model(TimeStampsMixin, ObservesEvents, metaclass=ModelMeta):
    """The ORM Model class

    Base Classes:
        TimeStampsMixin (TimeStampsMixin): Adds scopes to add timestamps when something is inserted
        metaclass (ModelMeta, optional): Helps instantiate a class when it hasn't been instantiated. Defaults to ModelMeta.
    """

    __fillable__ = ["*"]
    __guarded__ = []
    __dry__ = False
    __table__ = None
    __connection__ = "default"
    __resolved_connection__ = None
    __selects__ = []

    __observers__ = {}
    __has_events__ = True

    _booted = False
    _scopes = {}
    __primary_key__ = "id"
    __primary_key_type__ = "int"
    __casts__ = {}
    __dates__ = []
    __hidden__ = []
    __relationship_hidden__ = {}
    __visible__ = []
    __timestamps__ = True
    __timezone__ = "UTC"
    __with__ = ()
    __force_update__ = False

    date_created_at = "created_at"
    date_updated_at = "updated_at"

    builder: QueryBuilder

    """Pass through will pass any method calls to the model directly through to the query builder.
    Anytime one of these methods are called on the model it will actually be called on the query builder class.
    """
    __passthrough__ = set(
        (
            "add_select",
            "aggregate",
            "all",
            "avg",
            "between",
            "bulk_create",
            "chunk",
            "count",
            "decrement",
            "delete",
            "distinct",
            "doesnt_exist",
            "doesnt_have",
            "exists",
            "find_or",
            "find_or_404",
            "find_or_fail",
            "first_or_fail",
            "first",
            "first_where",
            "first_or_create",
            "force_update",
            "from_",
            "from_raw",
            "get",
            "get_table_schema",
            "group_by_raw",
            "group_by",
            "has",
            "having",
            "having_raw",
            "increment",
            "in_random_order",
            "join_on",
            "join",
            "joins",
            "last",
            "left_join",
            "limit",
            "lock_for_update",
            "make_lock",
            "max",
            "min",
            "new_from_builder",
            "new",
            "not_between",
            "offset",
            "on",
            "or_where",
            "or_where_null",
            "order_by_raw",
            "order_by",
            "paginate",
            "right_join",
            "select_raw",
            "select",
            "set_global_scope",
            "set_schema",
            "shared_lock",
            "simple_paginate",
            "skip",
            "statement",
            "sum",
            "table_raw",
            "take",
            "to_qmark",
            "to_sql",
            "truncate",
            "update",
            "when",
            "where_between",
            "where_column",
            "where_date",
            "or_where_doesnt_have",
            "or_has",
            "or_where_has",
            "or_doesnt_have",
            "or_where_not_exists",
            "or_where_date",
            "where_exists",
            "where_from_builder",
            "where_has",
            "where_in",
            "where_like",
            "where_not_between",
            "where_not_in",
            "where_not_like",
            "where_not_null",
            "where_null",
            "where_raw",
            "without_global_scopes",
            "where",
            "where_doesnt_have",
            "with_",
            "with_count",
            "latest",
            "oldest",
            "value",
        )
    )

    __cast_map__ = {}

    __internal_cast_map__ = {
        "bool": BoolCast,
        "json": JsonCast,
        "int": IntCast,
        "float": FloatCast,
        "date": DateCast,
        "decimal": DecimalCast,
    }

    def __init__(self):
        self.__attributes__ = {}
        self.__original_attributes__ = {}
        self.__dirty_attributes__ = {}
        if not hasattr(self, "__appends__"):
            self.__appends__ = []
        self._relationships = {}
        self._global_scopes = {}

        self.boot()

    @classmethod
    def get_primary_key(self):
        """Gets the primary key column

        Returns:
            mixed
        """
        return self.__primary_key__

    def get_primary_key_type(self):
        """Gets the primary key column type

        Returns:
            mixed
        """
        return self.__primary_key_type__

    def get_primary_key_value(self):
        """Gets the primary key value.

        Raises:
            AttributeError: Raises attribute error if the model does not have an
                attribute with the primary key.

        Returns:
            str|int
        """
        try:
            return getattr(self, self.get_primary_key())
        except AttributeError:
            name = self.__class__.__name__
            raise AttributeError(
                f"class '{name}' has no attribute {self.get_primary_key()}. Did you set the primary key correctly on the model using the __primary_key__ attribute?"
            )

    def get_foreign_key(self):
        """Gets the foreign key based on this model name.

        Args:
            relationship (str): The relationship name.

        Returns:
            str
        """
        return underscore(self.__class__.__name__ + "_" + self.get_primary_key())

    def query(self):
        return self.get_builder()

    def get_builder(self):
        if hasattr(self, "builder"):
            return self.builder

        self.builder = QueryBuilder(
            connection=self.__connection__,
            table=self.get_table_name(),
            connection_details=self.get_connection_details(),
            model=self,
            scopes=self._scopes.get(self.__class__),
            dry=self.__dry__,
        )

        return self.builder

    def get_selects(self):
        return self.__selects__

    @classmethod
    def get_columns(cls):
        return list(cls.first().__attributes__.keys())

    def get_connection_details(self):
        DB = load_config().DB
        return DB.get_connection_details()

    def boot(self):
        if not self._booted:
            self.observe_events(self, "booting")
            for base_class in inspect.getmro(self.__class__):
                class_name = base_class.__name__

                if class_name.endswith("Mixin"):
                    getattr(self, "boot_" + class_name)(self.get_builder())
                elif (
                    base_class != Model
                    and issubclass(base_class, Model)
                    and "__fillable__" in base_class.__dict__
                    and "__guarded__" in base_class.__dict__
                ):
                    raise AttributeError(
                        f"{type(self).__name__} must specify either __fillable__ or __guarded__ properties, but not both."
                    )

            self._booted = True
            self.observe_events(self, "booted")

            self.append_passthrough(list(self.get_builder()._macros.keys()))

    def append_passthrough(self, passthrough):
        self.__passthrough__.update(passthrough)
        return self

    @classmethod
    def get_table_name(cls):
        """Gets the table name.

        Returns:
            str
        """
        return cls.__table__ or tableize(cls.__name__)

    @classmethod
    def table(cls, table):
        """Gets the table name.

        Returns:
            str
        """
        cls.__table__ = table
        return cls

    @classmethod
    def find(cls, record_id, query=False):
        """Finds a row by the primary key ID.

        Arguments:
            record_id {int} -- The ID of the primary key to fetch.

        Returns:
            Model
        """
        if isinstance(record_id, (list, tuple)):
            builder = cls().where_in(cls.get_primary_key(), record_id)
        else:
            builder = cls().where(cls.get_primary_key(), record_id)

        if query:
            return builder
        else:
            if isinstance(record_id, (list, tuple)):
                return builder.get()

        return builder.first()

    @classmethod
    def find_or_fail(cls, record_id, query=False):
        """Finds a row by the primary key ID or raise a ModelNotFound exception.

        Arguments:
            record_id {int} -- The ID of the primary key to fetch.

        Returns:
            Model
        """
        result = cls.find(record_id, query)

        if not result:
            raise ModelNotFound()

        return result

    def is_loaded(self):
        return bool(self.__attributes__)

    def is_created(self):
        return self.get_primary_key() in self.__attributes__

    def add_relation(self, relations):
        self._relationships.update(relations)
        return self

    @classmethod
    def hydrate(cls, result, relations=None):
        """Takes a result and loads it into a model

        Args:
            result ([type]): [description]
            relations (dict, optional): [description]. Defaults to {}.

        Returns:
            [type]: [description]
        """

        relations = relations or {}

        if result is None:
            return None

        if isinstance(result, (list, tuple)):
            response = []
            for element in result:
                response.append(cls.hydrate(element))
            return cls.new_collection(response)

        elif isinstance(result, dict):
            model = cls()
            dic = {}
            for key, value in result.items():
                if key in model.get_dates() and value:
                    value = model.get_new_date(value)
                dic.update({key: value})

            logger = logging.getLogger("masoniteorm.models.hydrate")
            logger.setLevel(logging.INFO)
            logger.propagate = False
            logger.info(
                f"Hydrating Model {cls.__name__}",
                extra={"class_name": cls.__name__, "class_module": cls.__module__},
            )

            model.observe_events(model, "hydrating")
            model.__attributes__.update(dic or {})
            model.__original_attributes__.update(dic or {})
            model.add_relation(relations)
            model.observe_events(model, "hydrated")
            return model

        elif hasattr(result, "serialize"):
            model = cls()
            model.__attributes__.update(result.serialize())
            model.__original_attributes__.update(result.serialize())
            return model
        else:
            model = cls()
            model.observe_events(model, "hydrating")
            model.__attributes__.update(dict(result))
            model.__original_attributes__.update(dict(result))
            model.observe_events(model, "hydrated")
            return model

    def fill(self, attributes):
        self.__attributes__.update(attributes)
        return self

    def fill_original(self, attributes):
        self.__original_attributes__.update(attributes)
        return self

    @classmethod
    def new_collection(cls, data):
        """Takes a result and puts it into a new collection.
        This is designed to be able to be overidden by the user.

        Args:
            data (list|dict): Could be any data type but will be loaded directly into a collection.

        Returns:
            Collection
        """
        return Collection(data)

    @classmethod
    def create(
        cls,
        dictionary: Dict[str, Any] = None,
        query: bool = False,
        cast: bool = False,
        **kwargs,
    ):
        """Creates new records based off of a dictionary as well as data set on the model
        such as fillable values.

        Args:
            dictionary (dict, optional): [description]. Defaults to {}.
            query (bool, optional): [description]. Defaults to False.
            cast (bool, optional): [description]. Whether or not to cast passed values.

        Returns:
            self: A hydrated version of a model
        """
        if query:
            return cls.builder.create(dictionary, query=True, cast=cast, **kwargs)

        return cls.builder.create(dictionary, cast=cast, **kwargs)

    @classmethod
    def cast_value(cls, attribute: str, value: Any):
        """
        Given an attribute name and a value, casts the value using the model's registered caster.
        If no registered caster exists, returns the unmodified value.
        """
        cast_method = cls.__casts__.get(attribute)
        cast_map = cls.get_cast_map(cls)

        if value is None:
            return None

        if isinstance(cast_method, str):
            return cast_map[cast_method]().set(value)

        if cast_method:
            return cast_method(value)
        return value

    @classmethod
    def cast_values(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Runs provided dictionary through all model casters and returns the result.

        Does not mutate the passed dictionary.
        """
        return {x: cls.cast_value(x, dictionary[x]) for x in dictionary}

    def fresh(self):
        return (
            self.get_builder()
            .where(self.get_primary_key(), self.get_primary_key_value())
            .first()
        )

    def serialize(self, exclude=None, include=None):
        """Takes the data as a model and converts it into a dictionary.

        Returns:
            dict
        """
        serialized_dictionary = self.__attributes__.copy()

        # prevent using both exclude and include at the same time
        if exclude is not None and include is not None:
            raise AttributeError("Can not define both includes and exclude values.")

        if exclude is not None:
            self.__hidden__ = exclude

        if include is not None:
            self.__visible__ = include

        # prevent using both hidden and visible at the same time
        if self.__visible__ and self.__hidden__:
            raise AttributeError(
                f"class model '{self.__class__.__name__}' defines both __visible__ and __hidden__."
            )

        if self.__visible__:
            new_serialized_dictionary = {
                k: serialized_dictionary[k]
                for k in self.__visible__
                if k in serialized_dictionary
            }
            serialized_dictionary = new_serialized_dictionary
        else:
            for key in self.__hidden__:
                if key in serialized_dictionary:
                    serialized_dictionary.pop(key)

        for date_column in self.get_dates():
            if (
                date_column in serialized_dictionary
                and serialized_dictionary[date_column]
            ):
                serialized_dictionary[date_column] = self.get_new_serialized_date(
                    serialized_dictionary[date_column]
                )

        serialized_dictionary.update(self.__dirty_attributes__)

        # The builder is inside the attributes but should not be serialized
        if "builder" in serialized_dictionary:
            serialized_dictionary.pop("builder")

        # Serialize relationships as well
        serialized_dictionary.update(self.relations_to_dict())

        for append in self.__appends__:
            serialized_dictionary.update({append: getattr(self, append)})

        remove_keys = []
        for key, value in serialized_dictionary.items():
            if key in self.__hidden__:
                remove_keys.append(key)
            if hasattr(value, "serialize"):
                value = value.serialize(self.__relationship_hidden__.get(key, []))
            if isinstance(value, datetime):
                value = self.get_new_serialized_date(value)
            if key in self.__casts__:
                value = self._cast_attribute(key, value)

            serialized_dictionary.update({key: value})

        for key in remove_keys:
            serialized_dictionary.pop(key)

        return serialized_dictionary

    def to_json(self):
        """Converts a model to JSON

        Returns:
            string
        """
        return json.dumps(self.serialize(), default=str)

    @classmethod
    def first_or_create(cls, wheres, creates: dict = None):
        """Get the first record matching the attributes or create it.

        Returns:
            Model
        """
        if creates is None:
            creates = {}
        self = cls()
        record = self.where(wheres).first()
        total = {}
        total.update(creates)
        total.update(wheres)
        if not record:
            return self.create(total, id_key=cls.get_primary_key())
        return record

    @classmethod
    def update_or_create(cls, wheres, updates):
        self = cls()
        record = self.where(wheres).first()
        total = {}
        total.update(updates)
        total.update(wheres)
        if not record:
            return self.create(total, id_key=cls.get_primary_key()).fresh()

        return self.where(wheres).update(total)

    def relations_to_dict(self):
        """Converts a models relationships to a dictionary

        Returns:
            [type]: [description]
        """
        new_dic = {}
        for key, value in self._relationships.items():
            if value == {}:
                new_dic.update({key: {}})
            else:
                if value is None:
                    new_dic.update({key: {}})
                    continue
                elif isinstance(value, list):
                    value = Collection(value).serialize()
                elif isinstance(value, dict):
                    pass
                else:
                    value = value.serialize()

                new_dic.update({key: value})

        return new_dic

    def touch(self, date=None, query=True):
        """Updates the current timestamps on the model"""

        if not self.__timestamps__:
            return False

        self._update_timestamps(date=date)

        return self.save(query=query)

    def _update_timestamps(self, date=None):
        """Sets the updated at date to the current time or a specified date

        Args:
            date (datetime.datetime, optional): a date. If none is specified then it will use the current date Defaults to None.
        """
        self.updated_at = date or self._current_timestamp()

    def _current_timestamp(self):
        return datetime.now()

    def __getattr__(self, attribute):
        """Magic method that is called when an attribute does not exist on the model.

        Args:
            attribute (string): the name of the attribute being accessed or called.

        Returns:
            mixed: Could be anything that a method can return.
        """

        new_name_accessor = "get_" + attribute + "_attribute"

        if (new_name_accessor) in self.__class__.__dict__:
            return self.__class__.__dict__.get(new_name_accessor)(self)

        if (
            "__dirty_attributes__" in self.__dict__
            and attribute in self.__dict__["__dirty_attributes__"]
        ):
            return self.get_dirty_value(attribute)

        if (
            "__attributes__" in self.__dict__
            and attribute in self.__dict__["__attributes__"]
        ):
            if attribute in self.get_dates():
                return (
                    self.get_new_date(self.get_value(attribute))
                    if self.get_value(attribute)
                    else None
                )
            return self.get_value(attribute)

        if attribute in self.__passthrough__:

            def method(*args, **kwargs):
                return getattr(self.get_builder(), attribute)(*args, **kwargs)

            return method

        if attribute in self.__dict__.get("_relationships", {}):
            return self.__dict__["_relationships"][attribute]

        if attribute not in self.__dict__:
            name = self.__class__.__name__

            raise AttributeError(f"class model '{name}' has no attribute {attribute}")

        return None

    def only(self, attributes: list) -> dict:
        if isinstance(attributes, str):
            attributes = [attributes]
        results: dict[str, Any] = {}
        for attribute in attributes:
            if " as " in attribute:
                attribute, alias = attribute.split(" as ")
                alias = alias.strip()
                attribute = attribute.strip()
            else:
                alias = attribute.strip()
                attribute = attribute.strip()

            results[alias] = self.get_raw_attribute(attribute)

        return results

    def __setattr__(self, attribute, value):
        if hasattr(self, "set_" + attribute + "_attribute"):
            method = getattr(self, "set_" + attribute + "_attribute")
            value = method(value)

        if attribute in self.__casts__:
            value = self._set_cast_attribute(attribute, value)

        if attribute in self.get_dates():
            value = self.get_new_datetime_string(value)

        try:
            if not attribute.startswith("_"):
                self.__dict__["__dirty_attributes__"].update({attribute: value})
            else:
                self.__dict__[attribute] = value
        except KeyError:
            pass

    def get_raw_attribute(self, attribute):
        """Gets an attribute without having to call the models magic methods. Gets around infinite recursion loops.

        Args:
            attribute (string): The attribute to fetch

        Returns:
            mixed: Any value an attribute can be.
        """
        return self.__attributes__.get(attribute)

    def is_dirty(self):
        return bool(self.__dirty_attributes__)

    def get_original(self, key):
        return self.__original_attributes__.get(key)

    def get_dirty(self, key):
        return self.__dirty_attributes__.get(key)

    def get_dirty_keys(self):
        return list(self.get_dirty_attributes().keys())

    def save(self, query=False):
        builder = self.get_builder()

        if "builder" in self.__dirty_attributes__:
            self.__dirty_attributes__.pop("builder")

        self.observe_events(self, "saving")

        if not query:
            if self.is_loaded():
                result = builder.update(
                    self.__dirty_attributes__, ignore_mass_assignment=True
                )
            else:
                result = self.create(
                    self.__dirty_attributes__,
                    query=query,
                    id_key=self.get_primary_key(),
                    ignore_mass_assignment=True,
                )
            self.observe_events(self, "saved")
            self.fill(result.__attributes__)
            self.__dirty_attributes__ = {}
            return result

        if self.is_loaded():
            result = builder.update(
                self.__dirty_attributes__, dry=query, ignore_mass_assignment=True
            )
        else:
            result = self.create(self.__dirty_attributes__, query=query)

        return result

    def get_value(self, attribute):
        value = self.__attributes__[attribute]
        if attribute in self.__casts__:
            return self._cast_attribute(attribute, value)

        return value

    def get_dirty_value(self, attribute):
        value = self.__dirty_attributes__[attribute]
        if attribute in self.__casts__:
            return self._cast_attribute(attribute, value)

        return value

    def all_attributes(self):
        attributes = self.__attributes__
        attributes.update(self.get_dirty_attributes())
        for key, value in attributes.items():
            if key in self.__casts__:
                attributes.update({key: self._cast_attribute(key, value)})

        return attributes

    def delete_attribute(self, key):
        if key in self.__attributes__:
            del self.__attributes__[key]
            return True

        return False

    def get_dirty_attributes(self):
        if "builder" in self.__dirty_attributes__:
            self.__dirty_attributes__.pop("builder")
        return self.__dirty_attributes__ or {}

    def get_cast_map(self):
        cast_map = self.__internal_cast_map__
        cast_map.update(self.__cast_map__)
        return cast_map

    def _cast_attribute(self, attribute, value):
        cast_method = self.__casts__[attribute]
        cast_map = self.get_cast_map()

        if value is None:
            return None

        if isinstance(cast_method, str):
            return cast_map[cast_method]().get(value)

        return cast_method(value)

    def _set_cast_attribute(self, attribute, value):
        cast_method = self.__casts__[attribute]
        cast_map = self.get_cast_map()

        if isinstance(cast_method, str):
            return cast_map[cast_method]().set(value)

        return cast_method(value)

    @classmethod
    def load(cls, *loads):
        cls.boot()
        cls._loads += loads
        return cls.builder

    def __getitem__(self, attribute):
        return getattr(self, attribute)

    def get_dates(self):
        """
        Get the attributes that should be converted to dates.

        :rtype: list
        """
        defaults = [self.date_created_at, self.date_updated_at]

        return self.__dates__ + defaults

    def get_new_date(self, _datetime=None):
        """
        Get the attributes that should be converted to dates.

        :rtype: list
        """
        import pendulum

        if not _datetime:
            return pendulum.now(tz=self.__timezone__)
        elif isinstance(_datetime, str):
            return pendulum.parse(_datetime, tz=self.__timezone__)
        elif isinstance(_datetime, datetime):
            return pendulum.instance(_datetime, tz=self.__timezone__)
        elif isinstance(_datetime, datetimedate):
            return pendulum.datetime(
                _datetime.year, _datetime.month, _datetime.day, tz=self.__timezone__
            )
        elif isinstance(_datetime, datetimetime):
            return pendulum.parse(
                f"{_datetime.hour}:{_datetime.minute}:{_datetime.second}",
                tz=self.__timezone__,
            )

        return pendulum.instance(_datetime, tz=self.__timezone__)

    def get_new_datetime_string(self, _datetime=None):
        """
        Given an optional datetime value, constructs and returns a new datetime string.
        If no datetime is specified, returns the current time.

        :rtype: list
        """
        return self.get_new_date(_datetime).to_datetime_string()

    def get_new_serialized_date(self, _datetime):
        """
        Get the attributes that should be converted to dates.

        :rtype: list
        """
        return self.get_new_date(_datetime).isoformat()

    def set_appends(self, appends):
        """
        Get the attributes that should be converted to dates.

        :rtype: list
        """
        self.__appends__ += appends
        return self

    def save_many(self, relation, relating_records):
        if isinstance(relating_records, Model):
            raise ValueError(
                "Saving many records requires an iterable like a collection or a list of models and not a Model object. To attach a model, use the 'attach' method."
            )

        for related_record in relating_records:
            self.attach(relation, related_record)

    def detach_many(self, relation, relating_records):
        if isinstance(relating_records, Model):
            raise ValueError(
                "Detaching many records requires an iterable like a collection or a list of models and not a Model object. To detach a model, use the 'detach' method."
            )

        related = getattr(self.__class__, relation)
        for related_record in relating_records:
            if not related_record.is_created():
                related_record.create(related_record.all_attributes())
            else:
                related_record.save()

            related.detach(self, related_record)

    def related(self, relation):
        related = getattr(self.__class__, relation)
        return related.relate(self)

    def get_related(self, relation):
        related = getattr(self.__class__, relation)
        return related

    def attach(self, relation, related_record):
        related = getattr(self.__class__, relation)
        return related.attach(self, related_record)

    def detach(self, relation, related_record):
        related = getattr(self.__class__, relation)

        if not related_record.is_created():
            related_record = related_record.create(related_record.all_attributes())
        else:
            related_record.save()

        return related.detach(self, related_record)

    def save_quietly(self):
        """This method calls the save method on a model without firing the saved & saving observer events. Saved/Saving
        are toggled back on once save_quietly has been ran.

        Instead of calling:

        User().save(...)

        you can use this:

        User.save_quietly(...)
        """
        self.without_events()
        saved = self.save()
        self.with_events()
        return saved

    def delete_quietly(self):
        """This method calls the delete method on a model without firing the delete & deleting observer events.
        Instead of calling:

        User().delete(...)

        you can use this:

        User.delete_quietly(...)

        Returns:
            self
        """
        delete = (
            self.without_events()
            .where(self.get_primary_key(), self.get_primary_key_value())
            .delete()
        )
        self.with_events()
        return delete

    def attach_related(self, relation, related_record):
        return self.attach(relation, related_record)

    @classmethod
    def filter_fillable(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters provided dictionary to only include fields specified in the model's __fillable__ property

        Passed dictionary is not mutated.
        """
        if cls.__fillable__ != ["*"]:
            dictionary = {x: dictionary[x] for x in cls.__fillable__ if x in dictionary}
        return dictionary

    @classmethod
    def filter_mass_assignment(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters the provided dictionary in preparation for a mass-assignment operation

        Wrapper around filter_fillable() & filter_guarded(). Passed dictionary is not mutated.
        """
        return cls.filter_guarded(cls.filter_fillable(dictionary))

    @classmethod
    def filter_guarded(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters provided dictionary to exclude fields specified in the model's __guarded__ property

        Passed dictionary is not mutated.
        """
        if cls.__guarded__ == ["*"]:
            # If all fields are guarded, all data should be filtered
            return {}
        return {f: dictionary[f] for f in dictionary if f not in cls.__guarded__}


================================================
FILE: src/masoniteorm/models/Model.pyi
================================================
from typing import Any, Dict

from typing_extensions import Self

from ..query.QueryBuilder import QueryBuilder

class Model:
    def add_select(alias: str, callable: Any):
        """Specifies a select subquery."""
        pass

    def aggregate(aggregate: str, column: str, alias: str):
        """Helper function to aggregate.

        Arguments:
            aggregate {string} -- The name of the aggregation.
            column {string} -- The name of the column to aggregate.
        """

    def all(selects: list = [], query: bool = False):
        """Returns all records from the table.

        Returns:
            dictionary -- Returns a dictionary of results.
        """
        pass

    def get(selects: list = []):
        """Runs the select query built from the query builder.

        Returns:
            self
        """
        pass

    def avg(column: str):
        """Aggregates a columns values.

        Arguments:
            column {string} -- The name of the column to aggregate.

        Returns:
            self
        """
        pass

    def between(column: str, low: str | int, high: str | int):
        """Specifies a where between expression.

        Arguments:
            column {string} -- The name of the column.
            low {string} -- The value on the low end.
            high {string} -- The value on the high end.

        Returns:
            self
        """
        pass

    def bulk_create(creates: dict, query: bool = False):
        pass

    def cast_value(attribute: str, value: Any):
        """
        Given an attribute name and a value, casts the value using the model's registered caster.
        If no registered caster exists, returns the unmodified value.
        """
        pass

    def cast_values(dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Runs provided dictionary through all model casters and returns the result.

        Does not mutate the passed dictionary.
        """
        pass

    def chunk(chunk_amount: str | int):
        pass

    def count(column: str = None):
        """Aggregates a columns values.

        Arguments:
            column {string} -- The name of the column to aggregate.

        Returns:
            self
        """
        pass

    def create(
        dictionary: Dict[str, Any] = None,
        query: bool = False,
        cast: bool = False,
        **kwargs
    ):
        """Creates new records based off of a dictionary as well as data set on the model
        such as fillable values.

        Args:
            dictionary (dict, optional): [description]. Defaults to {}.
            query (bool, optional): [description]. Defaults to False.
            cast (bool, optional): [description]. Whether or not to cast passed values.

        Returns:
            self: A hydrated version of a model
        """
        pass

    def decrement(column: str, value: int = 1):
        """Decrements a column's value.

        Arguments:
            column {string} -- The name of the column.

        Keyword Arguments:
            value {int} -- The value to decrement by. (default: {1})

        Returns:
            self
        """

    def delete(column: str = None, value: str = None, query: bool = False):
        """Specify the column and value to delete
        or deletes everything based on a previously used where expression.

        Keyword Arguments:
            column {string} -- The name of the column (default: {None})
            value {string|int} -- The value of the column (default: {None})

        Returns:
            self
        """
        pass

    def distinct(boolean: bool = True):
        """Species that the select query should be a SELECT DISTINCT query."""
        pass

    def doesnt_exist() -> bool:
        """Determines if any rows exist for the current query.

        Returns:
            Bool - True or False
        """
        pass

    def doesnt_have() -> bool:
        """Determine if any related rows exist for the current query.

        Returns:
            Bool - True or False
        """
        pass

    def exists() -> bool:
        """Determine if rows exist for the current query.

        Returns:
            Bool - True or False
        """
        pass

    def filter_fillable(dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters provided dictionary to only include fields specified in the model's __fillable__ property

        Passed dictionary is not mutated.
        """
        pass

    def filter_mass_assignment(dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters the provided dictionary in preparation for a mass-assignment operation

        Wrapper around filter_fillable() & filter_guarded(). Passed dictionary is not mutated.
        """
        pass

    def filter_guarded(dictionary: Dict[str, Any]) -> Dict[str, Any]:
        """
        Filters provided dictionary to exclude fields specified in the model's __guarded__ property

        Passed dictionary is not mutated.
        """
        pass

    def find_or_404(record_id: str | int):
        """Finds a row by the primary key ID (Requires a model) or raise an 404 exception.

        Arguments:
            record_id {int} -- The ID of the primary key to fetch.

        Returns:
            Model|HTTP404
        """
        pass

    def find(record_id: str | list) -> Self:
        """Finds a row by the primary key ID (Requires a model) or raise an 404 exception.

        Arguments:
            record_id {int} -- The ID of the primary key to fetch.

        Returns:
            Model|Collection
        """
        pass

    def find_or_fail(record_id: str | int):
        """Finds a row by the primary key ID (Requires a model) or raise a ModelNotFound exception.

        Arguments:
            record_id {int} -- The ID of the primary key to fetch.

        Returns:
            Model|ModelNotFound
        """
        pass

    def first_or_fail(query: bool = False):
        """Returns the first row from database. If no result found a ModelNotFound exception.

        Returns:
            dictionary|ModelNotFound
        """

    def first(fields: list = None, query: bool = False):
        """Gets the first record.

        Returns:
            dictionary -- Returns a dictionary of results.
        """
        pass

    def first_where(column: str, *args):
        """Gets the first record with the given key / value pair"""
        pass

    def first_or_create(wheres: dict, creates: dict = None):
        """Get the first record matching the attributes or create it.

        Returns:
            Model
        """
        pass

    def force_update(updates: dict, dry: bool = False):
        pass

    def from_(table: str):
        """Alias for the table method

        Arguments:
            table {string} -- The name of the table

        Returns:
            self
        """
        pass

    def from_raw(table: str):
        """Alias for the table method

        Arguments:
            table {string} -- The name of the table

        Returns:
            self
        """
        pass

    def last(column: str = None, query: bool = False):
        """Gets the last record, ordered by column in descendant order or primary
        key if no column is given.

        Returns:
            dictionary -- Returns a dictionary of results.
        """
        pass

    def group_by_raw(query: str, bindings: list = []):
        """Specifies a column to group by.

        Arguments:
            query {string} -- A raw query

        Returns:
            self
        """
        pass

    def group_by(column: str):
        """Specifies a column to group by.

        Arguments:
            column {string} -- The name of the column to group by.

        Returns:
            self
        """
        pass

    def has(*relationships: str):
        pass

    def having_raw(string: str):
        """Specifies raw SQL that should be injected into the having expression.

        Arguments:
            string {string} -- The raw query string.

        Returns:
            self
        """
        pass

    def increment(column: str, value: int = 1):
        """Increments a column's value.

        Arguments:
            column {string} -- The name of the column.

        Keyword Arguments:
            value {int} -- The value to increment by. (default: {1})

        Returns:
            self
        """
        pass

    def in_random_order():
        """Puts Query results in random order"""
        pass

    def join_on(relationship: str, callback: callable = None, clause: str = ["inner"]):
        pass

    def join(
        self,
        table: str,
        column1: str = None,
        equality: str = None,
        column2: str = None,
        clause: str = "inner",
    ):
        """Specifies a join expression.

        Arguments:
            table {string} -- The name of the table or an instance of JoinClause.
            column1 {string} -- The name of the foreign table.
            equality {string} -- The equality to join on.
            column2 {string} -- The name of the local column.

        Keyword Arguments:
            clause {string} -- The action clause. (default: {"inner"})

        Returns:
            self
        """
        pass

    def joins(*relationships: list[str], clause: str = "inner"):
        pass

    def left_join(
        table: str, column1: str = None, equality: str = None, column2: str = None
    ):
        """A helper method to add a left join expression.

        Arguments:
            table {string} -- The name of the table to join on.
            column1 {string} -- The name of the foreign table.
            equality {string} -- The equality to join on.
            column2 {string} -- The name of the local column.

        Returns:
            self
        """
        pass

    def limit(amount: int):
        """Specifies a limit expression.

        Arguments:
            amount {int} -- The number of rows to limit.

        Returns:
            self
        """
        pass

    def lock_for_update():
        pass

    def make_lock(lock: bool):
        pass

    def max(column: str):
        """Aggregates a columns values.

        Arguments:
            column {string} -- The name of the column to aggregate.

        Returns:
            self
        """
        pass

    def min(column: str):
        """Aggregates a columns values.

        Arguments:
            column {string} -- The name of the column to aggregate.

        Returns:
            self
        """
        pass

    def new_from_builder(from_builder: QueryBuilder = None):
        """Creates a new QueryBuilder class.

        Returns:
            QueryBuilder -- The ORM QueryBuilder class.
        """
        pass

    def new():
        """Creates a new QueryBuilder class.

        Returns:
            QueryBuilder -- The ORM QueryBuilder class.
        """
        pass

    def not_between(column: str, low: str | int, high: str | 
Download .txt
gitextract_q9lmgekj/

├── .deepsource.toml
├── .env-example
├── .envrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   └── workflows/
│       ├── pythonapp.yml
│       └── pythonpublish.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .pypirc
├── .tool-versions
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── TODO.md
├── app/
│   └── observers/
│       └── UserObserver.py
├── cc.py
├── conda/
│   ├── conda_build_config.yaml
│   └── meta.yaml
├── config/
│   └── test-database.py
├── databases/
│   ├── migrations/
│   │   ├── 2018_01_09_043202_create_users_table.py
│   │   ├── 2020_04_17_000000_create_friends_table.py
│   │   ├── 2020_04_17_00000_create_articles_table.py
│   │   ├── 2020_10_20_152904_create_table_schema_migration.py
│   │   └── __init__.py
│   └── seeds/
│       ├── database_seeder.py
│       └── user_table_seeder.py
├── makefile
├── orm
├── pyproject.toml
├── pytest.ini
├── requirements.dev
├── requirements.txt
├── setup.py
├── src/
│   └── masoniteorm/
│       ├── .gitignore
│       ├── __init__.py
│       ├── collection/
│       │   ├── Collection.py
│       │   └── __init__.py
│       ├── commands/
│       │   ├── CanOverrideConfig.py
│       │   ├── CanOverrideOptionsDefault.py
│       │   ├── Command.py
│       │   ├── Entry.py
│       │   ├── MakeMigrationCommand.py
│       │   ├── MakeModelCommand.py
│       │   ├── MakeModelDocstringCommand.py
│       │   ├── MakeObserverCommand.py
│       │   ├── MakeSeedCommand.py
│       │   ├── MigrateCommand.py
│       │   ├── MigrateFreshCommand.py
│       │   ├── MigrateRefreshCommand.py
│       │   ├── MigrateResetCommand.py
│       │   ├── MigrateRollbackCommand.py
│       │   ├── MigrateStatusCommand.py
│       │   ├── SeedRunCommand.py
│       │   ├── ShellCommand.py
│       │   ├── __init__.py
│       │   └── stubs/
│       │       ├── create_migration.stub
│       │       ├── create_seed.stub
│       │       ├── model.stub
│       │       ├── observer.stub
│       │       └── table_migration.stub
│       ├── config.py
│       ├── connections/
│       │   ├── .gitignore
│       │   ├── BaseConnection.py
│       │   ├── ConnectionFactory.py
│       │   ├── ConnectionResolver.py
│       │   ├── MSSQLConnection.py
│       │   ├── MySQLConnection.py
│       │   ├── PostgresConnection.py
│       │   ├── SQLiteConnection.py
│       │   └── __init__.py
│       ├── exceptions.py
│       ├── expressions/
│       │   ├── __init__.py
│       │   └── expressions.py
│       ├── factories/
│       │   ├── Factory.py
│       │   └── __init__.py
│       ├── helpers/
│       │   ├── __init__.py
│       │   └── misc.py
│       ├── migrations/
│       │   ├── Migration.py
│       │   └── __init__.py
│       ├── models/
│       │   ├── MigrationModel.py
│       │   ├── Model.py
│       │   ├── Model.pyi
│       │   ├── Pivot.py
│       │   └── __init__.py
│       ├── observers/
│       │   ├── ObservesEvents.py
│       │   └── __init__.py
│       ├── pagination/
│       │   ├── BasePaginator.py
│       │   ├── LengthAwarePaginator.py
│       │   ├── SimplePaginator.py
│       │   └── __init__.py
│       ├── providers/
│       │   ├── ORMProvider.py
│       │   └── __init__.py
│       ├── query/
│       │   ├── EagerRelation.py
│       │   ├── QueryBuilder.py
│       │   ├── __init__.py
│       │   ├── grammars/
│       │   │   ├── BaseGrammar.py
│       │   │   ├── MSSQLGrammar.py
│       │   │   ├── MySQLGrammar.py
│       │   │   ├── PostgresGrammar.py
│       │   │   ├── SQLiteGrammar.py
│       │   │   └── __init__.py
│       │   └── processors/
│       │       ├── MSSQLPostProcessor.py
│       │       ├── MySQLPostProcessor.py
│       │       ├── PostgresPostProcessor.py
│       │       ├── SQLitePostProcessor.py
│       │       └── __init__.py
│       ├── relationships/
│       │   ├── BaseRelationship.py
│       │   ├── BelongsTo.py
│       │   ├── BelongsToMany.py
│       │   ├── HasMany.py
│       │   ├── HasManyThrough.py
│       │   ├── HasOne.py
│       │   ├── HasOneThrough.py
│       │   ├── MorphMany.py
│       │   ├── MorphOne.py
│       │   ├── MorphTo.py
│       │   ├── MorphToMany.py
│       │   └── __init__.py
│       ├── schema/
│       │   ├── Blueprint.py
│       │   ├── Column.py
│       │   ├── ColumnDiff.py
│       │   ├── Constraint.py
│       │   ├── ForeignKeyConstraint.py
│       │   ├── Index.py
│       │   ├── Schema.py
│       │   ├── Table.py
│       │   ├── TableDiff.py
│       │   ├── __init__.py
│       │   └── platforms/
│       │       ├── MSSQLPlatform.py
│       │       ├── MySQLPlatform.py
│       │       ├── Platform.py
│       │       ├── PostgresPlatform.py
│       │       ├── SQLitePlatform.py
│       │       └── __init__.py
│       ├── scopes/
│       │   ├── BaseScope.py
│       │   ├── SoftDeleteScope.py
│       │   ├── SoftDeletesMixin.py
│       │   ├── TimeStampsMixin.py
│       │   ├── TimeStampsScope.py
│       │   ├── UUIDPrimaryKeyMixin.py
│       │   ├── UUIDPrimaryKeyScope.py
│       │   ├── __init__.py
│       │   └── scope.py
│       ├── seeds/
│       │   ├── Seeder.py
│       │   └── __init__.py
│       ├── stubs/
│       │   ├── create-migration.html
│       │   └── table-migration.html
│       └── testing/
│           ├── BaseTestCaseSelectGrammar.py
│           └── __init__.py
└── tests/
    ├── User.py
    ├── collection/
    │   └── test_collection.py
    ├── commands/
    │   └── test_shell.py
    ├── config/
    │   └── test_db_url.py
    ├── connections/
    │   └── test_base_connections.py
    ├── eagers/
    │   └── test_eager.py
    ├── factories/
    │   └── test_factories.py
    ├── integrations/
    │   └── config/
    │       ├── __init__.py
    │       └── database.py
    ├── models/
    │   └── test_models.py
    ├── mssql/
    │   ├── builder/
    │   │   ├── test_mssql_query_builder.py
    │   │   └── test_mssql_query_builder_relationships.py
    │   ├── grammar/
    │   │   ├── test_mssql_delete_grammar.py
    │   │   ├── test_mssql_insert_grammar.py
    │   │   ├── test_mssql_qmark.py
    │   │   ├── test_mssql_select_grammar.py
    │   │   └── test_mssql_update_grammar.py
    │   └── schema/
    │       ├── test_mssql_schema_builder.py
    │       └── test_mssql_schema_builder_alter.py
    ├── mysql/
    │   ├── builder/
    │   │   ├── test_mysql_builder_transaction.py
    │   │   ├── test_query_builder.py
    │   │   ├── test_query_builder_scopes.py
    │   │   └── test_transactions.py
    │   ├── connections/
    │   │   └── test_mysql_connection_selects.py
    │   ├── grammar/
    │   │   ├── test_mysql_delete_grammar.py
    │   │   ├── test_mysql_insert_grammar.py
    │   │   ├── test_mysql_qmark.py
    │   │   ├── test_mysql_select_grammar.py
    │   │   └── test_mysql_update_grammar.py
    │   ├── model/
    │   │   ├── test_accessors_and_mutators.py
    │   │   └── test_model.py
    │   ├── relationships/
    │   │   ├── test_belongs_to_many.py
    │   │   ├── test_has_many_through.py
    │   │   ├── test_has_one_through.py
    │   │   └── test_relationships.py
    │   ├── schema/
    │   │   ├── test_mysql_schema_builder.py
    │   │   └── test_mysql_schema_builder_alter.py
    │   └── scopes/
    │       ├── test_can_use_global_scopes.py
    │       ├── test_can_use_scopes.py
    │       └── test_soft_delete.py
    ├── postgres/
    │   ├── builder/
    │   │   ├── test_postgres_query_builder.py
    │   │   └── test_postgres_transaction.py
    │   ├── grammar/
    │   │   ├── test_delete_grammar.py
    │   │   ├── test_insert_grammar.py
    │   │   ├── test_select_grammar.py
    │   │   └── test_update_grammar.py
    │   ├── relationships/
    │   │   └── test_postgres_relationships.py
    │   └── schema/
    │       ├── test_postgres_schema_builder.py
    │       └── test_postgres_schema_builder_alter.py
    ├── scopes/
    │   └── test_default_global_scopes.py
    ├── seeds/
    │   └── test_seeds.py
    ├── sqlite/
    │   ├── builder/
    │   │   ├── test_sqlite_builder_insert.py
    │   │   ├── test_sqlite_builder_pagination.py
    │   │   ├── test_sqlite_query_builder.py
    │   │   ├── test_sqlite_query_builder_eager_loading.py
    │   │   ├── test_sqlite_query_builder_relationships.py
    │   │   └── test_sqlite_transaction.py
    │   ├── grammar/
    │   │   ├── test_sqlite_delete_grammar.py
    │   │   ├── test_sqlite_insert_grammar.py
    │   │   ├── test_sqlite_select_grammar.py
    │   │   └── test_sqlite_update_grammar.py
    │   ├── models/
    │   │   ├── test_attach_detach.py
    │   │   ├── test_observers.py
    │   │   └── test_sqlite_model.py
    │   ├── relationships/
    │   │   ├── test_sqlite_has_many_through_relationship.py
    │   │   ├── test_sqlite_has_one_through_relationship.py
    │   │   ├── test_sqlite_polymorphic.py
    │   │   └── test_sqlite_relationships.py
    │   └── schema/
    │       ├── test_sqlite_schema_builder.py
    │       ├── test_sqlite_schema_builder_alter.py
    │       ├── test_table.py
    │       └── test_table_diff.py
    └── utils.py
Download .txt
Showing preview only (241K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3071 symbols across 163 files)

FILE: app/observers/UserObserver.py
  class UserObserver (line 6) | class UserObserver:
    method created (line 7) | def created(self, clients):
    method creating (line 15) | def creating(self, clients):
    method saving (line 23) | def saving(self, clients):
    method saved (line 31) | def saved(self, clients):
    method updating (line 39) | def updating(self, clients):
    method updated (line 47) | def updated(self, clients):
    method booted (line 55) | def booted(self, clients):
    method booting (line 63) | def booting(self, clients):
    method hydrating (line 71) | def hydrating(self, clients):
    method hydrated (line 79) | def hydrated(self, clients):
    method deleting (line 87) | def deleting(self, clients):
    method deleted (line 95) | def deleted(self, clients):

FILE: cc.py
  class User (line 18) | class User(Model):
    method articles (line 24) | def articles(self):
  class Company (line 26) | class Company(Model):

FILE: databases/migrations/2018_01_09_043202_create_users_table.py
  class CreateUsersTable (line 5) | class CreateUsersTable(Migration):
    method up (line 7) | def up(self):
    method down (line 26) | def down(self):

FILE: databases/migrations/2020_04_17_000000_create_friends_table.py
  class CreateFriendsTable (line 3) | class CreateFriendsTable(Migration):
    method up (line 5) | def up(self):
    method down (line 15) | def down(self):

FILE: databases/migrations/2020_04_17_00000_create_articles_table.py
  class CreateArticlesTable (line 3) | class CreateArticlesTable(Migration):
    method up (line 5) | def up(self):
    method down (line 14) | def down(self):

FILE: databases/migrations/2020_10_20_152904_create_table_schema_migration.py
  class CreateTableSchemaMigration (line 6) | class CreateTableSchemaMigration(Migration):
    method up (line 8) | def up(self):
    method down (line 17) | def down(self):

FILE: databases/seeds/database_seeder.py
  class DatabaseSeeder (line 6) | class DatabaseSeeder(Seeder):
    method run (line 8) | def run(self):

FILE: databases/seeds/user_table_seeder.py
  class UserTableSeeder (line 9) | class UserTableSeeder(Seeder):
    method run (line 11) | def run(self):

FILE: src/masoniteorm/collection/Collection.py
  class Collection (line 7) | class Collection:
    method __init__ (line 10) | def __init__(self, items=None):
    method take (line 14) | def take(self, number: int):
    method first (line 28) | def first(self, callback=None):
    method items (line 48) | def items(self):
    method last (line 51) | def last(self, callback=None):
    method all (line 67) | def all(self):
    method avg (line 75) | def avg(self, key=None):
    method max (line 94) | def max(self, key=None):
    method min (line 114) | def min(self, key=None):
    method chunk (line 134) | def chunk(self, size: int):
    method collapse (line 148) | def collapse(self):
    method contains (line 154) | def contains(self, key, value=None):
    method count (line 163) | def count(self):
    method diff (line 166) | def diff(self, items):
    method each (line 170) | def each(self, callback):
    method every (line 179) | def every(self, callback):
    method filter (line 183) | def filter(self, callback):
    method flatten (line 187) | def flatten(self):
    method forget (line 202) | def forget(self, *keys):
    method for_page (line 210) | def for_page(self, page, number):
    method get (line 213) | def get(self, key, default=None):
    method implode (line 221) | def implode(self, glue=",", key=None):
    method is_empty (line 227) | def is_empty(self):
    method map (line 230) | def map(self, callback):
    method map_into (line 235) | def map_into(self, cls, method=None, **kwargs):
    method merge (line 245) | def merge(self, items):
    method pluck (line 256) | def pluck(self, value, key=None, keep_nulls=True):
    method pop (line 287) | def pop(self):
    method prepend (line 291) | def prepend(self, value):
    method pull (line 295) | def pull(self, key):
    method push (line 300) | def push(self, value):
    method put (line 303) | def put(self, key, value):
    method random (line 307) | def random(self, count=None):
    method reduce (line 320) | def reduce(self, callback, initial=0):
    method reject (line 323) | def reject(self, callback):
    method reverse (line 329) | def reverse(self):
    method serialize (line 332) | def serialize(self, *args, **kwargs):
    method add_relation (line 345) | def add_relation(self, result=None):
    method shift (line 351) | def shift(self):
    method sort (line 354) | def sort(self, key=None):
    method sum (line 362) | def sum(self, key=None):
    method to_json (line 371) | def to_json(self, **kwargs):
    method group_by (line 374) | def group_by(self, key):
    method transform (line 386) | def transform(self, callback):
    method unique (line 390) | def unique(self, key=None):
    method where (line 413) | def where(self, key, *args):
    method where_in (line 432) | def where_in(self, key, args: list) -> "Collection":
    method where_not_in (line 457) | def where_not_in(self, key, args: list) -> "Collection":
    method zip (line 482) | def zip(self, items):
    method set_appends (line 492) | def set_appends(self, appends):
    method _get_value (line 501) | def _get_value(self, key):
    method _data_get (line 516) | def _data_get(self, item, key, default=None):
    method _value (line 527) | def _value(self, value):
    method _check_is_callable (line 532) | def _check_is_callable(self, callback, raise_exception=True):
    method _make_comparison (line 539) | def _make_comparison(self, a, b, op):
    method __iter__ (line 550) | def __iter__(self):
    method __eq__ (line 554) | def __eq__(self, other):
    method __getitem__ (line 558) | def __getitem__(self, item):
    method __setitem__ (line 569) | def __setitem__(self, key, value):
    method __delitem__ (line 572) | def __delitem__(self, key):
    method __ne__ (line 575) | def __ne__(self, other):
    method __len__ (line 579) | def __len__(self):
    method __le__ (line 582) | def __le__(self, other):
    method __lt__ (line 586) | def __lt__(self, other):
    method __ge__ (line 590) | def __ge__(self, other):
    method __gt__ (line 594) | def __gt__(self, other):
    method __get_items (line 599) | def __get_items(cls, items):

FILE: src/masoniteorm/commands/CanOverrideConfig.py
  class CanOverrideConfig (line 4) | class CanOverrideConfig(Command):
    method __init__ (line 5) | def __init__(self):
    method add_option (line 9) | def add_option(self):

FILE: src/masoniteorm/commands/CanOverrideOptionsDefault.py
  class CanOverrideOptionsDefault (line 4) | class CanOverrideOptionsDefault:
    method __init__ (line 13) | def __init__(self, **kwargs):

FILE: src/masoniteorm/commands/Command.py
  class Command (line 5) | class Command(CanOverrideOptionsDefault, CanOverrideConfig):

FILE: src/masoniteorm/commands/MakeMigrationCommand.py
  class MakeMigrationCommand (line 10) | class MakeMigrationCommand(Command):
    method handle (line 21) | def handle(self):

FILE: src/masoniteorm/commands/MakeModelCommand.py
  class MakeModelCommand (line 9) | class MakeModelCommand(Command):
    method handle (line 25) | def handle(self):

FILE: src/masoniteorm/commands/MakeModelDocstringCommand.py
  class MakeModelDocstringCommand (line 5) | class MakeModelDocstringCommand(Command):
    method handle (line 15) | def handle(self):

FILE: src/masoniteorm/commands/MakeObserverCommand.py
  class MakeObserverCommand (line 9) | class MakeObserverCommand(Command):
    method handle (line 19) | def handle(self):

FILE: src/masoniteorm/commands/MakeSeedCommand.py
  class MakeSeedCommand (line 9) | class MakeSeedCommand(Command):
    method handle (line 18) | def handle(self):

FILE: src/masoniteorm/commands/MigrateCommand.py
  class MigrateCommand (line 7) | class MigrateCommand(Command):
    method handle (line 20) | def handle(self):

FILE: src/masoniteorm/commands/MigrateFreshCommand.py
  class MigrateFreshCommand (line 6) | class MigrateFreshCommand(Command):
    method handle (line 19) | def handle(self):

FILE: src/masoniteorm/commands/MigrateRefreshCommand.py
  class MigrateRefreshCommand (line 6) | class MigrateRefreshCommand(Command):
    method handle (line 19) | def handle(self):

FILE: src/masoniteorm/commands/MigrateResetCommand.py
  class MigrateResetCommand (line 5) | class MigrateResetCommand(Command):
    method handle (line 16) | def handle(self):

FILE: src/masoniteorm/commands/MigrateRollbackCommand.py
  class MigrateRollbackCommand (line 5) | class MigrateRollbackCommand(Command):
    method handle (line 17) | def handle(self):

FILE: src/masoniteorm/commands/MigrateStatusCommand.py
  class MigrateStatusCommand (line 5) | class MigrateStatusCommand(Command):
    method handle (line 15) | def handle(self):

FILE: src/masoniteorm/commands/SeedRunCommand.py
  class SeedRunCommand (line 7) | class SeedRunCommand(Command):
    method handle (line 18) | def handle(self):

FILE: src/masoniteorm/commands/ShellCommand.py
  class ShellCommand (line 12) | class ShellCommand(Command):
    method handle (line 28) | def handle(self):
    method get_shell_program (line 60) | def get_shell_program(self, connection):
    method get_command (line 64) | def get_command(self, config):
    method get_mysql_args (line 101) | def get_mysql_args(self, config):
    method get_postgres_args (line 115) | def get_postgres_args(self, config):
    method get_postgres_env (line 127) | def get_postgres_env(self, config):
    method get_mssql_args (line 130) | def get_mssql_args(self, config):
    method get_sqlite_args (line 152) | def get_sqlite_args(self, config):
    method remove_empty_options (line 158) | def remove_empty_options(self, options):
    method get_sensitive_options (line 172) | def get_sensitive_options(self, config):
    method get_mysql_sensitive_options (line 180) | def get_mysql_sensitive_options(self):
    method get_mssql_sensitive_options (line 183) | def get_mssql_sensitive_options(self):
    method hide_sensitive_options (line 186) | def hide_sensitive_options(self, config, command):

FILE: src/masoniteorm/config.py
  function load_config (line 9) | def load_config(config_path=None):
  function db_url (line 33) | def db_url(database_url=None, prefix="", options={}, log_queries=False):

FILE: src/masoniteorm/connections/BaseConnection.py
  class BaseConnection (line 6) | class BaseConnection:
    method dry (line 11) | def dry(self):
    method set_schema (line 15) | def set_schema(self, schema):
    method log (line 19) | def log(
    method statement (line 30) | def statement(self, query, bindings=()):
    method has_global_connection (line 49) | def has_global_connection(self):
    method get_global_connection (line 52) | def get_global_connection(self):
    method enable_query_log (line 55) | def enable_query_log(self):
    method disable_query_log (line 58) | def disable_query_log(self):
    method format_cursor_results (line 61) | def format_cursor_results(self, cursor_result):
    method set_cursor (line 64) | def set_cursor(self):
    method select_many (line 68) | def select_many(self, query, bindings, amount):
    method enable_disable_foreign_keys (line 80) | def enable_disable_foreign_keys(self):

FILE: src/masoniteorm/connections/ConnectionFactory.py
  class ConnectionFactory (line 4) | class ConnectionFactory:
    method __init__ (line 9) | def __init__(self, config_path=None):
    method register (line 13) | def register(cls, key, connection):
    method make (line 26) | def make(self, key):

FILE: src/masoniteorm/connections/ConnectionResolver.py
  class ConnectionResolver (line 4) | class ConnectionResolver:
    method __init__ (line 9) | def __init__(self, config_path=None):
    method morph_map (line 26) | def morph_map(self, map):
    method set_connection_details (line 30) | def set_connection_details(self, connection_details):
    method get_connection_details (line 34) | def get_connection_details(self):
    method set_connection_option (line 37) | def set_connection_option(self, connection: str, options: dict):
    method get_global_connections (line 41) | def get_global_connections(self):
    method remove_global_connection (line 44) | def remove_global_connection(self, name=None):
    method register (line 47) | def register(self, connection):
    method begin_transaction (line 50) | def begin_transaction(self, name=None):
    method commit (line 67) | def commit(self, name=None):
    method rollback (line 74) | def rollback(self, name=None):
    method transaction (line 83) | def transaction(self, name=None):
    method get_connection_information (line 97) | def get_connection_information(self, name):
    method get_schema_builder (line 110) | def get_schema_builder(self, connection="default", schema=None):
    method get_query_builder (line 119) | def get_query_builder(self, connection="default"):
    method statement (line 126) | def statement(self, query, bindings=(), connection="default"):

FILE: src/masoniteorm/connections/MSSQLConnection.py
  class MSSQLConnection (line 12) | class MSSQLConnection(BaseConnection):
    method __init__ (line 17) | def __init__(
    method make_connection (line 46) | def make_connection(self):
    method get_database_name (line 78) | def get_database_name(self):
    method get_default_query_grammar (line 82) | def get_default_query_grammar(cls):
    method get_default_platform (line 86) | def get_default_platform(cls):
    method get_default_post_processor (line 90) | def get_default_post_processor(cls):
    method reconnect (line 93) | def reconnect(self):
    method commit (line 96) | def commit(self):
    method begin (line 104) | def begin(self):
    method rollback (line 110) | def rollback(self):
    method get_transaction_level (line 118) | def get_transaction_level(self):
    method get_cursor (line 122) | def get_cursor(self):
    method query (line 125) | def query(self, query, bindings=(), results="*"):
    method format_cursor_results (line 169) | def format_cursor_results(self, cursor_result):

FILE: src/masoniteorm/connections/MySQLConnection.py
  class MySQLConnection (line 11) | class MySQLConnection(BaseConnection):
    method __init__ (line 17) | def __init__(
    method make_connection (line 47) | def make_connection(self):
    method close_connection (line 62) | def close_connection(self):
    method create_connection (line 71) | def create_connection(self, autocommit=True):
    method reconnect (line 128) | def reconnect(self):
    method get_default_query_grammar (line 133) | def get_default_query_grammar(cls):
    method get_default_platform (line 137) | def get_default_platform(cls):
    method get_default_post_processor (line 141) | def get_default_post_processor(cls):
    method get_database_name (line 144) | def get_database_name(self):
    method commit (line 147) | def commit(self):
    method dry (line 155) | def dry(self):
    method begin (line 160) | def begin(self):
    method rollback (line 166) | def rollback(self):
    method get_transaction_level (line 174) | def get_transaction_level(self):
    method get_cursor (line 178) | def get_cursor(self):
    method query (line 181) | def query(self, query, bindings=(), results="*"):

FILE: src/masoniteorm/connections/PostgresConnection.py
  class PostgresConnection (line 12) | class PostgresConnection(BaseConnection):
    method __init__ (line 17) | def __init__(
    method make_connection (line 49) | def make_connection(self):
    method create_connection (line 71) | def create_connection(self):
    method get_database_name (line 126) | def get_database_name(self):
    method get_default_query_grammar (line 130) | def get_default_query_grammar(cls):
    method get_default_platform (line 134) | def get_default_platform(cls):
    method get_default_post_processor (line 138) | def get_default_post_processor(cls):
    method reconnect (line 141) | def reconnect(self):
    method close_connection (line 144) | def close_connection(self):
    method commit (line 155) | def commit(self):
    method begin (line 163) | def begin(self):
    method rollback (line 169) | def rollback(self):
    method get_transaction_level (line 177) | def get_transaction_level(self):
    method set_cursor (line 181) | def set_cursor(self):
    method query (line 187) | def query(self, query, bindings=(), results="*"):

FILE: src/masoniteorm/connections/SQLiteConnection.py
  function regexp (line 9) | def regexp(expr, item):
  class SQLiteConnection (line 14) | class SQLiteConnection(BaseConnection):
    method __init__ (line 21) | def __init__(
    method make_connection (line 50) | def make_connection(self):
    method get_default_query_grammar (line 74) | def get_default_query_grammar(cls):
    method get_default_platform (line 78) | def get_default_platform(cls):
    method get_default_post_processor (line 82) | def get_default_post_processor(cls):
    method get_database_name (line 85) | def get_database_name(self):
    method reconnect (line 88) | def reconnect(self):
    method commit (line 91) | def commit(self):
    method begin (line 104) | def begin(self):
    method rollback (line 110) | def rollback(self):
    method get_cursor (line 121) | def get_cursor(self):
    method get_transaction_level (line 124) | def get_transaction_level(self):
    method query (line 127) | def query(self, query, bindings=(), results="*"):
    method format_cursor_results (line 166) | def format_cursor_results(self, cursor_result):
    method select_many (line 169) | def select_many(self, query, bindings, amount):

FILE: src/masoniteorm/exceptions.py
  class DriverNotFound (line 1) | class DriverNotFound(Exception):
  class ModelNotFound (line 5) | class ModelNotFound(Exception):
  class HTTP404 (line 9) | class HTTP404(Exception):
  class ConnectionNotRegistered (line 13) | class ConnectionNotRegistered(Exception):
  class QueryException (line 17) | class QueryException(Exception):
  class MigrationNotFound (line 21) | class MigrationNotFound(Exception):
  class ConfigurationNotFound (line 25) | class ConfigurationNotFound(Exception):
  class InvalidUrlConfiguration (line 29) | class InvalidUrlConfiguration(Exception):
  class MultipleRecordsFound (line 33) | class MultipleRecordsFound(Exception):
  class InvalidArgument (line 37) | class InvalidArgument(Exception):

FILE: src/masoniteorm/expressions/expressions.py
  class QueryExpression (line 4) | class QueryExpression:
    method __init__ (line 7) | def __init__(
  class HavingExpression (line 26) | class HavingExpression:
    method __init__ (line 29) | def __init__(self, column, equality=None, value=None, raw=False):
  class FromTable (line 42) | class FromTable:
    method __init__ (line 45) | def __init__(self, name, raw=False):
  class UpdateQueryExpression (line 50) | class UpdateQueryExpression:
    method __init__ (line 53) | def __init__(self, column, value=None, update_type="keyvalue"):
  class BetweenExpression (line 59) | class BetweenExpression:
    method __init__ (line 62) | def __init__(self, column, low, high, equality="BETWEEN"):
  class SubSelectExpression (line 72) | class SubSelectExpression:
    method __init__ (line 75) | def __init__(self, builder):
  class SubGroupExpression (line 79) | class SubGroupExpression:
    method __init__ (line 82) | def __init__(self, builder, alias="group"):
  class SelectExpression (line 87) | class SelectExpression:
    method __init__ (line 90) | def __init__(self, column, raw=False):
  class OrderByExpression (line 100) | class OrderByExpression:
    method __init__ (line 103) | def __init__(self, column, direction="ASC", raw=False, bindings=()):
  class GroupByExpression (line 121) | class GroupByExpression:
    method __init__ (line 124) | def __init__(self, column=None, raw=False, bindings=()):
  class AggregateExpression (line 131) | class AggregateExpression:
    method __init__ (line 132) | def __init__(self, aggregate=None, column=None, alias=False):
  class Raw (line 140) | class Raw:
    method __init__ (line 141) | def __init__(self, expression):
  class JoinClause (line 145) | class JoinClause:
    method __init__ (line 146) | def __init__(self, table, clause="join"):
    method on (line 156) | def on(self, column1, equality, column2):
    method or_on (line 160) | def or_on(self, column1, equality, column2):
    method on_value (line 164) | def on_value(self, column, *args):
    method or_on_value (line 169) | def or_on_value(self, column, *args):
    method on_null (line 176) | def on_null(self, column):
    method on_not_null (line 188) | def on_not_null(self, column: str):
    method or_on_null (line 200) | def or_on_null(self, column):
    method or_on_not_null (line 212) | def or_on_not_null(self, column: str):
    method where (line 227) | def where(self, column, *args):
    method _extract_operator_value (line 230) | def _extract_operator_value(self, *args):
    method get_on_clauses (line 251) | def get_on_clauses(self):
  class OnClause (line 255) | class OnClause:
    method __init__ (line 256) | def __init__(self, column1, equality, column2, operator="and"):
  class OnValueClause (line 263) | class OnValueClause:
    method __init__ (line 266) | def __init__(

FILE: src/masoniteorm/factories/Factory.py
  class Factory (line 5) | class Factory:
    method faker (line 11) | def faker(self):
    method __init__ (line 19) | def __init__(self, model, number=1):
    method make (line 23) | def make(self, dictionary=None, name="default"):
    method create (line 55) | def create(self, dictionary=None, name="default"):
    method register (line 88) | def register(cls, model, call, name="default"):
    method after_creating (line 95) | def after_creating(cls, model, call, name="default"):
    method run_after_creates (line 101) | def run_after_creates(self, model):

FILE: src/masoniteorm/helpers/misc.py
  function deprecated (line 6) | def deprecated(message):

FILE: src/masoniteorm/migrations/Migration.py
  class Migration (line 15) | class Migration:
    method __init__ (line 16) | def __init__(
    method create_table_if_not_exists (line 47) | def create_table_if_not_exists(self):
    method get_unran_migrations (line 58) | def get_unran_migrations(self):
    method get_rollback_migrations (line 75) | def get_rollback_migrations(self):
    method get_all_migrations (line 83) | def get_all_migrations(self, reverse=False):
    method get_last_batch_number (line 93) | def get_last_batch_number(self):
    method delete_migration (line 96) | def delete_migration(self, file_path):
    method locate (line 99) | def locate(self, file_name):
    method get_ran_migrations (line 107) | def get_ran_migrations(self):
    method migrate (line 133) | def migrate(self, migration="all", output=False):
    method rollback (line 185) | def rollback(self, migration="all", output=False):
    method delete_migrations (line 242) | def delete_migrations(self, migrations=None):
    method delete_last_batch (line 245) | def delete_last_batch(self):
    method reset (line 250) | def reset(self, migration="all"):
    method refresh (line 288) | def refresh(self, migration="all"):
    method drop_all_tables (line 292) | def drop_all_tables(self, ignore_fk=False):
    method fresh (line 308) | def fresh(self, ignore_fk=False, migration="all"):

FILE: src/masoniteorm/models/MigrationModel.py
  class MigrationModel (line 4) | class MigrationModel(Model):

FILE: src/masoniteorm/models/Model.py
  class ModelMeta (line 25) | class ModelMeta(type):
    method __getattr__ (line 26) | def __getattr__(self, attribute, *args, **kwargs):
  class BoolCast (line 49) | class BoolCast:
    method get (line 52) | def get(self, value):
    method set (line 55) | def set(self, value):
  class JsonCast (line 59) | class JsonCast:
    method get (line 62) | def get(self, value):
    method set (line 71) | def set(self, value):
  class IntCast (line 80) | class IntCast:
    method get (line 83) | def get(self, value):
    method set (line 86) | def set(self, value):
  class FloatCast (line 90) | class FloatCast:
    method get (line 93) | def get(self, value):
    method set (line 96) | def set(self, value):
  class DateCast (line 100) | class DateCast:
    method get (line 103) | def get(self, value):
    method set (line 106) | def set(self, value):
  class DecimalCast (line 110) | class DecimalCast:
    method get (line 113) | def get(self, value):
    method set (line 122) | def set(self, value):
  class Model (line 129) | class Model(TimeStampsMixin, ObservesEvents, metaclass=ModelMeta):
    method __init__ (line 284) | def __init__(self):
    method get_primary_key (line 296) | def get_primary_key(self):
    method get_primary_key_type (line 304) | def get_primary_key_type(self):
    method get_primary_key_value (line 312) | def get_primary_key_value(self):
    method get_foreign_key (line 330) | def get_foreign_key(self):
    method query (line 341) | def query(self):
    method get_builder (line 344) | def get_builder(self):
    method get_selects (line 359) | def get_selects(self):
    method get_columns (line 363) | def get_columns(cls):
    method get_connection_details (line 366) | def get_connection_details(self):
    method boot (line 370) | def boot(self):
    method append_passthrough (line 393) | def append_passthrough(self, passthrough):
    method get_table_name (line 398) | def get_table_name(cls):
    method table (line 407) | def table(cls, table):
    method find (line 417) | def find(cls, record_id, query=False):
    method find_or_fail (line 440) | def find_or_fail(cls, record_id, query=False):
    method is_loaded (line 456) | def is_loaded(self):
    method is_created (line 459) | def is_created(self):
    method add_relation (line 462) | def add_relation(self, relations):
    method hydrate (line 467) | def hydrate(cls, result, relations=None):
    method fill (line 525) | def fill(self, attributes):
    method fill_original (line 529) | def fill_original(self, attributes):
    method new_collection (line 534) | def new_collection(cls, data):
    method create (line 547) | def create(
    method cast_value (line 571) | def cast_value(cls, attribute: str, value: Any):
    method cast_values (line 590) | def cast_values(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method fresh (line 598) | def fresh(self):
    method serialize (line 605) | def serialize(self, exclude=None, include=None):
    method to_json (line 680) | def to_json(self):
    method first_or_create (line 689) | def first_or_create(cls, wheres, creates: dict = None):
    method update_or_create (line 707) | def update_or_create(cls, wheres, updates):
    method relations_to_dict (line 718) | def relations_to_dict(self):
    method touch (line 743) | def touch(self, date=None, query=True):
    method _update_timestamps (line 753) | def _update_timestamps(self, date=None):
    method _current_timestamp (line 761) | def _current_timestamp(self):
    method __getattr__ (line 764) | def __getattr__(self, attribute):
    method only (line 814) | def only(self, attributes: list) -> dict:
    method __setattr__ (line 831) | def __setattr__(self, attribute, value):
    method get_raw_attribute (line 850) | def get_raw_attribute(self, attribute):
    method is_dirty (line 861) | def is_dirty(self):
    method get_original (line 864) | def get_original(self, key):
    method get_dirty (line 867) | def get_dirty(self, key):
    method get_dirty_keys (line 870) | def get_dirty_keys(self):
    method save (line 873) | def save(self, query=False):
    method get_value (line 907) | def get_value(self, attribute):
    method get_dirty_value (line 914) | def get_dirty_value(self, attribute):
    method all_attributes (line 921) | def all_attributes(self):
    method delete_attribute (line 930) | def delete_attribute(self, key):
    method get_dirty_attributes (line 937) | def get_dirty_attributes(self):
    method get_cast_map (line 942) | def get_cast_map(self):
    method _cast_attribute (line 947) | def _cast_attribute(self, attribute, value):
    method _set_cast_attribute (line 959) | def _set_cast_attribute(self, attribute, value):
    method load (line 969) | def load(cls, *loads):
    method __getitem__ (line 974) | def __getitem__(self, attribute):
    method get_dates (line 977) | def get_dates(self):
    method get_new_date (line 987) | def get_new_date(self, _datetime=None):
    method get_new_datetime_string (line 1013) | def get_new_datetime_string(self, _datetime=None):
    method get_new_serialized_date (line 1022) | def get_new_serialized_date(self, _datetime):
    method set_appends (line 1030) | def set_appends(self, appends):
    method save_many (line 1039) | def save_many(self, relation, relating_records):
    method detach_many (line 1048) | def detach_many(self, relation, relating_records):
    method related (line 1063) | def related(self, relation):
    method get_related (line 1067) | def get_related(self, relation):
    method attach (line 1071) | def attach(self, relation, related_record):
    method detach (line 1075) | def detach(self, relation, related_record):
    method save_quietly (line 1085) | def save_quietly(self):
    method delete_quietly (line 1102) | def delete_quietly(self):
    method attach_related (line 1123) | def attach_related(self, relation, related_record):
    method filter_fillable (line 1127) | def filter_fillable(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method filter_mass_assignment (line 1138) | def filter_mass_assignment(cls, dictionary: Dict[str, Any]) -> Dict[st...
    method filter_guarded (line 1147) | def filter_guarded(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:

FILE: src/masoniteorm/models/Model.pyi
  class Model (line 7) | class Model:
    method add_select (line 8) | def add_select(alias: str, callable: Any):
    method aggregate (line 12) | def aggregate(aggregate: str, column: str, alias: str):
    method all (line 20) | def all(selects: list = [], query: bool = False):
    method get (line 28) | def get(selects: list = []):
    method avg (line 36) | def avg(column: str):
    method between (line 47) | def between(column: str, low: str | int, high: str | int):
    method bulk_create (line 60) | def bulk_create(creates: dict, query: bool = False):
    method cast_value (line 63) | def cast_value(attribute: str, value: Any):
    method cast_values (line 70) | def cast_values(dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method chunk (line 78) | def chunk(chunk_amount: str | int):
    method count (line 81) | def count(column: str = None):
    method create (line 92) | def create(
    method decrement (line 111) | def decrement(column: str, value: int = 1):
    method delete (line 124) | def delete(column: str = None, value: str = None, query: bool = False):
    method distinct (line 137) | def distinct(boolean: bool = True):
    method doesnt_exist (line 141) | def doesnt_exist() -> bool:
    method doesnt_have (line 149) | def doesnt_have() -> bool:
    method exists (line 157) | def exists() -> bool:
    method filter_fillable (line 165) | def filter_fillable(dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method filter_mass_assignment (line 173) | def filter_mass_assignment(dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method filter_guarded (line 181) | def filter_guarded(dictionary: Dict[str, Any]) -> Dict[str, Any]:
    method find_or_404 (line 189) | def find_or_404(record_id: str | int):
    method find (line 200) | def find(record_id: str | list) -> Self:
    method find_or_fail (line 211) | def find_or_fail(record_id: str | int):
    method first_or_fail (line 222) | def first_or_fail(query: bool = False):
    method first (line 229) | def first(fields: list = None, query: bool = False):
    method first_where (line 237) | def first_where(column: str, *args):
    method first_or_create (line 241) | def first_or_create(wheres: dict, creates: dict = None):
    method force_update (line 249) | def force_update(updates: dict, dry: bool = False):
    method from_ (line 252) | def from_(table: str):
    method from_raw (line 263) | def from_raw(table: str):
    method last (line 274) | def last(column: str = None, query: bool = False):
    method group_by_raw (line 283) | def group_by_raw(query: str, bindings: list = []):
    method group_by (line 294) | def group_by(column: str):
    method has (line 305) | def has(*relationships: str):
    method having_raw (line 308) | def having_raw(string: str):
    method increment (line 319) | def increment(column: str, value: int = 1):
    method in_random_order (line 333) | def in_random_order():
    method join_on (line 337) | def join_on(relationship: str, callback: callable = None, clause: str ...
    method join (line 340) | def join(
    method joins (line 364) | def joins(*relationships: list[str], clause: str = "inner"):
    method left_join (line 367) | def left_join(
    method limit (line 383) | def limit(amount: int):
    method lock_for_update (line 394) | def lock_for_update():
    method make_lock (line 397) | def make_lock(lock: bool):
    method max (line 400) | def max(column: str):
    method min (line 411) | def min(column: str):
    method new_from_builder (line 422) | def new_from_builder(from_builder: QueryBuilder = None):
    method new (line 430) | def new():
    method not_between (line 438) | def not_between(column: str, low: str | int, high: str | int):
    method offset (line 451) | def offset(amount: int):
    method on (line 462) | def on(connection: str):
    method or_where (line 465) | def or_where(column: str | int, *args) -> QueryBuilder:
    method or_where_null (line 477) | def or_where_null(column: str):
    method order_by_raw (line 488) | def order_by_raw(query: str, bindings: list = []):
    method order_by (line 502) | def order_by(column: str, direction: str = "ASC|DESC"):
    method paginate (line 516) | def paginate(per_page: int, page: int = 1):
    method right_join (line 519) | def right_join(
    method select_raw (line 535) | def select_raw(query: str):
    method select (line 543) | def select(*args: str):
    method set_global_scope (line 551) | def set_global_scope(
    method shared_lock (line 568) | def shared_lock():
    method simple_paginate (line 571) | def simple_paginate(per_page: int, page: int = 1):
    method skip (line 574) | def skip(*args, **kwargs):
    method statement (line 578) | def statement(query: str, bindings: list = ()):
    method sum (line 581) | def sum(column: str):
    method table_raw (line 592) | def table_raw(query: str):
    method take (line 603) | def take(*args, **kwargs):
    method to_qmark (line 607) | def to_qmark() -> str:
    method to_sql (line 615) | def to_sql() -> str:
    method truncate (line 623) | def truncate(foreign_keys: bool = False):
    method update (line 626) | def update(
    method when (line 642) | def when(conditional: bool, callback: callable):
    method where_between (line 645) | def where_between(*args, **kwargs):
    method where_column (line 649) | def where_column(column1: str, column2: str):
    method take (line 661) | def take(*args: Any, **kwargs: Any):
    method where_column (line 665) | def where_column(column1: str, column2: str):
    method where_date (line 677) | def where_date(column: str, date: Any):
    method or_where_date (line 688) | def or_where_date(column: str, date: Any):
    method where_exists (line 700) | def where_exists(value: Any):
    method where_from_builder (line 711) | def where_from_builder(builder: QueryBuilder):
    method where_has (line 725) | def where_has(relationship: str, callback: Any):
    method where_in (line 728) | def where_in(column: str, wheres: list = []):
    method where_like (line 742) | def where_like(column: str, value: str):
    method where_not_between (line 754) | def where_not_between(*args: Any, **kwargs: Any):
    method where_not_in (line 758) | def where_not_in(column: str, wheres: list = []):
    method where_not_like (line 772) | def where_not_like(column: str, value: str):
    method where_not_null (line 784) | def where_not_null(column: str):
    method where_null (line 795) | def where_null(column: str):
    method where_raw (line 806) | def where_raw(query: str, bindings: list = []):
    method without_global_scopes (line 820) | def without_global_scopes():
    method where (line 823) | def where(column: str, *args: Any):
    method with_ (line 837) | def with_(*eagers: str):
    method with_count (line 840) | def with_count(relationship: str, callback: Any = None):

FILE: src/masoniteorm/models/Pivot.py
  class Pivot (line 4) | class Pivot(Model):

FILE: src/masoniteorm/observers/ObservesEvents.py
  class ObservesEvents (line 1) | class ObservesEvents:
    method observe_events (line 2) | def observe_events(self, model, event):
    method observe (line 11) | def observe(cls, observer):
    method without_events (line 18) | def without_events(cls):
    method with_events (line 24) | def with_events(cls):

FILE: src/masoniteorm/pagination/BasePaginator.py
  class BasePaginator (line 4) | class BasePaginator:
    method __iter__ (line 5) | def __iter__(self):
    method to_json (line 9) | def to_json(self):

FILE: src/masoniteorm/pagination/LengthAwarePaginator.py
  class LengthAwarePaginator (line 5) | class LengthAwarePaginator(BasePaginator):
    method __init__ (line 6) | def __init__(self, result, per_page, current_page, total, url=None):
    method serialize (line 17) | def serialize(self, *args, **kwargs):
    method has_more_pages (line 30) | def has_more_pages(self):

FILE: src/masoniteorm/pagination/SimplePaginator.py
  class SimplePaginator (line 4) | class SimplePaginator(BasePaginator):
    method __init__ (line 5) | def __init__(self, result, per_page, current_page, url=None):
    method serialize (line 14) | def serialize(self, *args, **kwargs):
    method has_more_pages (line 25) | def has_more_pages(self):

FILE: src/masoniteorm/providers/ORMProvider.py
  class ORMProvider (line 17) | class ORMProvider(Provider):
    method __init__ (line 21) | def __init__(self, application):
    method register (line 24) | def register(self):
    method boot (line 38) | def boot(self):

FILE: src/masoniteorm/query/EagerRelation.py
  class EagerRelations (line 1) | class EagerRelations:
    method __init__ (line 2) | def __init__(self, relation=None):
    method register (line 9) | def register(self, *relations, callback=None):
    method get_eagers (line 29) | def get_eagers(self):

FILE: src/masoniteorm/query/QueryBuilder.py
  class QueryBuilder (line 36) | class QueryBuilder(ObservesEvents):
    method __init__ (line 39) | def __init__(
    method _set_creates_related (line 120) | def _set_creates_related(self, fields: dict):
    method set_schema (line 124) | def set_schema(self, schema):
    method shared_lock (line 128) | def shared_lock(self):
    method lock_for_update (line 131) | def lock_for_update(self):
    method make_lock (line 134) | def make_lock(self, lock):
    method reset (line 138) | def reset(self):
    method get_connection_information (line 153) | def get_connection_information(self):
    method table (line 171) | def table(self, table, raw=False):
    method from_ (line 186) | def from_(self, table):
    method from_raw (line 197) | def from_raw(self, table):
    method table_raw (line 208) | def table_raw(self, query):
    method get_table_name (line 219) | def get_table_name(self):
    method get_connection (line 230) | def get_connection(self):
    method begin (line 241) | def begin(self):
    method begin_transaction (line 252) | def begin_transaction(self, *args, **kwargs):
    method get_schema_builder (line 255) | def get_schema_builder(self):
    method commit (line 258) | def commit(self):
    method rollback (line 269) | def rollback(self):
    method get_relation (line 281) | def get_relation(self, key):
    method set_scope (line 292) | def set_scope(self, name, callable):
    method set_global_scope (line 307) | def set_global_scope(self, name="", callable=None, action="select"):
    method without_global_scopes (line 328) | def without_global_scopes(self):
    method remove_global_scope (line 332) | def remove_global_scope(self, scope, action=None):
    method __getattr__ (line 350) | def __getattr__(self, attribute):
    method on (line 387) | def on(self, connection):
    method select (line 409) | def select(self, *args):
    method distinct (line 425) | def distinct(self, boolean=True):
    method add_select (line 434) | def add_select(self, alias, callable):
    method statement (line 445) | def statement(self, query, bindings=None):
    method select_raw (line 451) | def select_raw(self, query):
    method get_processor (line 460) | def get_processor(self):
    method bulk_create (line 463) | def bulk_create(
    method create (line 499) | def create(
    method hydrate (line 562) | def hydrate(self, result, relations=None):
    method delete (line 565) | def delete(self, column=None, value=None, query=False):
    method where (line 602) | def where(self, column, *args):
    method where_from_builder (line 632) | def where_from_builder(self, builder):
    method where_like (line 649) | def where_like(self, column, value):
    method where_not_like (line 663) | def where_not_like(self, column, value):
    method where_raw (line 677) | def where_raw(self, query: str, bindings=()):
    method or_where (line 694) | def or_where(self, column, *args):
    method where_exists (line 724) | def where_exists(self, value: "str|int|QueryBuilder"):
    method or_where_exists (line 750) | def or_where_exists(self, value: "str|int|QueryBuilder"):
    method where_not_exists (line 785) | def where_not_exists(self, value: "str|int|QueryBuilder"):
    method or_where_not_exists (line 812) | def or_where_not_exists(self, value: "str|int|QueryBuilder"):
    method having (line 848) | def having(self, column, equality="", value=""):
    method having_raw (line 864) | def having_raw(self, string):
    method where_null (line 876) | def where_null(self, column):
    method or_where_null (line 888) | def or_where_null(self, column):
    method chunk (line 900) | def chunk(self, chunk_amount):
    method where_not_null (line 905) | def where_not_null(self, column: str):
    method _get_date_string (line 917) | def _get_date_string(self, date):
    method where_date (line 925) | def where_date(self, column: str, date: "str|datetime"):
    method or_where_date (line 939) | def or_where_date(self, column: str, date: "str|datetime"):
    method between (line 958) | def between(self, column: str, low: int, high: int):
    method where_between (line 972) | def where_between(self, *args, **kwargs):
    method where_not_between (line 975) | def where_not_between(self, *args, **kwargs):
    method not_between (line 978) | def not_between(self, column: str, low: str, high: str):
    method where_in (line 992) | def where_in(self, column, wheres=None):
    method get_relation (line 1026) | def get_relation(self, relationship, builder=None):
    method has (line 1037) | def has(self, *relationships):
    method or_has (line 1054) | def or_has(self, *relationships):
    method doesnt_have (line 1081) | def doesnt_have(self, *relationships):
    method or_doesnt_have (line 1107) | def or_doesnt_have(self, *relationships):
    method where_has (line 1133) | def where_has(self, relationship, callback):
    method or_where_has (line 1157) | def or_where_has(self, relationship, callback):
    method where_doesnt_have (line 1181) | def where_doesnt_have(self, relationship, callback):
    method or_where_doesnt_have (line 1206) | def or_where_doesnt_have(self, relationship, callback):
    method with_count (line 1231) | def with_count(self, relationship, callback=None):
    method where_not_in (line 1237) | def where_not_in(self, column, wheres=None):
    method join (line 1260) | def join(
    method left_join (line 1287) | def left_join(self, table, column1=None, equality=None, column2=None):
    method right_join (line 1307) | def right_join(self, table, column1=None, equality=None, column2=None):
    method joins (line 1327) | def joins(self, *relationships, clause="inner"):
    method join_on (line 1333) | def join_on(self, relationship, callback=None, clause="inner"):
    method where_column (line 1344) | def where_column(self, column1, column2):
    method take (line 1357) | def take(self, *args, **kwargs):
    method limit (line 1361) | def limit(self, amount):
    method offset (line 1373) | def offset(self, amount):
    method skip (line 1385) | def skip(self, *args, **kwargs):
    method update (line 1389) | def update(
    method force_update (line 1474) | def force_update(self, updates: dict, dry=False):
    method set_updates (line 1477) | def set_updates(self, updates: dict, dry=False):
    method increment (line 1492) | def increment(self, column, value=1, dry=False):
    method decrement (line 1534) | def decrement(self, column, value=1, dry=False):
    method sum (line 1576) | def sum(self, column):
    method count (line 1588) | def count(self, column=None, dry=False):
    method max (line 1623) | def max(self, column):
    method order_by (line 1635) | def order_by(self, column, direction="ASC"):
    method order_by_raw (line 1651) | def order_by_raw(self, query, bindings=None):
    method group_by (line 1668) | def group_by(self, column):
    method group_by_raw (line 1682) | def group_by_raw(self, query, bindings=None):
    method aggregate (line 1699) | def aggregate(self, aggregate, column, alias=None):
    method first (line 1710) | def first(self, fields=None, query=False):
    method first_or_create (line 1729) | def first_or_create(self, wheres, creates: dict = None):
    method sole (line 1755) | def sole(self, query=False):
    method sole_value (line 1768) | def sole_value(self, column: str, query=False):
    method first_where (line 1771) | def first_where(self, column, *args):
    method last (line 1777) | def last(self, column=None, query=False):
    method _get_eager_load_result (line 1798) | def _get_eager_load_result(self, related, collection):
    method find (line 1801) | def find(self, record_id, column=None, query=False):
    method find_or (line 1826) | def find_or(self, record_id: int, callback: Callable, args=None, colum...
    method find_or_fail (line 1850) | def find_or_fail(self, record_id, column=None):
    method find_or_404 (line 1867) | def find_or_404(self, record_id, column=None):
    method first_or_fail (line 1882) | def first_or_fail(self, query=False):
    method get_primary_key (line 1899) | def get_primary_key(self):
    method prepare_result (line 1902) | def prepare_result(self, result, collection=False):
    method _register_relationships_to_model (line 1958) | def _register_relationships_to_model(
    method _map_related (line 1984) | def _map_related(self, related_result, related):
    method all (line 1987) | def all(self, selects=[], query=False):
    method get (line 2003) | def get(self, selects=[]):
    method new_connection (line 2014) | def new_connection(self):
    method get_connection (line 2027) | def get_connection(self):
    method without_eager (line 2030) | def without_eager(self):
    method with_ (line 2034) | def with_(self, *eagers):
    method paginate (line 2038) | def paginate(self, per_page, page=1):
    method simple_paginate (line 2054) | def simple_paginate(self, per_page, page=1):
    method set_action (line 2065) | def set_action(self, action):
    method get_grammar (line 2077) | def get_grammar(self):
    method to_sql (line 2106) | def to_sql(self):
    method explain (line 2118) | def explain(self):
    method run_scopes (line 2128) | def run_scopes(self):
    method to_qmark (line 2134) | def to_qmark(self):
    method new (line 2151) | def new(self):
    method avg (line 2170) | def avg(self, column):
    method min (line 2182) | def min(self, column):
    method _extract_operator_value (line 2194) | def _extract_operator_value(self, *args):
    method __call__ (line 2227) | def __call__(self):
    method macro (line 2235) | def macro(self, name, callable):
    method when (line 2239) | def when(self, conditional, callback):
    method truncate (line 2244) | def truncate(self, foreign_keys=False, dry=False):
    method exists (line 2252) | def exists(self):
    method doesnt_exist (line 2263) | def doesnt_exist(self):
    method in_random_order (line 2274) | def in_random_order(self):
    method new_from_builder (line 2278) | def new_from_builder(self, from_builder=None):
    method get_table_columns (line 2313) | def get_table_columns(self):
    method get_schema (line 2316) | def get_schema(self):
    method latest (line 2321) | def latest(self, *fields):
    method oldest (line 2333) | def oldest(self, *fields):
    method value (line 2345) | def value(self, column: str):

FILE: src/masoniteorm/query/grammars/BaseGrammar.py
  class BaseGrammar (line 12) | class BaseGrammar:
    method __init__ (line 23) | def __init__(
    method compile (line 66) | def compile(self, action, qmark=False):
    method _compile_select (line 70) | def _compile_select(self, qmark=False):
    method _compile_update (line 119) | def _compile_update(self, qmark=False):
    method _compile_insert (line 136) | def _compile_insert(self, qmark=False):
    method _compile_bulk_create (line 151) | def _compile_bulk_create(self, qmark=False):
    method columnize_bulk_columns (line 167) | def columnize_bulk_columns(self, columns=[]):
    method columnize_bulk_values (line 172) | def columnize_bulk_values(self, columns=[], qmark=False):
    method process_value_string (line 201) | def process_value_string(self):
    method _compile_delete (line 204) | def _compile_delete(self, qmark=False):
    method _get_multiple_columns (line 219) | def _get_multiple_columns(self, columns):
    method process_joins (line 236) | def process_joins(self, qmark=False):
    method _compile_key_value_equals (line 283) | def _compile_key_value_equals(self, qmark=False):
    method process_aggregates (line 332) | def process_aggregates(self):
    method process_order_by (line 359) | def process_order_by(self):
    method process_group_by (line 398) | def process_group_by(self):
    method process_alias (line 422) | def process_alias(self, column):
    method process_table (line 433) | def process_table(self, table):
    method process_limit (line 467) | def process_limit(self):
    method process_offset (line 478) | def process_offset(self):
    method process_locks (line 489) | def process_locks(self):
    method process_having (line 492) | def process_having(self, qmark=False):
    method process_wheres (line 521) | def process_wheres(self, qmark=False, strip_first_where=False):
    method get_true_column_string (line 705) | def get_true_column_string(self):
    method get_false_column_string (line 708) | def get_false_column_string(self):
    method add_binding (line 711) | def add_binding(self, *bindings):
    method column_exists (line 719) | def column_exists(self, column):
    method table_exists (line 732) | def table_exists(self):
    method wrap_table (line 745) | def wrap_table(self, table_name):
    method process_exists (line 748) | def process_exists(self):
    method to_sql (line 760) | def to_sql(self):
    method to_qmark (line 768) | def to_qmark(self):
    method process_columns (line 777) | def process_columns(self, separator="", action="select", qmark=False):
    method process_values (line 818) | def process_values(self, separator="", qmark=False):
    method process_column (line 851) | def process_column(self, column, separator=""):
    method _table_column_string (line 870) | def _table_column_string(self, column, alias=None, separator=""):
    method _compile_value (line 902) | def _compile_value(self, value, separator=""):
    method drop_table (line 916) | def drop_table(self, table):
    method drop_table_if_exists (line 928) | def drop_table_if_exists(self, table):
    method rename_table (line 942) | def rename_table(self, current_table_name, new_table_name):
    method truncate_table (line 958) | def truncate_table(self, table, foreign_keys=False):
    method where_regexp_string (line 971) | def where_regexp_string(self):
    method where_not_regexp_string (line 974) | def where_not_regexp_string(self):

FILE: src/masoniteorm/query/grammars/MSSQLGrammar.py
  class MSSQLGrammar (line 4) | class MSSQLGrammar(BaseGrammar):
    method select_no_table (line 35) | def select_no_table(self):
    method select_format (line 38) | def select_format(self):
    method update_format (line 41) | def update_format(self):
    method insert_format (line 44) | def insert_format(self):
    method bulk_insert_format (line 47) | def bulk_insert_format(self):
    method delete_format (line 50) | def delete_format(self):
    method create_column_string (line 53) | def create_column_string(self):
    method create_start (line 56) | def create_start(self):
    method having_string (line 59) | def having_string(self):
    method where_exists_string (line 62) | def where_exists_string(self):
    method where_not_exists_string (line 65) | def where_not_exists_string(self):
    method where_like_string (line 68) | def where_like_string(self):
    method where_not_like_string (line 71) | def where_not_like_string(self):
    method where_date_string (line 74) | def where_date_string(self):
    method where_regexp_string (line 77) | def where_regexp_string(self):
    method where_not_regexp_string (line 80) | def where_not_regexp_string(self):
    method having_equality_string (line 83) | def having_equality_string(self):
    method aggregate_string_without_alias (line 86) | def aggregate_string_without_alias(self):
    method create_column_length (line 89) | def create_column_length(self):
    method limit_string (line 92) | def limit_string(self, offset=False):
    method first_where_string (line 97) | def first_where_string(self):
    method additional_where_string (line 100) | def additional_where_string(self):
    method join_string (line 103) | def join_string(self):
    method aggregate_string (line 106) | def aggregate_string(self):
    method subquery_string (line 109) | def subquery_string(self):
    method subquery_alias_string (line 112) | def subquery_alias_string(self):
    method where_group_string (line 115) | def where_group_string(self):
    method or_where_string (line 118) | def or_where_string(self):
    method raw_query_string (line 121) | def raw_query_string(self):
    method where_in_string (line 124) | def where_in_string(self):
    method value_equal_string (line 127) | def value_equal_string(self):
    method where_null_string (line 130) | def where_null_string(self):
    method between_string (line 133) | def between_string(self):
    method not_between_string (line 136) | def not_between_string(self):
    method where_not_null_string (line 139) | def where_not_null_string(self):
    method where_string (line 142) | def where_string(self):
    method offset_string (line 145) | def offset_string(self):
    method increment_string (line 148) | def increment_string(self):
    method decrement_string (line 151) | def decrement_string(self):
    method aggregate_string_with_alias (line 154) | def aggregate_string_with_alias(self):
    method key_value_string (line 157) | def key_value_string(self):
    method column_value_string (line 160) | def column_value_string(self):
    method table_string (line 163) | def table_string(self):
    method order_by_format (line 166) | def order_by_format(self):
    method order_by_string (line 169) | def order_by_string(self):
    method column_string (line 172) | def column_string(self):
    method table_column_string (line 175) | def table_column_string(self):
    method table_update_column_string (line 178) | def table_update_column_string(self):
    method table_insert_column_string (line 181) | def table_insert_column_string(self):
    method value_string (line 184) | def value_string(self):
    method wrap_table (line 187) | def wrap_table(self, table_name):
    method truncate_table (line 190) | def truncate_table(self, table, foreign_keys=False):
    method compile_random (line 193) | def compile_random(self, seed):

FILE: src/masoniteorm/query/grammars/MySQLGrammar.py
  class MySQLGrammar (line 4) | class MySQLGrammar(BaseGrammar):
    method select_format (line 51) | def select_format(self):
    method select_no_table (line 54) | def select_no_table(self):
    method update_format (line 57) | def update_format(self):
    method insert_format (line 60) | def insert_format(self):
    method bulk_insert_format (line 63) | def bulk_insert_format(self):
    method delete_format (line 66) | def delete_format(self):
    method aggregate_string_with_alias (line 69) | def aggregate_string_with_alias(self):
    method aggregate_string_without_alias (line 72) | def aggregate_string_without_alias(self):
    method subquery_string (line 75) | def subquery_string(self):
    method raw_query_string (line 78) | def raw_query_string(self):
    method where_group_string (line 81) | def where_group_string(self):
    method between_string (line 84) | def between_string(self):
    method not_between_string (line 87) | def not_between_string(self):
    method where_exists_string (line 90) | def where_exists_string(self):
    method where_date_string (line 93) | def where_date_string(self):
    method where_not_exists_string (line 96) | def where_not_exists_string(self):
    method where_like_string (line 99) | def where_like_string(self):
    method where_not_like_string (line 102) | def where_not_like_string(self):
    method get_true_column_string (line 105) | def get_true_column_string(self):
    method get_false_column_string (line 108) | def get_false_column_string(self):
    method process_table (line 111) | def process_table(self, table):
    method subquery_alias_string (line 132) | def subquery_alias_string(self):
    method key_value_string (line 135) | def key_value_string(self):
    method column_value_string (line 138) | def column_value_string(self):
    method increment_string (line 141) | def increment_string(self):
    method decrement_string (line 144) | def decrement_string(self):
    method create_column_string (line 147) | def create_column_string(self):
    method column_exists_string (line 150) | def column_exists_string(self):
    method table_exists_string (line 153) | def table_exists_string(self):
    method create_column_length (line 156) | def create_column_length(self, column_type):
    method table_string (line 159) | def table_string(self):
    method order_by_format (line 162) | def order_by_format(self):
    method order_by_string (line 165) | def order_by_string(self):
    method column_string (line 168) | def column_string(self):
    method value_string (line 171) | def value_string(self):
    method join_string (line 174) | def join_string(self):
    method limit_string (line 177) | def limit_string(self, offset=False):
    method offset_string (line 180) | def offset_string(self):
    method first_where_string (line 183) | def first_where_string(self):
    method additional_where_string (line 186) | def additional_where_string(self):
    method or_where_string (line 189) | def or_where_string(self):
    method where_in_string (line 192) | def where_in_string(self):
    method value_equal_string (line 195) | def value_equal_string(self):
    method where_string (line 198) | def where_string(self):
    method having_string (line 201) | def having_string(self):
    method having_equality_string (line 204) | def having_equality_string(self):
    method where_null_string (line 207) | def where_null_string(self):
    method where_not_null_string (line 210) | def where_not_null_string(self):
    method enable_foreign_key_constraints (line 213) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 216) | def disable_foreign_key_constraints(self):
    method truncate_table (line 219) | def truncate_table(self, table, foreign_keys=False):
    method compile_random (line 237) | def compile_random(self):

FILE: src/masoniteorm/query/grammars/PostgresGrammar.py
  class PostgresGrammar (line 6) | class PostgresGrammar(BaseGrammar):
    method select_no_table (line 37) | def select_no_table(self):
    method select_format (line 40) | def select_format(self):
    method update_format (line 43) | def update_format(self):
    method insert_format (line 46) | def insert_format(self):
    method bulk_insert_format (line 49) | def bulk_insert_format(self):
    method delete_format (line 52) | def delete_format(self):
    method aggregate_string_with_alias (line 55) | def aggregate_string_with_alias(self):
    method aggregate_string_without_alias (line 58) | def aggregate_string_without_alias(self):
    method get_true_column_string (line 61) | def get_true_column_string(self):
    method get_false_column_string (line 64) | def get_false_column_string(self):
    method subquery_string (line 67) | def subquery_string(self):
    method raw_query_string (line 70) | def raw_query_string(self):
    method where_group_string (line 73) | def where_group_string(self):
    method between_string (line 76) | def between_string(self):
    method not_between_string (line 79) | def not_between_string(self):
    method where_exists_string (line 82) | def where_exists_string(self):
    method where_not_exists_string (line 85) | def where_not_exists_string(self):
    method where_like_string (line 88) | def where_like_string(self):
    method where_not_like_string (line 91) | def where_not_like_string(self):
    method subquery_alias_string (line 94) | def subquery_alias_string(self):
    method key_value_string (line 97) | def key_value_string(self):
    method column_value_string (line 100) | def column_value_string(self):
    method increment_string (line 103) | def increment_string(self):
    method decrement_string (line 106) | def decrement_string(self):
    method create_column_string (line 109) | def create_column_string(self):
    method column_exists_string (line 112) | def column_exists_string(self):
    method table_exists_string (line 115) | def table_exists_string(self):
    method create_column_length (line 120) | def create_column_length(self, column_type):
    method to_sql (line 125) | def to_sql(self):
    method table_string (line 146) | def table_string(self):
    method order_by_format (line 149) | def order_by_format(self):
    method order_by_string (line 152) | def order_by_string(self):
    method column_string (line 155) | def column_string(self):
    method value_string (line 158) | def value_string(self):
    method join_string (line 161) | def join_string(self):
    method limit_string (line 164) | def limit_string(self, offset=False):
    method offset_string (line 167) | def offset_string(self):
    method first_where_string (line 170) | def first_where_string(self):
    method additional_where_string (line 173) | def additional_where_string(self):
    method or_where_string (line 176) | def or_where_string(self):
    method where_in_string (line 179) | def where_in_string(self):
    method where_date_string (line 182) | def where_date_string(self):
    method value_equal_string (line 185) | def value_equal_string(self):
    method where_string (line 188) | def where_string(self):
    method having_string (line 191) | def having_string(self):
    method having_equality_string (line 194) | def having_equality_string(self):
    method where_null_string (line 197) | def where_null_string(self):
    method where_not_null_string (line 200) | def where_not_null_string(self):
    method truncate_table (line 203) | def truncate_table(self, table, foreign_keys=False):
    method compile_random (line 214) | def compile_random(self):

FILE: src/masoniteorm/query/grammars/SQLiteGrammar.py
  class SQLiteGrammar (line 6) | class SQLiteGrammar(BaseGrammar):
    method select_format (line 37) | def select_format(self):
    method select_no_table (line 40) | def select_no_table(self):
    method update_format (line 43) | def update_format(self):
    method insert_format (line 46) | def insert_format(self):
    method bulk_insert_format (line 49) | def bulk_insert_format(self):
    method delete_format (line 52) | def delete_format(self):
    method aggregate_string_with_alias (line 55) | def aggregate_string_with_alias(self):
    method aggregate_string_without_alias (line 58) | def aggregate_string_without_alias(self):
    method subquery_string (line 61) | def subquery_string(self):
    method default_string (line 64) | def default_string(self):
    method raw_query_string (line 67) | def raw_query_string(self):
    method where_group_string (line 70) | def where_group_string(self):
    method between_string (line 73) | def between_string(self):
    method not_between_string (line 76) | def not_between_string(self):
    method where_exists_string (line 79) | def where_exists_string(self):
    method where_not_exists_string (line 82) | def where_not_exists_string(self):
    method where_like_string (line 85) | def where_like_string(self):
    method where_not_like_string (line 88) | def where_not_like_string(self):
    method subquery_alias_string (line 91) | def subquery_alias_string(self):
    method key_value_string (line 94) | def key_value_string(self):
    method column_value_string (line 97) | def column_value_string(self):
    method increment_string (line 100) | def increment_string(self):
    method decrement_string (line 103) | def decrement_string(self):
    method column_exists_string (line 106) | def column_exists_string(self):
    method table_exists_string (line 109) | def table_exists_string(self):
    method to_sql (line 114) | def to_sql(self):
    method table_string (line 135) | def table_string(self):
    method order_by_format (line 138) | def order_by_format(self):
    method order_by_string (line 141) | def order_by_string(self):
    method column_string (line 144) | def column_string(self):
    method value_string (line 147) | def value_string(self):
    method join_string (line 150) | def join_string(self):
    method limit_string (line 153) | def limit_string(self, offset=False):
    method offset_string (line 158) | def offset_string(self):
    method first_where_string (line 161) | def first_where_string(self):
    method additional_where_string (line 164) | def additional_where_string(self):
    method or_where_string (line 167) | def or_where_string(self):
    method where_in_string (line 170) | def where_in_string(self):
    method where_string (line 173) | def where_string(self):
    method having_string (line 176) | def having_string(self):
    method having_equality_string (line 179) | def having_equality_string(self):
    method where_null_string (line 182) | def where_null_string(self):
    method where_date_string (line 185) | def where_date_string(self):
    method value_equal_string (line 188) | def value_equal_string(self):
    method where_not_null_string (line 191) | def where_not_null_string(self):
    method enable_foreign_key_constraints (line 194) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 197) | def disable_foreign_key_constraints(self):
    method get_true_column_string (line 200) | def get_true_column_string(self):
    method get_false_column_string (line 203) | def get_false_column_string(self):
    method truncate_table (line 206) | def truncate_table(self, table, foreign_keys=False):
    method compile_random (line 218) | def compile_random(self):
    method process_offset (line 221) | def process_offset(self):

FILE: src/masoniteorm/query/processors/MSSQLPostProcessor.py
  class MSSQLPostProcessor (line 1) | class MSSQLPostProcessor:
    method process_insert_get_id (line 14) | def process_insert_get_id(self, builder, results, id_key):
    method get_column_value (line 41) | def get_column_value(self, builder, column, results, id_key, id_value):

FILE: src/masoniteorm/query/processors/MySQLPostProcessor.py
  class MySQLPostProcessor (line 1) | class MySQLPostProcessor:
    method process_insert_get_id (line 12) | def process_insert_get_id(self, builder, results, id_key):
    method get_column_value (line 29) | def get_column_value(self, builder, column, results, id_key, id_value):

FILE: src/masoniteorm/query/processors/PostgresPostProcessor.py
  class PostgresPostProcessor (line 1) | class PostgresPostProcessor:
    method process_insert_get_id (line 14) | def process_insert_get_id(self, builder, results, id_key):
    method get_column_value (line 29) | def get_column_value(self, builder, column, results, id_key, id_value):

FILE: src/masoniteorm/query/processors/SQLitePostProcessor.py
  class SQLitePostProcessor (line 1) | class SQLitePostProcessor:
    method process_insert_get_id (line 12) | def process_insert_get_id(self, builder, results, id_key="id"):
    method get_column_value (line 30) | def get_column_value(self, builder, column, results, id_key, id_value):

FILE: src/masoniteorm/relationships/BaseRelationship.py
  class BaseRelationship (line 1) | class BaseRelationship:
    method __init__ (line 2) | def __init__(self, fn, local_key=None, foreign_key=None):
    method __set_name__ (line 12) | def __set_name__(self, cls, name):
    method __call__ (line 22) | def __call__(self, fn=None, *args, **kwargs):
    method get_builder (line 36) | def get_builder(self):
    method __get__ (line 39) | def __get__(self, instance, owner):
    method __getattr__ (line 65) | def __getattr__(self, attribute):
    method apply_query (line 69) | def apply_query(self, foreign, owner):
    method query_where_exists (line 84) | def query_where_exists(self, builder, callback, method="where_exists"):
    method joins (line 91) | def joins(self, builder, clause=None):
    method get_with_count_query (line 103) | def get_with_count_query(self, builder, callback):
    method attach (line 110) | def attach(self, current_model, related_record):
    method get_related (line 117) | def get_related(self, query, relation, eagers=None, callback=None):
    method relate (line 123) | def relate(self, related_record):
    method detach (line 129) | def detach(self, current_model, related_record):
    method attach_related (line 136) | def attach_related(self, current_model, related_record):
    method detach_related (line 143) | def detach_related(self, current_model, related_record):
    method query_has (line 150) | def query_has(self, current_query_builder, method="where_exists"):
    method map_related (line 157) | def map_related(self, related_result):

FILE: src/masoniteorm/relationships/BelongsTo.py
  class BelongsTo (line 5) | class BelongsTo(BaseRelationship):
    method __init__ (line 8) | def __init__(self, fn, local_key=None, foreign_key=None):
    method set_keys (line 18) | def set_keys(self, owner, attribute):
    method apply_query (line 23) | def apply_query(self, foreign, owner):
    method query_has (line 37) | def query_has(self, current_query_builder, method="where_exists"):
    method query_where_exists (line 49) | def query_where_exists(self, builder, callback, method="where_exists"):
    method get_related (line 61) | def get_related(self, query, relation, eagers=(), callback=None):
    method register_related (line 89) | def register_related(self, key, model, collection):
    method map_related (line 94) | def map_related(self, related_result):
    method attach (line 97) | def attach(self, current_model, related_record):
    method detach (line 105) | def detach(self, current_model, related_record):
    method relate (line 108) | def relate(self, related_record):

FILE: src/masoniteorm/relationships/BelongsToMany.py
  class BelongsToMany (line 9) | class BelongsToMany(BaseRelationship):
    method __init__ (line 12) | def __init__(
    method set_keys (line 44) | def set_keys(self, owner, attribute):
    method apply_query (line 49) | def apply_query(self, query, owner):
    method table (line 156) | def table(self, table):
    method make_builder (line 160) | def make_builder(self, eagers=None):
    method make_query (line 165) | def make_query(self, query, relation, eagers=None, callback=None):
    method get_related (line 248) | def get_related(self, query, relation, eagers=None, callback=None):
    method relate (line 292) | def relate(self, related_record):
    method register_related (line 352) | def register_related(self, key, model, collection):
    method joins (line 361) | def joins(self, builder, clause=None):
    method query_where_exists (line 423) | def query_where_exists(self, builder, callback, method="where_exists"):
    method query_has (line 446) | def query_has(self, builder, method="where_exists"):
    method get_pivot_table_name (line 465) | def get_pivot_table_name(self, query, builder):
    method get_with_count_query (line 473) | def get_with_count_query(self, builder, callback):
    method attach (line 505) | def attach(self, current_model, related_record):
    method detach (line 530) | def detach(self, current_model, related_record):
    method attach_related (line 548) | def attach_related(self, current_model, related_record):
    method detach_related (line 573) | def detach_related(self, current_model, related_record):

FILE: src/masoniteorm/relationships/HasMany.py
  class HasMany (line 5) | class HasMany(BaseRelationship):
    method apply_query (line 8) | def apply_query(self, foreign, owner):
    method set_keys (line 24) | def set_keys(self, owner, attribute):
    method register_related (line 29) | def register_related(self, key, model, collection):
    method map_related (line 34) | def map_related(self, related_result):
    method attach (line 37) | def attach(self, current_model, related_record):
    method get_related (line 45) | def get_related(self, query, relation, eagers=None, callback=None):

FILE: src/masoniteorm/relationships/HasManyThrough.py
  class HasManyThrough (line 5) | class HasManyThrough(BaseRelationship):
    method __init__ (line 8) | def __init__(
    method set_keys (line 29) | def set_keys(self, distant_builder, intermediary_builder, attribute):
    method __get__ (line 36) | def __get__(self, instance, owner):
    method apply_related_query (line 66) | def apply_related_query(self, distant_builder, intermediary_builder, o...
    method relate (line 102) | def relate(self, related_model):
    method get_builder (line 113) | def get_builder(self):
    method make_builder (line 116) | def make_builder(self, eagers=None):
    method register_related (line 121) | def register_related(self, key, model, collection):
    method get_related (line 139) | def get_related(self, current_builder, relation, eagers=None, callback...
    method query_has (line 182) | def query_has(self, current_builder, method="where_exists"):
    method query_where_exists (line 200) | def query_where_exists(self, current_builder, callback, method="where_...
    method get_with_count_query (line 218) | def get_with_count_query(self, current_builder, callback):
    method map_related (line 258) | def map_related(self, related_result):

FILE: src/masoniteorm/relationships/HasOne.py
  class HasOne (line 5) | class HasOne(BaseRelationship):
    method __init__ (line 8) | def __init__(self, fn, foreign_key=None, local_key=None):
    method set_keys (line 17) | def set_keys(self, owner, attribute):
    method apply_query (line 22) | def apply_query(self, foreign, owner):
    method get_related (line 37) | def get_related(self, query, relation, eagers=(), callback=None):
    method query_has (line 65) | def query_has(self, current_query_builder, method="where_exists"):
    method query_where_exists (line 77) | def query_where_exists(self, builder, callback, method="where_exists"):
    method register_related (line 89) | def register_related(self, key, model, collection):
    method map_related (line 96) | def map_related(self, related_result):
    method attach (line 99) | def attach(self, current_model, related_record):
    method detach (line 107) | def detach(self, current_model, related_record):

FILE: src/masoniteorm/relationships/HasOneThrough.py
  class HasOneThrough (line 5) | class HasOneThrough(BaseRelationship):
    method __init__ (line 8) | def __init__(
    method __getattr__ (line 29) | def __getattr__(self, attribute):
    method set_keys (line 33) | def set_keys(self, distant_builder, intermediary_builder, attribute):
    method __get__ (line 40) | def __get__(self, instance, owner):
    method apply_relation_query (line 71) | def apply_relation_query(self, distant_builder, intermediary_builder, ...
    method relate (line 107) | def relate(self, related_model):
    method get_builder (line 121) | def get_builder(self):
    method make_builder (line 124) | def make_builder(self, eagers=None):
    method register_related (line 129) | def register_related(self, key, model, collection):
    method get_related (line 145) | def get_related(self, current_builder, relation, eagers=None, callback...
    method query_has (line 188) | def query_has(self, current_builder, method="where_exists"):
    method query_where_exists (line 206) | def query_where_exists(self, current_builder, callback, method="where_...
    method get_with_count_query (line 224) | def get_with_count_query(self, current_builder, callback):
    method map_related (line 264) | def map_related(self, related_result):

FILE: src/masoniteorm/relationships/MorphMany.py
  class MorphMany (line 6) | class MorphMany(BaseRelationship):
    method __init__ (line 7) | def __init__(self, fn, morph_key="record_type", morph_id="record_id"):
    method get_builder (line 17) | def get_builder(self):
    method set_keys (line 20) | def set_keys(self, owner, attribute):
    method __get__ (line 25) | def __get__(self, instance, owner):
    method __getattr__ (line 50) | def __getattr__(self, attribute):
    method apply_query (line 54) | def apply_query(self, builder, instance):
    method get_related (line 72) | def get_related(self, query, relation, eagers=None, callback=None):
    method register_related (line 128) | def register_related(self, key, model, collection):
    method morph_map (line 136) | def morph_map(self):
    method get_record_key_lookup (line 139) | def get_record_key_lookup(self, relation):

FILE: src/masoniteorm/relationships/MorphOne.py
  class MorphOne (line 6) | class MorphOne(BaseRelationship):
    method __init__ (line 7) | def __init__(self, fn, morph_key="record_type", morph_id="record_id"):
    method get_builder (line 17) | def get_builder(self):
    method set_keys (line 20) | def set_keys(self, owner, attribute):
    method __get__ (line 25) | def __get__(self, instance, owner):
    method __getattr__ (line 50) | def __getattr__(self, attribute):
    method apply_query (line 54) | def apply_query(self, builder, instance):
    method get_related (line 73) | def get_related(self, query, relation, eagers=None, callback=None):
    method register_related (line 130) | def register_related(self, key, model, collection):
    method morph_map (line 140) | def morph_map(self):
    method get_record_key_lookup (line 143) | def get_record_key_lookup(self, relation):

FILE: src/masoniteorm/relationships/MorphTo.py
  class MorphTo (line 6) | class MorphTo(BaseRelationship):
    method __init__ (line 7) | def __init__(self, fn, morph_key="record_type", morph_id="record_id"):
    method get_builder (line 17) | def get_builder(self):
    method set_keys (line 20) | def set_keys(self, owner, attribute):
    method __get__ (line 25) | def __get__(self, instance, owner):
    method __getattr__ (line 49) | def __getattr__(self, attribute):
    method apply_query (line 53) | def apply_query(self, builder, instance):
    method get_related (line 68) | def get_related(self, query, relation, eagers=None, callback=None):
    method register_related (line 98) | def register_related(self, key, model, collection):
    method morph_map (line 107) | def morph_map(self):
    method map_related (line 110) | def map_related(self, related_result):

FILE: src/masoniteorm/relationships/MorphToMany.py
  class MorphToMany (line 6) | class MorphToMany(BaseRelationship):
    method __init__ (line 7) | def __init__(self, fn, morph_key="record_type", morph_id="record_id"):
    method get_builder (line 17) | def get_builder(self):
    method set_keys (line 20) | def set_keys(self, owner, attribute):
    method __get__ (line 25) | def __get__(self, instance, owner):
    method __getattr__ (line 49) | def __getattr__(self, attribute):
    method apply_query (line 53) | def apply_query(self, builder, instance):
    method get_related (line 68) | def get_related(self, query, relation, eagers=None, callback=None):
    method register_related (line 98) | def register_related(self, key, model, collection):
    method morph_map (line 107) | def morph_map(self):

FILE: src/masoniteorm/schema/Blueprint.py
  class Blueprint (line 1) | class Blueprint:
    method __init__ (line 4) | def __init__(
    method string (line 27) | def string(self, column, length=255, nullable=False):
    method tiny_integer (line 46) | def tiny_integer(self, column, length=1, nullable=False):
    method small_integer (line 64) | def small_integer(self, column, length=5, nullable=False):
    method medium_integer (line 82) | def medium_integer(self, column, length=7, nullable=False):
    method integer (line 100) | def integer(self, column, length=11, nullable=False):
    method big_integer (line 118) | def big_integer(self, column, length=32, nullable=False):
    method unsigned_big_integer (line 136) | def unsigned_big_integer(self, column, length=32, nullable=False):
    method _compile_create (line 151) | def _compile_create(self):
    method _compile_alter (line 154) | def _compile_alter(self):
    method increments (line 157) | def increments(self, column, nullable=False):
    method tiny_increments (line 176) | def tiny_increments(self, column, nullable=False):
    method id (line 195) | def id(self, column="id"):
    method uuid (line 206) | def uuid(self, column, nullable=False, length=36):
    method big_increments (line 223) | def big_increments(self, column, nullable=False):
    method binary (line 242) | def binary(self, column, nullable=False):
    method boolean (line 257) | def boolean(self, column, nullable=False):
    method default (line 272) | def default(self, value, raw=False):
    method default_raw (line 277) | def default_raw(self, value):
    method char (line 281) | def char(self, column, length=1, nullable=False):
    method date (line 299) | def date(self, column, nullable=False):
    method time (line 314) | def time(self, column, nullable=False):
    method datetime (line 329) | def datetime(self, column, nullable=False, now=False):
    method timestamp (line 350) | def timestamp(self, column, nullable=False, now=False):
    method timestamps (line 373) | def timestamps(self):
    method decimal (line 385) | def decimal(self, column, length=17, precision=6, nullable=False):
    method float (line 408) | def float(self, column, length=19, precision=4, nullable=False):
    method double (line 430) | def double(self, column, nullable=False):
    method enum (line 445) | def enum(self, column, options=None, nullable=False):
    method text (line 469) | def text(self, column, length=None, nullable=False):
    method tiny_text (line 487) | def tiny_text(self, column, length=None, nullable=False):
    method unsigned_decimal (line 505) | def unsigned_decimal(self, column, length=17, precision=6, nullable=Fa...
    method long_text (line 527) | def long_text(self, column, length=None, nullable=False):
    method json (line 545) | def json(self, column, nullable=False):
    method jsonb (line 560) | def jsonb(self, column, nullable=False):
    method inet (line 575) | def inet(self, column, length=255, nullable=False):
    method cidr (line 592) | def cidr(self, column, length=255, nullable=False):
    method macaddr (line 609) | def macaddr(self, column, length=255, nullable=False):
    method point (line 626) | def point(self, column, nullable=False):
    method geometry (line 641) | def geometry(self, column, nullable=False):
    method year (line 656) | def year(self, column, length=4, default=None, nullable=False):
    method unsigned (line 673) | def unsigned(self, column=None, length=None, nullable=False):
    method unsigned_integer (line 695) | def unsigned_integer(self, column, nullable=False):
    method morphs (line 712) | def morphs(self, column, nullable=False, indexes=True):
    method to_sql (line 746) | def to_sql(self):
    method __enter__ (line 766) | def __enter__(self):
    method __exit__ (line 769) | def __exit__(self, exc_type, exc_value, exc_traceback):
    method nullable (line 774) | def nullable(self):
    method soft_deletes (line 788) | def soft_deletes(self, name="deleted_at"):
    method unique (line 791) | def unique(self, column=None, name=None):
    method index (line 816) | def index(self, column=None, name=None):
    method fulltext (line 837) | def fulltext(self, column=None, name=None):
    method primary (line 858) | def primary(self, column=None, name=None):
    method add_foreign (line 882) | def add_foreign(self, columns, name=None):
    method foreign (line 896) | def foreign(self, column, name=None):
    method foreign_id (line 910) | def foreign_id(self, column):
    method foreign_uuid (line 921) | def foreign_uuid(self, column):
    method foreign_id_for (line 932) | def foreign_id_for(self, model, column=None):
    method references (line 949) | def references(self, column):
    method on (line 961) | def on(self, table):
    method on_delete (line 973) | def on_delete(self, action):
    method on_update (line 985) | def on_update(self, action):
    method comment (line 997) | def comment(self, comment):
    method table_comment (line 1001) | def table_comment(self, comment):
    method rename (line 1005) | def rename(self, old_column, new_column, data_type, length=None):
    method after (line 1018) | def after(self, old_column):
    method drop_column (line 1032) | def drop_column(self, *columns):
    method drop_index (line 1043) | def drop_index(self, index):
    method change (line 1062) | def change(self):
    method drop_unique (line 1066) | def drop_unique(self, index):
    method drop_primary (line 1083) | def drop_primary(self, index):
    method drop_foreign (line 1100) | def drop_foreign(self, index):

FILE: src/masoniteorm/schema/Column.py
  class Column (line 1) | class Column:
    method __init__ (line 4) | def __init__(
    method nullable (line 30) | def nullable(self):
    method signed (line 39) | def signed(self):
    method unsigned (line 48) | def unsigned(self):
    method not_nullable (line 57) | def not_nullable(self):
    method set_as_primary (line 66) | def set_as_primary(self):
    method rename (line 69) | def rename(self, column):
    method after (line 81) | def after(self, after):
    method get_after_column (line 95) | def get_after_column(self):
    method default (line 108) | def default(self, value, raw=False):
    method change (line 122) | def change(self):
    method use_current (line 131) | def use_current(self):
    method add_comment (line 142) | def add_comment(self, comment):

FILE: src/masoniteorm/schema/Constraint.py
  class Constraint (line 1) | class Constraint:
    method __init__ (line 2) | def __init__(self, name, constraint_type, columns=None):

FILE: src/masoniteorm/schema/ForeignKeyConstraint.py
  class ForeignKeyConstraint (line 1) | class ForeignKeyConstraint:
    method __init__ (line 2) | def __init__(self, column, foreign_table, foreign_column, name=None):
    method references (line 10) | def references(self, foreign_column):
    method on (line 14) | def on(self, foreign_table):
    method on_delete (line 18) | def on_delete(self, action):
    method on_update (line 22) | def on_update(self, action):
    method name (line 26) | def name(self, name):

FILE: src/masoniteorm/schema/Index.py
  class Index (line 1) | class Index:
    method __init__ (line 2) | def __init__(self, column, name, index_type):

FILE: src/masoniteorm/schema/Schema.py
  class Schema (line 8) | class Schema:
    method __init__ (line 51) | def __init__(
    method on (line 80) | def on(self, connection_key):
    method dry (line 110) | def dry(self):
    method create (line 119) | def create(self, table):
    method create_table_if_not_exists (line 145) | def create_table_if_not_exists(self, table):
    method table (line 161) | def table(self, table):
    method get_connection_information (line 187) | def get_connection_information(self):
    method new_connection (line 205) | def new_connection(self):
    method has_column (line 217) | def has_column(self, table, column, query_only=False):
    method get_columns (line 234) | def get_columns(self, table, dict=True):
    method set_default_string_length (line 247) | def set_default_string_length(cls, length):
    method drop_table (line 251) | def drop_table(self, table, query_only=False):
    method drop (line 260) | def drop(self, *args, **kwargs):
    method drop_table_if_exists (line 263) | def drop_table_if_exists(self, table, exists=False, query_only=False):
    method rename (line 272) | def rename(self, table, new_name):
    method truncate (line 281) | def truncate(self, table, foreign_keys=False):
    method get_schema (line 290) | def get_schema(self):
    method get_all_tables (line 296) | def get_all_tables(self):
    method has_table (line 311) | def has_table(self, table, query_only=False):
    method enable_foreign_key_constraints (line 330) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 339) | def disable_foreign_key_constraints(self):

FILE: src/masoniteorm/schema/Table.py
  class Table (line 7) | class Table:
    method __init__ (line 8) | def __init__(self, table):
    method add_column (line 20) | def add_column(
    method add_constraint (line 49) | def add_constraint(self, name, constraint_type, columns=None):
    method add_foreign_key (line 54) | def add_foreign_key(self, column, table=None, foreign_column=None, nam...
    method get_added_foreign_keys (line 62) | def get_added_foreign_keys(self):
    method get_constraint (line 65) | def get_constraint(self, name):
    method get_added_constraints (line 68) | def get_added_constraints(self):
    method get_added_columns (line 71) | def get_added_columns(self):
    method get_renamed_columns (line 74) | def get_renamed_columns(self):
    method set_primary_key (line 77) | def set_primary_key(self, columns):
    method add_index (line 81) | def add_index(self, column, name, index_type):
    method get_index (line 84) | def get_index(self, name):
    method add_comment (line 87) | def add_comment(self, comment):

FILE: src/masoniteorm/schema/TableDiff.py
  class TableDiff (line 5) | class TableDiff(Table):
    method __init__ (line 6) | def __init__(self, name):
    method remove_constraint (line 24) | def remove_constraint(self, name):
    method get_removed_constraints (line 27) | def get_removed_constraints(self):
    method get_renamed_columns (line 30) | def get_renamed_columns(self):
    method rename_column (line 33) | def rename_column(
    method remove_index (line 54) | def remove_index(self, name):
    method remove_unique_index (line 57) | def remove_unique_index(self, name):
    method drop_column (line 60) | def drop_column(self, name):
    method get_dropped_columns (line 63) | def get_dropped_columns(self):
    method get_dropped_foreign_keys (line 66) | def get_dropped_foreign_keys(self):
    method drop_foreign (line 69) | def drop_foreign(self, name):
    method drop_primary (line 73) | def drop_primary(self, name):
    method change_column (line 77) | def change_column(self, added_column):
    method add_comment (line 82) | def add_comment(self, comment):

FILE: src/masoniteorm/schema/platforms/MSSQLPlatform.py
  class MSSQLPlatform (line 5) | class MSSQLPlatform(Platform):
    method compile_create_sql (line 64) | def compile_create_sql(self, table, if_not_exists=False):
    method compile_alter_sql (line 108) | def compile_alter_sql(self, table):
    method add_column_string (line 218) | def add_column_string(self):
    method drop_column_string (line 221) | def drop_column_string(self):
    method rename_column_string (line 224) | def rename_column_string(self, table, old, new):
    method columnize (line 227) | def columnize(self, columns):
    method columnize_string (line 276) | def columnize_string(self):
    method constraintize (line 279) | def constraintize(self, constraints, table):
    method get_table_string (line 295) | def get_table_string(self):
    method get_column_string (line 298) | def get_column_string(self):
    method create_format (line 301) | def create_format(self):
    method create_if_not_exists_format (line 304) | def create_if_not_exists_format(self):
    method alter_format (line 309) | def alter_format(self):
    method get_foreign_key_constraint_string (line 312) | def get_foreign_key_constraint_string(self):
    method get_primary_key_constraint_string (line 315) | def get_primary_key_constraint_string(self):
    method get_unique_constraint_string (line 318) | def get_unique_constraint_string(self):
    method compile_table_exists (line 321) | def compile_table_exists(self, table, database=None, schema=None):
    method compile_truncate (line 324) | def compile_truncate(self, table, foreign_keys=False):
    method compile_rename_table (line 334) | def compile_rename_table(self, current_name, new_name):
    method compile_drop_table_if_exists (line 337) | def compile_drop_table_if_exists(self, table):
    method compile_drop_table (line 340) | def compile_drop_table(self, table):
    method compile_column_exists (line 343) | def compile_column_exists(self, table, column):
    method compile_get_all_tables (line 346) | def compile_get_all_tables(self, database, schema=None):
    method get_current_schema (line 349) | def get_current_schema(self, connection, table_name, schema=None):
    method enable_foreign_key_constraints (line 352) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 356) | def disable_foreign_key_constraints(self):

FILE: src/masoniteorm/schema/platforms/MySQLPlatform.py
  class MySQLPlatform (line 7) | class MySQLPlatform(Platform):
    method columnize (line 61) | def columnize(self, columns):
    method compile_create_sql (line 115) | def compile_create_sql(self, table, if_not_exists=False):
    method compile_alter_sql (line 160) | def compile_alter_sql(self, table):
    method add_column_string (line 353) | def add_column_string(self):
    method drop_column_string (line 356) | def drop_column_string(self):
    method change_column_string (line 359) | def change_column_string(self):
    method rename_column_string (line 362) | def rename_column_string(self):
    method columnize_string (line 365) | def columnize_string(self):
    method constraintize (line 368) | def constraintize(self, constraints, table):
    method get_table_string (line 384) | def get_table_string(self):
    method get_column_string (line 387) | def get_column_string(self):
    method create_format (line 390) | def create_format(self):
    method create_if_not_exists_format (line 393) | def create_if_not_exists_format(self):
    method alter_format (line 396) | def alter_format(self):
    method get_foreign_key_constraint_string (line 399) | def get_foreign_key_constraint_string(self):
    method get_primary_key_constraint_string (line 402) | def get_primary_key_constraint_string(self):
    method get_unique_constraint_string (line 405) | def get_unique_constraint_string(self):
    method compile_table_exists (line 408) | def compile_table_exists(self, table, database=None, schema=None):
    method compile_truncate (line 411) | def compile_truncate(self, table, foreign_keys=False):
    method compile_rename_table (line 421) | def compile_rename_table(self, current_name, new_name):
    method compile_drop_table_if_exists (line 424) | def compile_drop_table_if_exists(self, table):
    method compile_drop_table (line 427) | def compile_drop_table(self, table):
    method compile_column_exists (line 430) | def compile_column_exists(self, table, column):
    method compile_get_all_tables (line 433) | def compile_get_all_tables(self, database, schema=None):
    method get_current_schema (line 436) | def get_current_schema(self, connection, table_name, schema=None):
    method get_column_type (line 458) | def get_column_type(self, reversed_type_map, column_type):
    method get_column_length (line 477) | def get_column_length(self, raw_column_type):
    method enable_foreign_key_constraints (line 489) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 492) | def disable_foreign_key_constraints(self):

FILE: src/masoniteorm/schema/platforms/Platform.py
  class Platform (line 1) | class Platform:
    method columnize (line 13) | def columnize(self, columns):
    method columnize_string (line 50) | def columnize_string(self):
    method create_column_length (line 53) | def create_column_length(self, column_type):
    method foreign_key_constraintize (line 58) | def foreign_key_constraintize(self, table, foreign_keys):
    method constraintize (line 78) | def constraintize(self, constraints):
    method wrap_table (line 88) | def wrap_table(self, table_name):
    method wrap_column (line 91) | def wrap_column(self, column_name):

FILE: src/masoniteorm/schema/platforms/PostgresPlatform.py
  class PostgresPlatform (line 6) | class PostgresPlatform(Platform):
    method compile_create_sql (line 76) | def compile_create_sql(self, table, if_not_exists=False):
    method columnize (line 129) | def columnize(self, columns):
    method compile_alter_sql (line 178) | def compile_alter_sql(self, table):
    method alter_format (line 400) | def alter_format(self):
    method alter_format_add_foreign_key (line 403) | def alter_format_add_foreign_key(self):
    method add_column_string (line 406) | def add_column_string(self):
    method drop_column_string (line 409) | def drop_column_string(self):
    method modify_column_string (line 412) | def modify_column_string(self):
    method rename_column_string (line 415) | def rename_column_string(self):
    method columnize_string (line 418) | def columnize_string(self):
    method constraintize (line 421) | def constraintize(self, constraints, table):
    method create_format (line 436) | def create_format(self):
    method create_if_not_exists_format (line 439) | def create_if_not_exists_format(self):
    method get_foreign_key_constraint_string (line 444) | def get_foreign_key_constraint_string(self):
    method get_primary_key_constraint_string (line 447) | def get_primary_key_constraint_string(self):
    method get_unique_constraint_string (line 450) | def get_unique_constraint_string(self):
    method get_table_string (line 453) | def get_table_string(self):
    method get_column_string (line 456) | def get_column_string(self):
    method table_information_string (line 459) | def table_information_string(self):
    method compile_table_exists (line 462) | def compile_table_exists(self, table, database=None, schema=None):
    method compile_truncate (line 465) | def compile_truncate(self, table, foreign_keys=False):
    method compile_rename_table (line 475) | def compile_rename_table(self, current_name, new_name):
    method compile_drop_table_if_exists (line 478) | def compile_drop_table_if_exists(self, table):
    method compile_drop_table (line 481) | def compile_drop_table(self, table):
    method compile_column_exists (line 484) | def compile_column_exists(self, table, column):
    method compile_get_all_tables (line 487) | def compile_get_all_tables(self, database=None, schema=None):
    method get_current_schema (line 490) | def get_current_schema(self, connection, table_name, schema=None):
    method enable_foreign_key_constraints (line 529) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 533) | def disable_foreign_key_constraints(self):

FILE: src/masoniteorm/schema/platforms/SQLitePlatform.py
  class SQLitePlatform (line 6) | class SQLitePlatform(Platform):
    method compile_create_sql (line 66) | def compile_create_sql(self, table, if_not_exists=False):
    method columnize (line 103) | def columnize(self, columns):
    method compile_alter_sql (line 158) | def compile_alter_sql(self, diff):
    method create_format (line 300) | def create_format(self):
    method create_if_not_exists_format (line 303) | def create_if_not_exists_format(self):
    method get_table_string (line 308) | def get_table_string(self):
    method get_column_string (line 311) | def get_column_string(self):
    method add_column_string (line 314) | def add_column_string(self):
    method create_column_length (line 317) | def create_column_length(self, column_type):
    method columnize_string (line 322) | def columnize_string(self):
    method get_unique_constraint_string (line 325) | def get_unique_constraint_string(self):
    method get_foreign_key_constraint_string (line 328) | def get_foreign_key_constraint_string(self):
    method get_primary_key_constraint_string (line 331) | def get_primary_key_constraint_string(self):
    method constraintize (line 334) | def constraintize(self, constraints):
    method foreign_key_constraintize (line 347) | def foreign_key_constraintize(self, table, foreign_keys):
    method columnize_names (line 367) | def columnize_names(self, columns):
    method get_current_schema (line 374) | def get_current_schema(self, connection, table_name, schema=None):
    method get_column_length (line 405) | def get_column_length(self, column_type):
    method get_column_type (line 412) | def get_column_type(self, reversed_type_map, column_type):
    method compile_table_exists (line 432) | def compile_table_exists(self, table, database=None, schema=None):
    method compile_column_exists (line 435) | def compile_column_exists(self, table, column):
    method compile_get_all_tables (line 438) | def compile_get_all_tables(self, database, schema=None):
    method compile_truncate (line 441) | def compile_truncate(self, table, foreign_keys=False):
    method compile_rename_table (line 451) | def compile_rename_table(self, current_table, new_name):
    method compile_drop_table_if_exists (line 454) | def compile_drop_table_if_exists(self, current_table):
    method compile_drop_table (line 457) | def compile_drop_table(self, current_table):
    method enable_foreign_key_constraints (line 460) | def enable_foreign_key_constraints(self):
    method disable_foreign_key_constraints (line 463) | def disable_foreign_key_constraints(self):

FILE: src/masoniteorm/scopes/BaseScope.py
  class BaseScope (line 1) | class BaseScope:
    method on_boot (line 2) | def on_boot(self, builder):
    method on_remove (line 5) | def on_remove(self, builder):

FILE: src/masoniteorm/scopes/SoftDeleteScope.py
  class SoftDeleteScope (line 4) | class SoftDeleteScope(BaseScope):
    method __init__ (line 7) | def __init__(self, deleted_at_column="deleted_at"):
    method on_boot (line 10) | def on_boot(self, builder):
    method on_remove (line 20) | def on_remove(self, builder):
    method _where_null (line 24) | def _where_null(self, builder):
    method _with_trashed (line 29) | def _with_trashed(self, model, builder):
    method _only_trashed (line 33) | def _only_trashed(self, model, builder):
    method _force_delete (line 37) | def _force_delete(self, model, builder, query=False):
    method _restore (line 42) | def _restore(self, model, builder):
    method _query_set_null_on_delete (line 45) | def _query_set_null_on_delete(self, builder):

FILE: src/masoniteorm/scopes/SoftDeletesMixin.py
  class SoftDeletesMixin (line 4) | class SoftDeletesMixin:
    method boot_SoftDeletesMixin (line 9) | def boot_SoftDeletesMixin(self, builder):
    method get_deleted_at_column (line 12) | def get_deleted_at_column(self):

FILE: src/masoniteorm/scopes/TimeStampsMixin.py
  class TimeStampsMixin (line 4) | class TimeStampsMixin:
    method boot_TimeStampsMixin (line 7) | def boot_TimeStampsMixin(self, builder):
    method activate_timestamps (line 10) | def activate_timestamps(self, boolean=True):

FILE: src/masoniteorm/scopes/TimeStampsScope.py
  class TimeStampsScope (line 5) | class TimeStampsScope(BaseScope):
    method on_boot (line 8) | def on_boot(self, builder):
    method on_remove (line 17) | def on_remove(self, builder):
    method set_timestamp (line 20) | def set_timestamp(owner_cls, query):
    method set_timestamp_create (line 23) | def set_timestamp_create(self, builder):
    method set_timestamp_update (line 34) | def set_timestamp_update(self, builder):

FILE: src/masoniteorm/scopes/UUIDPrimaryKeyMixin.py
  class UUIDPrimaryKeyMixin (line 4) | class UUIDPrimaryKeyMixin:
    method boot_UUIDPrimaryKeyMixin (line 7) | def boot_UUIDPrimaryKeyMixin(self, builder):

FILE: src/masoniteorm/scopes/UUIDPrimaryKeyScope.py
  class UUIDPrimaryKeyScope (line 6) | class UUIDPrimaryKeyScope(BaseScope):
    method on_boot (line 9) | def on_boot(self, builder):
    method on_remove (line 17) | def on_remove(self, builder):
    method generate_uuid (line 20) | def generate_uuid(self, builder, uuid_version, bytes=False):
    method build_uuid_pk (line 29) | def build_uuid_pk(self, builder):
    method set_uuid_create (line 38) | def set_uuid_create(self, builder):
    method set_bulk_uuid_create (line 43) | def set_bulk_uuid_create(self, builder):

FILE: src/masoniteorm/scopes/scope.py
  class scope (line 1) | class scope:
    method __init__ (line 2) | def __init__(self, callback, *params, **kwargs):
    method __set_name__ (line 5) | def __set_name__(self, cls, name):
    method __call__ (line 12) | def __call__(self, *args, **kwargs):

FILE: src/masoniteorm/seeds/Seeder.py
  class Seeder (line 4) | class Seeder:
    method __init__ (line 5) | def __init__(self, dry=False, seed_path="databases/seeds", connection=...
    method call (line 12) | def call(self, *seeder_classes):
    method run_database_seed (line 18) | def run_database_seed(self):
    method run_specific_seed (line 28) | def run_specific_seed(self, seed):

FILE: src/masoniteorm/testing/BaseTestCaseSelectGrammar.py
  class MockConnection (line 8) | class MockConnection:
    method make_connection (line 11) | def make_connection(self):
  class BaseTestCaseSelectGrammar (line 15) | class BaseTestCaseSelectGrammar:
    method setUp (line 16) | def setUp(self):
    method test_can_compile_select (line 25) | def test_can_compile_select(self):
    method test_can_compile_order_by_and_first (line 33) | def test_can_compile_order_by_and_first(self):
    method test_can_compile_with_columns (line 41) | def test_can_compile_with_columns(self):
    method test_can_compile_with_where (line 48) | def test_can_compile_with_where(self):
    method test_can_compile_or_where (line 55) | def test_can_compile_or_where(self):
    method test_can_grouped_where (line 62) | def test_can_grouped_where(self):
    method test_can_compile_with_several_where (line 71) | def test_can_compile_with_several_where(self):
    method test_can_compile_with_several_where_and_limit (line 83) | def test_can_compile_with_several_where_and_limit(self):
    method test_can_compile_with_sum (line 96) | def test_can_compile_with_sum(self):
    method test_can_compile_with_max (line 103) | def test_can_compile_with_max(self):
    method test_can_compile_with_max_and_columns (line 110) | def test_can_compile_with_max_and_columns(self):
    method test_can_compile_with_max_and_columns_different_order (line 117) | def test_can_compile_with_max_and_columns_different_order(self):
    method test_can_compile_with_order_by (line 124) | def test_can_compile_with_order_by(self):
    method test_can_compile_with_multiple_order_by (line 131) | def test_can_compile_with_multiple_order_by(self):
    method test_can_compile_with_group_by (line 143) | def test_can_compile_with_group_by(self):
    method test_can_compile_where_in (line 150) | def test_can_compile_where_in(self):
    method test_can_compile_where_in_empty (line 157) | def test_can_compile_where_in_empty(self):
    method test_can_compile_where_not_in (line 164) | def test_can_compile_where_not_in(self):
    method test_can_compile_where_null (line 171) | def test_can_compile_where_null(self):
    method test_can_compile_where_not_null (line 178) | def test_can_compile_where_not_null(self):
    method test_can_compile_count (line 185) | def test_can_compile_count(self):
    method test_can_compile_count_column (line 192) | def test_can_compile_count_column(self):
    method test_can_compile_where_column (line 199) | def test_can_compile_where_column(self):
    method test_can_compile_sub_select (line 206) | def test_can_compile_sub_select(self):
    method test_can_compile_complex_sub_select (line 215) | def test_can_compile_complex_sub_select(self):
    method test_can_compile_sub_select_where (line 229) | def test_can_compile_sub_select_where(self):
    method test_can_compile_sub_select_from_lambda (line 238) | def test_can_compile_sub_select_from_lambda(self):
    method test_can_compile_sub_select_value (line 249) | def test_can_compile_sub_select_value(self):
    method test_can_compile_exists (line 256) | def test_can_compile_exists(self):
    method test_can_compile_not_exists (line 267) | def test_can_compile_not_exists(self):
    method test_can_compile_having (line 278) | def test_can_compile_having(self):
    method test_can_compile_having_with_expression (line 285) | def test_can_compile_having_with_expression(self):
    method test_can_compile_having_with_greater_than_expression (line 292) | def test_can_compile_having_with_greater_than_expression(self):
    method test_can_compile_join (line 299) | def test_can_compile_join(self):
    method test_can_compile_join_clause (line 308) | def test_can_compile_join_clause(self):
    method test_can_compile_join_clause_with_value (line 323) | def test_can_compile_join_clause_with_value(self):
    method test_can_compile_join_clause_with_null (line 336) | def test_can_compile_join_clause_with_null(self):
    method test_can_compile_join_clause_with_not_null (line 350) | def test_can_compile_join_clause_with_not_null(self):
    method test_can_compile_join_clause_with_lambda (line 364) | def test_can_compile_join_clause_with_lambda(self):
    method test_can_compile_left_join_clause_with_lambda (line 375) | def test_can_compile_left_join_clause_with_lambda(self):
    method test_can_compile_right_join_clause_with_lambda (line 386) | def test_can_compile_right_join_clause_with_lambda(self):
    method test_can_compile_left_join (line 397) | def test_can_compile_left_join(self):
    method test_can_compile_multiple_join (line 406) | def test_can_compile_multiple_join(self):
    method test_can_compile_limit_and_offset (line 417) | def test_can_compile_limit_and_offset(self):
    method test_can_compile_between (line 424) | def test_can_compile_between(self):
    method test_can_compile_not_between (line 431) | def test_can_compile_not_between(self):
    method test_can_user_where_raw_and_where (line 438) | def test_can_user_where_raw_and_where(self):
    method test_can_compile_where_raw_and_where_with_multiple_bindings (line 447) | def test_can_compile_where_raw_and_where_with_multiple_bindings(self):
    method test_can_compile_first_or_fail (line 457) | def test_can_compile_first_or_fail(self):
    method test_where_like (line 466) | def test_where_like(self):
    method test_where_regexp (line 473) | def test_where_regexp(self):
    method test_where_exists_with_lambda (line 480) | def test_where_exists_with_lambda(self):
    method test_where_not_exists_with_lambda (line 488) | def test_where_not_exists_with_lambda(self):
    method test_where_not_regexp (line 496) | def test_where_not_regexp(self):
    method test_where_not_like (line 503) | def test_where_not_like(self):
    method test_shared_lock (line 510) | def test_shared_lock(self):
    method test_update_lock (line 517) | def test_update_lock(self):
    method test_where_date (line 524) | def test_where_date(self):
    method test_or_where_null (line 531) | def test_or_where_null(self):
    method test_select_distinct (line 538) | def test_select_distinct(self):

FILE: tests/User.py
  class User (line 6) | class User(Model):
    method meta (line 16) | def meta(self):

FILE: tests/collection/test_collection.py
  class TestCollection (line 9) | class TestCollection(unittest.TestCase):
    method test_take (line 10) | def test_take(self):
    method test_first (line 14) | def test_first(self):
    method test_last (line 20) | def test_last(self):
    method test_pluck (line 25) | def test_pluck(self):
    method test_pluck_with_models (line 31) | def test_pluck_with_models(self):
    method test_where (line 36) | def test_where(self):
    method test_where_in (line 51) | def test_where_in(self):
    method test_where_not_in (line 69) | def test_where_not_in(self):
    method test_where_in_bool (line 87) | def test_where_in_bool(self):
    method test_where_in_bytes (line 112) | def test_where_in_bytes(self):
    method test_pop (line 129) | def test_pop(self):
    method test_is_empty (line 134) | def test_is_empty(self):
    method test_sum (line 140) | def test_sum(self):
    method test_avg (line 165) | def test_avg(self):
    method test_max (line 190) | def test_max(self):
    method test_min (line 208) | def test_min(self):
    method test_count (line 226) | def test_count(self):
    method test_chunk (line 235) | def test_chunk(self):
    method test_collapse (line 265) | def test_collapse(self):
    method test_get (line 272) | def test_get(self):
    method test_merge (line 280) | def test_merge(self):
    method test_reduce (line 285) | def test_reduce(self):
    method test_forget (line 297) | def test_forget(self):
    method test_prepend (line 307) | def test_prepend(self):
    method test_pull (line 314) | def test_pull(self):
    method test_push (line 321) | def test_push(self):
    method test_put (line 328) | def test_put(self):
    method test_reject (line 335) | def test_reject(self):
    method test_for_page (line 362) | def test_for_page(self):
    method test_unique (line 368) | def test_unique(self):
    method test_transform (line 398) | def test_transform(self):
    method test_shift (line 404) | def test_shift(self):
    method test_sort (line 431) | def test_sort(self):
    method test_reverse (line 437) | def test_reverse(self):
    method test_zip (line 461) | def test_zip(self):
    method test_diff (line 467) | def test_diff(self):
    method test_each (line 473) | def test_each(self):
    method test_every (line 478) | def test_every(self):
    method test_filter (line 485) | def test_filter(self):
    method test_implode (line 490) | def test_implode(self):
    method test_map_into (line 501) | def test_map_into(self):
    method test_map (line 516) | def test_map(self):
    method test_serialize (line 542) | def test_serialize(self):
    method test_json (line 573) | def test_json(self):
    method test_contains (line 590) | def test_contains(self):
    method test_all (line 609) | def test_all(self):
    method test_flatten (line 629) | def test_flatten(self):
    method test_group_by (line 635) | def test_group_by(self):
    method test_serialize_with_model_appends (line 655) | def test_serialize_with_model_appends(self):
    method test_serialize_with_on_the_fly_appends (line 660) | def test_serialize_with_on_the_fly_appends(self):
    method test_random (line 664) | def test_random(self):
    method test_random_with_count (line 677) | def test_random_with_count(self):
    method test_make_comparison (line 690) | def test_make_comparison(self):
    method test_eq (line 695) | def test_eq(self):

FILE: tests/commands/test_shell.py
  class TestShellCommand (line 7) | class TestShellCommand(unittest.TestCase):
    method setUp (line 8) | def setUp(self):
    method test_for_mysql (line 12) | def test_for_mysql(self):
    method test_for_postgres (line 29) | def test_for_postgres(self):
    method test_for_sqlite (line 44) | def test_for_sqlite(self):
    method test_for_mssql (line 53) | def test_for_mssql(self):
    method test_running_command_with_sqlite (line 70) | def test_running_command_with_sqlite(self):
    method test_hiding_sensitive_options (line 76) | def test_hiding_sensitive_options(self):

FILE: tests/config/test_db_url.py
  class TestDbUrlHelper (line 10) | class TestDbUrlHelper(unittest.TestCase):
    method setUp (line 11) | def setUp(self):
    method test_parse_env_by_default (line 17) | def test_parse_env_by_default(self):
    method test_parse_sqlite (line 27) | def test_parse_sqlite(self):
    method test_parse_mysql (line 42) | def test_parse_mysql(self):
    method test_parse_postgres (line 56) | def test_parse_postgres(self):
    method test_parse_mssql (line 72) | def test_parse_mssql(self):
    method test_parse_with_params (line 86) | def test_parse_with_params(self):
    method test_using_it_with_connection_resolver (line 105) | def test_using_it_with_connection_resolver(self):

FILE: tests/connections/test_base_connections.py
  class TestDefaultBehaviorConnections (line 7) | class TestDefaultBehaviorConnections(unittest.TestCase):
    method test_should_return_connection_with_enabled_logs (line 8) | def test_should_return_connection_with_enabled_logs(self):
    method test_should_disable_log_queries_in_connection (line 15) | def test_should_disable_log_queries_in_connection(self):

FILE: tests/eagers/test_eager.py
  class TestEagerRelation (line 7) | class TestEagerRelation(unittest.TestCase):
    method test_can_register_string_eager_load (line 8) | def test_can_register_string_eager_load(self):
    method test_can_register_tuple_eager_load (line 32) | def test_can_register_tuple_eager_load(self):
    method test_can_register_list_eager_load (line 45) | def test_can_register_list_eager_load(self):

FILE: tests/factories/test_factories.py
  class User (line 9) | class User(Model):
  class AfterCreatedModel (line 13) | class AfterCreatedModel(Model):
  class TestFactories (line 18) | class TestFactories(unittest.TestCase):
    method setUp (line 19) | def setUp(self):
    method user_factory (line 25) | def user_factory(self, faker):
    method named_user_factory (line 28) | def named_user_factory(self, faker):
    method after_creating (line 31) | def after_creating(self, model, faker):
    method test_can_make_single (line 34) | def test_can_make_single(self):
    method test_can_make_several (line 40) | def test_can_make_several(self):
    method test_can_make_any_number (line 45) | def test_can_make_any_number(self):
    method test_can_make_named_factory (line 50) | def test_can_make_named_factory(self):
    method test_after_creates (line 54) | def test_after_creates(self):

FILE: tests/models/test_models.py
  class ModelTest (line 10) | class ModelTest(Model):
  class FillableModelTest (line 21) | class FillableModelTest(Model):
  class InvalidFillableGuardedModelTest (line 25) | class InvalidFillableGuardedModelTest(Model):
  class InvalidFillableGuardedChildModelTest (line 30) | class InvalidFillableGuardedChildModelTest(ModelTest):
  class ModelTestForced (line 35) | class ModelTestForced(Model):
  class BaseModel (line 39) | class BaseModel(Model):
    method get_selects (line 41) | def get_selects(self):
  class ModelWithBaseModel (line 44) | class ModelWithBaseModel(BaseModel):
  class TestModels (line 47) | class TestModels(unittest.TestCase):
    method test_model_can_access_str_dates_as_pendulum (line 48) | def test_model_can_access_str_dates_as_pendulum(self):
    method test_model_can_access_str_dates_as_pendulum_from_correct_datetimes (line 55) | def test_model_can_access_str_dates_as_pendulum_from_correct_datetimes...
    method test_model_can_access_str_dates_on_relationships (line 65) | def test_model_can_access_str_dates_on_relationships(self):
    method test_model_original_and_dirty_attributes (line 78) | def test_model_original_and_dirty_attributes(self):
    method test_model_creates_when_new (line 98) | def test_model_creates_when_new(self):
    method test_model_can_cast_attributes (line 111) | def test_model_can_cast_attributes(self):
    method test_model_can_cast_dict_attributes (line 128) | def test_model_can_cast_dict_attributes(self):
    method test_valid_json_cast (line 142) | def test_valid_json_cast(self):
    method test_model_update_without_changes (line 173) | def test_model_update_without_changes(self):
    method test_force_update_on_model_class (line 184) | def test_force_update_on_model_class(self):
    method test_only_method (line 196) | def test_only_method(self):
    method test_model_update_without_changes_at_all (line 204) | def test_model_update_without_changes_at_all(self):
    method test_model_using_or_where (line 214) | def test_model_using_or_where(self):
    method test_model_using_or_where_and_chaining_wheres (line 223) | def test_model_using_or_where_and_chaining_wheres(self):
    method test_both_fillable_and_guarded_attributes_raise (line 241) | def test_both_fillable_and_guarded_attributes_raise(self):
    method test_model_can_provide_default_select (line 264) | def test_model_can_provide_default_select(self):
    method test_model_can_override_to_default_select (line 271) | def test_model_can_override_to_default_select(self):
    method test_model_can_use_aggregate_funcs_with_default_selects (line 278) | def test_model_can_use_aggregate_funcs_with_default_selects(self):

FILE: tests/mssql/builder/test_mssql_query_builder.py
  class MockConnection (line 11) | class MockConnection:
    method make_connection (line 14) | def make_connection(self):
    method get_default_query_grammar (line 18) | def get_default_query_grammar(cls):
  class ModelTest (line 22) | class ModelTest(Model):
  class TestMSSQLQueryBuilder (line 26) | class TestMSSQLQueryBuilder(unittest.TestCase):
    method get_builder (line 29) | def get_builder(self, table="users", dry=True):
    method test_sum (line 40) | def test_sum(self):
    method test_where_like (line 48) | def test_where_like(self):
    method test_where_not_like (line 56) | def test_where_not_like(self):
    method test_max (line 65) | def test_max(self):
    method test_min (line 73) | def test_min(self):
    method test_avg (line 81) | def test_avg(self):
    method test_all (line 89) | def test_all(self):
    method test_get (line 95) | def test_get(self):
    method test_first (line 101) | def test_first(self):
    method test_select (line 106) | def test_select(self):
    method test_add_select_no_table (line 114) | def test_add_select_no_table(self):
    method test_select_raw (line 129) | def test_select_raw(self):
    method test_create (line 137) | def test_create(self):
    method test_delete (line 148) | def test_delete(self):
    method test_where (line 155) | def test_where(self):
    method test_where_exists (line 163) | def test_where_exists(self):
    method test_limit (line 168) | def test_limit(self):
    method test_offset (line 174) | def test_offset(self):
    method test_join (line 183) | def test_join(self):
    method test_left_join (line 192) | def test_left_join(self):
    method test_right_join (line 200) | def test_right_join(self):
    method test_update (line 208) | def test_update(self):
    method test_count (line 231) | def test_count(self):
    method test_order_by_asc (line 238) | def test_order_by_asc(self):
    method test_order_by_desc (line 243) | def test_order_by_desc(self):
    method test_where_column (line 250) | def test_where_column(self):
    method test_where_not_in (line 258) | def test_where_not_in(self):
    method test_between (line 266) | def test_between(self):
    method test_not_between (line 274) | def test_not_between(self):
    method test_where_in (line 282) | def test_where_in(self):
    method test_where_null (line 291) | def test_where_null(self):
    method test_where_not_null (line 299) | def test_where_not_null(self):
    method test_having (line 307) | def test_having(self):
    method test_group_by (line 318) | def test_group_by(self):
    method test_builder_alone (line 327) | def test_builder_alone(self):
    method test_where_lt (line 348) | def test_where_lt(self):
    method test_where_lte (line 355) | def test_where_lte(self):
    method test_where_gt (line 362) | def test_where_gt(self):
    method test_where_gte (line 369) | def test_where_gte(self):
    method test_where_ne (line 376) | def test_where_ne(self):
    method test_or_where (line 383) | def test_or_where(self):
    method test_can_call_with_schema (line 391) | def test_can_call_with_schema(self):
    method test_truncate (line 404) | def test_truncate(self):
    method test_truncate_without_foreign_keys (line 409) | def test_truncate_without_foreign_keys(self):
    method test_latest (line 414) | def test_latest(self):
    method test_latest_multiple (line 421) | def test_latest_multiple(self):
    method test_oldest (line 429) | def test_oldest(self):
    method test_oldest_multiple (line 434) | def test_oldest_multiple(self):

FILE: tests/mssql/builder/test_mssql_query_builder_relationships.py
  class Logo (line 16) | class Logo(Model):
  class Article (line 20) | class Article(Model):
    method logo (line 24) | def logo(self):
  class Profile (line 28) | class Profile(Model):
  class User (line 32) | class User(Model):
    method articles (line 36) | def articles(self):
    method profile (line 40) | def profile(self):
    method parent_dynamic (line 44) | def parent_dynamic(self):
    method parent_specified (line 48) | def parent_specified(self):
  class BaseTestQueryRelationships (line 52) | class BaseTestQueryRelationships(unittest.TestCase):
    method get_builder (line 55) | def get_builder(self, table="users"):
    method test_has (line 65) | def test_has(self):
    method test_has_reference_to_self (line 75) | def test_has_reference_to_self(self):
    method test_has_reference_to_self_using_class (line 85) | def test_has_reference_to_self_using_class(self):
    method test_where_has_query (line 95) | def test_where_has_query(self):
    method test_relationship_multiple_has (line 105) | def test_relationship_multiple_has(self):
    method test_relationship_multiple_has_calls (line 116) | def test_relationship_multiple_has_calls(self):
    method test_nested_has (line 127) | def test_nested_has(self):

FILE: tests/mssql/grammar/test_mssql_delete_grammar.py
  class TestMySQLDeleteGrammar (line 7) | class TestMySQLDeleteGrammar(unittest.TestCase):
    method setUp (line 8) | def setUp(self):
    method test_can_compile_delete (line 11) | def test_can_compile_delete(self):
    method test_can_compile_delete_with_where (line 17) | def test_can_compile_delete_with_where(self):

FILE: tests/mssql/grammar/test_mssql_insert_grammar.py
  class TestMySQLInsertGrammar (line 7) | class TestMySQLInsertGrammar(unittest.TestCase):
    method setUp (line 8) | def setUp(self):
    method test_can_compile_insert (line 11) | def test_can_compile_insert(self):
    method test_can_compile_bulk_create (line 17) | def test_can_compile_bulk_create(self):
    method test_can_compile_bulk_create_qmark (line 31) | def test_can_compile_bulk_create_qmark(self):

FILE: tests/mssql/grammar/test_mssql_qmark.py
  class TestMSSQLQmark (line 7) | class TestMSSQLQmark(unittest.TestCase):
    method setUp (line 8) | def setUp(self):
    method test_can_compile_select (line 11) | def test_can_compile_select(self):
    method test_can_compile_update (line 18) | def test_can_compile_update(self):
    method test_can_compile_insert (line 25) | def test_can_compile_insert(self):
    method test_can_compile_where_in (line 32) | def test_can_compile_where_in(self):

FILE: tests/mssql/grammar/test_mssql_select_grammar.py
  class TestMSSQLGrammar (line 8) | class TestMSSQLGrammar(BaseTestCaseSelectGrammar, unittest.TestCase):
    method can_compile_select (line 11) | def can_compile_select(self):
    method can_compile_with_columns (line 17) | def can_compile_with_columns(self):
    method can_compile_with_where (line 23) | def can_compile_with_where(self):
    method can_compile_with_several_where (line 29) | def can_compile_with_several_where(self):
    method can_compile_with_several_where_and_limit (line 35) | def can_compile_with_several_where_and_limit(self):
    method can_compile_with_sum (line 41) | def can_compile_with_sum(self):
    method can_compile_order_by_and_first (line 47) | def can_compile_order_by_and_first(self):
    method can_compile_with_max (line 53) | def can_compile_with_max(self):
    method can_compile_with_max_and_columns (line 59) | def can_compile_with_max_and_columns(self):
    method can_compile_with_max_and_columns_different_order (line 65) | def can_compile_with_max_and_columns_different_order(self):
    method can_compile_with_order_by (line 71) | def can_compile_with_order_by(self):
    method can_compile_with_multiple_order_by (line 77) | def can_compile_with_multiple_order_by(self):
    method can_compile_with_group_by (line 83) | def can_compile_with_group_by(self):
    method can_compile_where_in (line 89) | def can_compile_where_in(self):
    method can_compile_where_in_empty (line 95) | def can_compile_where_in_empty(self):
    method can_compile_where_null (line 101) | def can_compile_where_null(self):
    method can_compile_where_not_null (line 107) | def can_compile_where_not_null(self):
    method can_compile_where_raw (line 113) | def can_compile_where_raw(self):
    method test_can_compile_where_raw_and_where_with_multiple_bindings (line 119) | def test_can_compile_where_raw_and_where_with_multiple_bindings(self):
    method can_compile_select_raw (line 129) | def can_compile_select_raw(self):
    method can_compile_limit_and_offset (line 135) | def can_compile_limit_and_offset(self):
    method can_compile_select_raw_with_select (line 141) | def can_compile_select_raw_with_select(self):
    method can_compile_having_raw (line 147) | def can_compile_having_raw(self):
    method can_compile_count (line 153) | def can_compile_count(self):
    method can_compile_count_column (line 160) | def can_compile_count_column(self):
    method can_compile_where_column (line 167) | def can_compile_where_column(self):
    method can_compile_or_where (line 174) | def can_compile_or_where(self):
    method can_grouped_where (line 182) | def can_grouped_where(self):
    method can_compile_sub_select (line 188) | def can_compile_sub_select(self):
    method can_compile_sub_select_where (line 197) | def can_compile_sub_select_where(self):
    method can_compile_sub_select_value (line 206) | def can_compile_sub_select_value(self):
    method can_compile_complex_sub_select (line 215) | def can_compile_complex_sub_select(self):
    method can_compile_exists (line 226) | def can_compile_exists(self):
    method can_compile_not_exists (line 234) | def can_compile_not_exists(self):
    method can_compile_having (line 242) | def can_compile_having(self):
    method can_compile_having_order (line 248) | def can_compile_having_order(self):
    method can_compile_between (line 254) | def can_compile_between(self):
    method can_compile_not_between (line 260) | def can_compile_not_between(self):
    method can_compile_where_not_in (line 266) | def can_compile_where_not_in(self):
    method can_compile_having_with_expression (line 272) | def can_compile_having_with_expression(self):
    method can_compile_having_with_greater_than_expression (line 278) | def can_compile_having_with_greater_than_expression(self):
    method can_compile_join (line 284) | def can_compile_join(self):
    method can_compile_left_join (line 290) | def can_compile_left_join(self):
    method can_compile_multiple_join (line 296) | def can_compile_multiple_join(self):
    method test_can_compile_where_raw (line 302) | def test_can_compile_where_raw(self):
    method test_can_compile_having_raw (line 306) | def test_can_compile_having_raw(self):
    method test_can_compile_having_raw_order (line 316) | def test_can_compile_having_raw_order(self):
    method test_can_compile_select_raw (line 328) | def test_can_compile_select_raw(self):
    method test_can_compile_select_raw_with_select (line 335) | def test_can_compile_select_raw_with_select(self):
    method can_compile_first_or_fail (line 342) | def can_compile_first_or_fail(self):
    method where_like (line 349) | def where_like(self):
    method where_not_like (line 356) | def where_not_like(self):
    method where_regexp (line 363) | def where_regexp(self):
    method where_not_regexp (line 370) | def where_not_regexp(self):
    method can_compile_join_clause (line 377) | def can_compile_join_clause(self):
    method can_compile_join_clause_with_value (line 390) | def can_compile_join_clause_with_value(self):
    method can_compile_join_clause_with_null (line 402) | def can_compile_join_clause_with_null(self):
    method can_compile_join_clause_with_not_null (line 415) | def can_compile_join_clause_with_not_null(self):
    method can_compile_join_clause_with_lambda (line 428) | def can_compile_join_clause_with_lambda(self):
    method can_compile_left_join_clause_with_lambda (line 441) | def can_compile_left_join_clause_with_lambda(self):
    method can_compile_right_join_clause_with_lambda (line 454) | def can_compile_right_join_clause_with_lambda(self):
    method shared_lock (line 467) | def shared_lock(self):
    method update_lock (line 474) | def update_lock(self):
    method can_user_where_raw_and_where (line 481) | def can_user_where_raw_and_where(self):
    method where_exists_with_lambda (line 487) | def where_exists_with_lambda(self):
    method where_not_exists_with_lambda (line 490) | def where_not_exists_with_lambda(self):
    method where_date (line 493) | def where_date(self):
    method or_where_null (line 498) | def or_where_null(self):
    method select_distinct (line 501) | def select_distinct(self):

FILE: tests/mssql/grammar/test_mssql_update_grammar.py
  class TestMSSQLUpdateGrammar (line 8) | class TestMSSQLUpdateGrammar(unittest.TestCase):
    method setUp (line 9) | def setUp(self):
    method test_can_compile_update (line 12) | def test_can_compile_update(self):
    method test_can_compile_update_with_multiple_where (line 20) | def test_can_compile_update_with_multiple_where(self):
    method test_raw_expression (line 31) | def test_raw_expression(self):

FILE: tests/mssql/schema/test_mssql_schema_builder.py
  class TestMSSQLSchemaBuilder (line 9) | class TestMSSQLSchemaBuilder(unittest.TestCase):
    method setUp (line 12) | def setUp(self):
    method test_can_add_columns (line 21) | def test_can_add_columns(self):
    method test_can_add_tiny_text (line 32) | def test_can_add_tiny_text(self):
    method test_can_add_unsigned_decimal (line 42) | def test_can_add_unsigned_decimal(self):
    method test_can_add_columns_with_constaint (line 52) | def test_can_add_columns_with_constaint(self):
    method test_can_have_float_type (line 66) | def test_can_have_float_type(self):
    method test_can_have_unsigned_columns (line 75) | def test_can_have_unsigned_columns(self):
    method test_can_add_columns_with_foreign_key_constaint (line 95) | def test_can_add_columns_with_foreign_key_constaint(self):
    method test_can_add_columns_with_add_foreign_constaint (line 115) | def test_can_add_columns_with_add_foreign_constaint(self):
    method test_can_advanced_table_creation (line 135) | def test_can_advanced_table_creation(self):
    method test_can_advanced_table_creation2 (line 158) | def test_can_advanced_table_creation2(self):
    method test_can_add_columns_with_foreign_key_constraint_name (line 192) | def test_can_add_columns_with_foreign_key_constraint_name(self):
    method test_can_have_composite_keys (line 209) | def test_can_have_composite_keys(self):
    method test_can_have_column_primary_key (line 229) | def test_can_have_column_primary_key(self):
    method test_has_table (line 247) | def test_has_table(self):
    method test_can_truncate (line 254) | def test_can_truncate(self):
    method test_can_rename_table (line 259) | def test_can_rename_table(self):
    method test_can_drop_table_if_exists (line 264) | def test_can_drop_table_if_exists(self):
    method test_can_drop_table (line 269) | def test_can_drop_table(self):
    method test_has_column (line 274) | def test_has_column(self):
    method test_can_enable_foreign_keys (line 282) | def test_can_enable_foreign_keys(self):
    method test_can_disable_foreign_keys (line 287) | def test_can_disable_foreign_keys(self):
    method test_can_truncate_without_foreign_keys (line 292) | def test_can_truncate_without_foreign_keys(self):
    method test_can_add_enum (line 304) | def test_can_add_enum(self):
    method test_can_change_column_enum (line 316) | def test_can_change_column_enum(self):

FILE: tests/mssql/schema/test_mssql_schema_builder_alter.py
  class TestMySQLSchemaBuilderAlter (line 10) | class TestMySQLSchemaBuilderAlter(unittest.TestCase):
    method setUp (line 13) | def setUp(self):
    method test_can_add_columns (line 22) | def test_can_add_columns(self):
    method test_can_adds_column_with_default (line 35) | def test_can_adds_column_with_default(self):
    method test_alter_rename (line 45) | def test_alter_rename(self):
    method test_alter_add_and_rename (line 57) | def test_alter_add_and_rename(self):
    method test_alter_drop1 (line 73) | def test_alter_drop1(self):
    method test_alter_add_column_and_foreign_key (line 81) | def test_alter_add_column_and_foreign_key(self):
    method test_alter_add_column_and_add_foreign (line 95) | def test_alter_add_column_and_add_foreign(self):
    method test_alter_drop_foreign_key (line 107) | def test_alter_drop_foreign_key(self):
    method test_alter_drop_foreign_key_shortcut (line 115) | def test_alter_drop_foreign_key_shortcut(self):
    method test_alter_drop_unique_constraint (line 123) | def test_alter_drop_unique_constraint(self):
    method test_alter_add_primary (line 131) | def test_alter_add_primary(self):
    method test_alter_add_index (line 141) | def test_alter_add_index(self):
    method test_alter_drop_index (line 149) | def test_alter_drop_index(self):
    method test_alter_drop_index_shortcut (line 157) | def test_alter_drop_index_shortcut(self):
    method test_alter_drop_unique_constraint_shortcut (line 165) | def test_alter_drop_unique_constraint_shortcut(self):
    method test_alter_drop_primary (line 173) | def test_alter_drop_primary(self):
    method test_has_table (line 181) | def test_has_table(self):
    method test_drop_table (line 188) | def test_drop_table(self):
    method test_change (line 195) | def test_change(self):
    method test_drop_add_and_change (line 215) | def test_drop_add_and_change(self):
    method test_can_create_indexes (line 237) | def test_can_create_indexes(self):
    method test_timestamp_alter_add_nullable_column (line 257) | def test_timestamp_alter_add_nullable_column(self):
    method test_can_add_column_enum (line 272) | def test_can_add_column_enum(self):

FILE: tests/mysql/builder/test_mysql_builder_transaction.py
  class User (line 15) | class User(Model):
  class BaseTestQueryRelationships (line 19) | class BaseTestQueryRelationships(unittest.TestCase):
    method get_builder (line 22) | def get_builder(self, table="users"):
    method test_transaction (line 28) | def test_transaction(self):
    method test_transaction_default_globally (line 39) | def test_transaction_default_globally(self):

FILE: tests/mysql/builder/test_query_builder.py
  class Articles (line 15) | class Articles(Model):
  class User (line 19) | class User(Model):
    method articles (line 23) | def articles(self):
  class BaseTestQueryBuilder (line 27) | class BaseTestQueryBuilder:
    method get_builder (line 30) | def get_builder(self, table="users", dry=True):
    method test_sum (line 42) | def test_sum(self):
    method test_sum_chained (line 51) | def test_sum_chained(self):
    method test_with_ (line 60) | def test_with_(self):
    method test_where_like (line 69) | def test_where_like(self):
    method test_where_not_like (line 78) | def test_where_not_like(self):
    method test_max (line 87) | def test_max(self):
    method test_min (line 96) | def test_min(self):
    method test_avg (line 105) | def test_avg(self):
    method test_all (line 113) | def test_all(self):
    method test_get (line 121) | def test_get(self):
    method test_first (line 129) | def test_first(self):
    method test_find_with_model (line 136) | def test_find_with_model(self):
    method test_find_with_model_and_list (line 142) | def test_find_with_model_and_list(self):
    method test_find_with_model_custom_column (line 148) | def test_find_with_model_custom_column(self):
    method test_find_with_builder (line 154) | def test_find_with_builder(self):
    method test_find_with_builder_and_list (line 161) | def test_find_with_builder_and_list(self):
    method test_find_with_builder_without_column (line 168) | def test_find_with_builder_without_column(self):
    method test_select (line 174) | def test_select(self):
    method test_select_with_table (line 182) | def test_select_with_table(self):
    method test_select_with_table_raw (line 190) | def test_select_with_table_raw(self):
    method test_select_with_alias (line 198) | def test_select_with_alias(self):
    method test_select_raw (line 206) | def test_select_raw(self):
    method test_add_select (line 214) | def test_add_select(self):
    method test_add_select_no_table (line 227) | def test_add_select_no_table(self):
    method test_create (line 243) | def test_create(self):
    method test_delete (line 253) | def test_delete(self):
    method test_where (line 261) | def test_where(self):
    method test_where_exists (line 269) | def test_where_exists(self):
    method test_limit (line 277) | def test_limit(self):
    method test_offset (line 285) | def test_offset(self):
    method test_join (line 293) | def test_join(self):
    method test_left_join (line 301) | def test_left_join(self):
    method test_right_join (line 309) | def test_right_join(self):
    method test_update (line 317) | def test_update(self):
    method test_count (line 342) | def test_count(self):
    method test_order_by_asc (line 350) | def test_order_by_asc(self):
    method test_order_by_desc (line 358) | def test_order_by_desc(self):
    method test_where_column (line 366) | def test_where_column(self):
    method test_where_not_in (line 374) | def test_where_not_in(self):
    method test_between (line 382) | def test_between(self):
    method test_not_between (line 390) | def test_not_between(self):
    method test_where_in (line 398) | def test_where_in(self):
    method test_where_null (line 407) | def test_where_null(self):
    method test_where_not_null (line 416) | def test_where_not_null(self):
    method test_having (line 425) | def test_having(self):
    method test_group_by (line 436) | def test_group_by(self):
    method test_builder_alone (line 445) | def test_builder_alone(self):
    method test_where_lt (line 466) | def test_where_lt(self):
    method test_where_lte (line 474) | def test_where_lte(self):
    method test_where_gt (line 482) | def test_where_gt(self):
    method test_where_gte (line 490) | def test_where_gte(self):
    method test_where_ne (line 498) | def test_where_ne(self):
    method test_or_where (line 506) | def test_or_where(self):
    method test_or_where (line 514) | def test_or_where(self):
    method test_where_like_as_operator (line 522) | def test_where_like_as_operator(self):
    method test_where_like (line 528) | def test_where_like(self):
    method test_where_not_like_as_operator (line 534) | def test_where_not_like_as_operator(self):
    method test_where_not_like (line 540) | def test_where_not_like(self):
    method test_can_call_with_multi_tables (line 546) | def test_can_call_with_multi_tables(self):
    method test_truncate (line 559) | def test_truncate(self):
    method test_truncate_without_foreign_keys (line 567) | def test_truncate_without_foreign_keys(self):
    method test_shared_lock (line 575) | def test_shared_lock(self):
    method test_update_lock (line 583) | def test_update_lock(self):
  class MySQLQueryBuilderTest (line 592) | class MySQLQueryBuilderTest(BaseTestQueryBuilder, unittest.TestCase):
    method sum (line 595) | def sum(self):
    method sum_chained (line 602) | def sum_chained(self):
    method with_ (line 609) | def with_(self):
    method max (line 616) | def max(self):
    method min (line 623) | def min(self):
    method avg (line 630) | def avg(self):
    method first (line 637) | def first(self):
    method all (line 644) | def all(self):
    method get (line 651) | def get(self):
    method select (line 658) | def select(self):
    method select_with_table (line 665) | def select_with_table(self):
    method select_with_table_raw (line 672) | def select_with_table_raw(self):
    method select_with_alias (line 679) | def select_with_alias(self):
    method select_raw (line 686) | def select_raw(self):
    method add_select (line 693) | def add_select(self):
    method add_select_no_table (line 700) | def add_select_no_table(self):
    method create (line 711) | def create(self):
    method delete (line 718) | def delete(self):
    method where (line 725) | def where(self):
    method where_exists (line 732) | def where_exists(self):
    method limit (line 739) | def limit(self):
    method offset (line 746) | def offset(self):
    method join (line 753) | def join(self):
    method left_join (line 759) | def left_join(self):
    method right_join (line 765) | def right_join(self):
    method update (line 771) | def update(self):
    method increment (line 777) | def increment(self):
    method decrement (line 783) | def decrement(self):
    method count (line 789) | def count(self):
    method order_by_asc (line 795) | def order_by_asc(self):
    method order_by_desc (line 801) | def order_by_desc(self):
    method where_column (line 807) | def where_column(self):
    method where_null (line 813) | def where_null(self):
    method where_not_null (line 819) | def where_not_null(self):
    method where_not_in (line 825) | def where_not_in(self):
    method where_in (line 831) | def where_in(self):
    method between (line 837) | def between(self):
    method not_between (line 843) | def not_between(self):
    method having (line 849) | def having(self):
    method group_by (line 855) | def group_by(self):
    method where_lt (line 861) | def where_lt(self):
    method where_lte (line 868) | def where_lte(self):
    method where_gt (line 875) | def where_gt(self):
    method where_gte (line 882) | def where_gte(self):
    method where_ne (line 889) | def where_ne(self):
    method or_where (line 896) | def or_where(self):
    method where_like (line 905) | def where_like(self):
    method where_not_like (line 912) | def where_not_like(self):
    method truncate (line 919) | def truncate(self):
    method truncate_without_foreign_keys (line 926) | def truncate_without_foreign_keys(self):
    method shared_lock (line 937) | def shared_lock(self):
    method update_lock (line 944) | def update_lock(self):
    method test_latest (line 951) | def test_latest(self):
    method test_oldest (line 959) | def test_oldest(self):
    method latest (line 967) | def latest(self):
    method oldest (line 973) | def oldest(self):

FILE: tests/mysql/builder/test_query_builder_scopes.py
  class BaseTestQueryBuilderScopes (line 13) | class BaseTestQueryBuilderScopes(unittest.TestCase):
    method get_builder (line 16) | def get_builder(self, table="users"):
    method test_scopes (line 26) | def test_scopes(self):
    method test_global_scopes (line 36) | def test_global_scopes(self):
    method test_global_scope_from_class (line 46) | def test_global_scope_from_class(self):
    method test_global_scope_remove_from_class (line 54) | def test_global_scope_remove_from_class(self):
    method test_global_scope_adds_method (line 66) | def test_global_scope_adds_method(self):

FILE: tests/mysql/builder/test_transactions.py
  class Articles (line 13) | class Articles(Model):
  class User (line 17) | class User(Model):
    method articles (line 19) | def articles(self):
  class TestTransactions (line 25) | class TestTransactions(unittest.TestCase):

FILE: tests/mysql/connections/test_mysql_connection_selects.py
  class MockUser (line 9) | class MockUser(Model):
  class TestMySQLSelectConnection (line 15) | class TestMySQLSelectConnection(unittest.TestCase):
    method setUp (line 16) | def setUp(self):
    method test_can_compile_select (line 19) | def test_can_compile_select(self):
    method test_can_get_first_record (line 25) | def test_can_get_first_record(self):
    method test_can_find_first_record (line 29) | def test_can_find_first_record(self):
    method test_can_get_all_records (line 33) | def test_can_get_all_records(self):
    method test_can_get_5_records (line 37) | def test_can_get_5_records(self):
    method test_can_get_1_record_with_get (line 41) | def test_can_get_1_record_with_get(self):

FILE: tests/mysql/grammar/test_mysql_delete_grammar.py
  class BaseDeleteGrammarTest (line 8) | class BaseDeleteGrammarTest:
    method setUp (line 9) | def setUp(self):
    method test_can_compile_delete (line 12) | def test_can_compile_delete(self):
    method test_can_compile_delete_in (line 20) | def test_can_compile_delete_in(self):
    method test_can_compile_delete_with_where (line 28) | def test_can_compile_delete_with_where(self):
  class TestMySQLDeleteGrammar (line 43) | class TestMySQLDeleteGrammar(BaseDeleteGrammarTest, unittest.TestCase):
    method can_compile_delete (line 46) | def can_compile_delete(self):
    method can_compile_delete_in (line 56) | def can_compile_delete_in(self):
    method can_compile_delete_with_where (line 66) | def can_compile_delete_with_where(self):

FILE: tests/mysql/grammar/test_mysql_insert_grammar.py
  class BaseInsertGrammarTest (line 8) | class BaseInsertGrammarTest:
    method setUp (line 9) | def setUp(self):
    method test_can_compile_insert (line 12) | def test_can_compile_insert(self):
    method test_can_compile_insert_with_keywords (line 20) | def test_can_compile_insert_with_keywords(self):
    method test_can_compile_bulk_create (line 28) | def test_can_compile_bulk_create(self):
    method test_can_compile_bulk_create_qmark (line 44) | def test_can_compile_bulk_create_qmark(self):
    method test_can_compile_bulk_create_multiple (line 54) | def test_can_compile_bulk_create_multiple(self):
  class TestMySQLUpdateGrammar (line 70) | class TestMySQLUpdateGrammar(BaseInsertGrammarTest, unittest.TestCase):
    method can_compile_insert (line 73) | def can_compile_insert(self):
    method can_compile_insert_with_keywords (line 81) | def can_compile_insert_with_keywords(self):
    method can_compile_bulk_create (line 87) | def can_compile_bulk_create(self):
    method can_compile_bulk_create_multiple (line 93) | def can_compile_bulk_create_multiple(self):
    method can_compile_bulk_create_qmark (line 99) | def can_compile_bulk_create_qmark(self):

FILE: tests/mysql/grammar/test_mysql_qmark.py
  class BaseQMarkTest (line 8) | class BaseQMarkTest:
    method setUp (line 9) | def setUp(self):
    method test_can_compile_select (line 12) | def test_can_compile_select(self):
    method test_can_compile_delete (line 21) | def test_can_compile_delete(self):
    method test_can_compile_update (line 30) | def test_can_compile_update(self):
    method test_can_compile_where_in (line 39) | def test_can_compile_where_in(self):
    method test_can_compile_where_not_null (line 48) | def test_can_compile_where_not_null(self):
    method test_can_compile_where_with_falsy_values (line 57) | def test_can_compile_where_with_falsy_values(self):
    method test_can_compile_where_with_true_value (line 66) | def test_can_compile_where_with_true_value(self):
    method test_can_compile_where_with_false_value (line 75) | def test_can_compile_where_with_false_value(self):
    method test_can_compile_sub_group_bindings (line 84) | def test_can_compile_sub_group_bindings(self):
  class TestMySQLQmark (line 100) | class TestMySQLQmark(BaseQMarkTest, unittest.TestCase):
    method can_compile_select (line 101) | def can_compile_select(self):
    method can_compile_delete (line 110) | def can_compile_delete(self):
    method can_compile_update (line 116) | def can_compile_update(self):
    method can_compile_where_in (line 127) | def can_compile_where_in(self):
    method can_compile_where_not_null (line 136) | def can_compile_where_not_null(self):
    method can_compile_where_with_falsy_values (line 142) | def can_compile_where_with_falsy_values(self):
    method can_compile_where_with_true_value (line 148) | def can_compile_where_with_true_value(self):
    method can_compile_where_with_false_value (line 154) | def can_compile_where_with_false_value(self):
    method can_compile_sub_group_bindings (line 160) | def can_compile_sub_group_bindings(self):

FILE: tests/mysql/grammar/test_mysql_select_grammar.py
  class TestMySQLGrammar (line 8) | class TestMySQLGrammar(BaseTestCaseSelectGrammar, unittest.TestCase):
    method can_compile_select (line 11) | def can_compile_select(self):
    method can_compile_with_columns (line 17) | def can_compile_with_columns(self):
    method can_compile_order_by_and_first (line 23) | def can_compile_order_by_and_first(self):
    method can_compile_with_where (line 29) | def can_compile_with_where(self):
    method can_compile_with_several_where (line 35) | def can_compile_with_several_where(self):
    method can_compile_with_several_where_and_limit (line 41) | def can_compile_with_several_where_and_limit(self):
    method can_compile_with_sum (line 47) | def can_compile_with_sum(self):
    method can_compile_with_max (line 53) | def can_compile_with_max(self):
    method can_compile_with_max_and_columns (line 59) | def can_compile_with_max_and_columns(self):
    method can_compile_with_max_and_columns_different_order (line 65) | def can_compile_with_max_and_columns_different_order(self):
    method can_compile_with_order_by (line 71) | def can_compile_with_order_by(self):
    method can_compile_with_multiple_order_by (line 77) | def can_compile_with_multiple_order_by(self):
    method can_compile_with_group_by (line 83) | def can_compile_with_group_by(self):
    method can_compile_where_in (line 89) | def can_compile_where_in(self):
    method can_compile_where_in_empty (line 95) | def can_compile_where_in_empty(self):
    method can_compile_where_not_in (line 101) | def can_compile_where_not_in(self):
    method can_compile_where_null (line 107) | def can_compile_where_null(self):
    method can_compile_where_not_null (line 113) | def can_compile_where_not_null(self):
    method can_compile_where_raw (line 119) | def can_compile_where_raw(self):
    method can_compile_where_raw_and_where_with_multiple_bindings (line 125) | def can_compile_where_raw_and_where_with_multiple_bindings(self):
    method can_compile_having_raw (line 131) | def can_compile_having_raw(self):
    method can_compile_select_raw (line 137) | def can_compile_select_raw(self):
    method can_compile_limit_and_offset (line 143) | def can_compile_limit_and_offset(self):
    method can_compile_select_raw_with_select (line 149) | def can_compile_select_raw_with_select(self):
    method can_compile_count (line 155) | def can_compile_count(self):
    method can_compile_count_column (line 162) | def can_compile_count_column(self):
    method can_compile_where_column (line 169) | def can_compile_where_column(self):
    method can_compile_or_where (line 176) | def can_compile_or_where(self):
    method can_grouped_where (line 184) | def can_grouped_where(self):
    method can_compile_sub_select (line 190) | def can_compile_sub_select(self):
    method can_compile_sub_select_where (line 199) | def can_compile_sub_select_where(self):
    method can_compile_sub_select_value (line 208) | def can_compile_sub_select_value(self):
    method can_compile_complex_sub_select (line 217) | def can_compile_complex_sub_select(self):
    method can_compile_exists (line 228) | def can_compile_exists(self):
    method can_compile_not_exists (line 236) | def can_compile_not_exists(self):
    method can_compile_having (line 244) | def can_compile_having(self):
    method can_compile_having_order (line 250) | def can_compile_having_order(self):
    method can_compile_having_with_expression (line 256) | def can_compile_having_with_expression(self):
    method can_compile_having_with_greater_than_expression (line 262) | def can_compile_having_with_greater_than_expression(self):
    method can_compile_join (line 268) | def can_compile_join(self):
    method can_compile_left_join (line 274) | def can_compile_left_join(self):
    method can_compile_multiple_join (line 280) | def can_compile_multiple_join(self):
    method can_compile_between (line 286) | def can_compile_between(self):
    method can_compile_not_between (line 292) | def can_compile_not_between(self):
    method test_can_compile_where_raw (line 298) | def test_can_compile_where_raw(self):
    method test_can_compile_having_raw (line 302) | def test_can_compile_having_raw(self):
    method test_can_compile_having_raw_order (line 312) | def test_can_compile_having_raw_order(self):
    method test_can_compile_select_raw (line 324) | def test_can_compile_select_raw(self):
    method test_can_compile_select_raw_with_select (line 328) | def test_can_compile_select_raw_with_select(self):
    method can_compile_first_or_fail (line 332) | def can_compile_first_or_fail(self):
    method where_not_like (line 339) | def where_not_like(self):
    method where_regexp (line 346) | def where_regexp(self):
    method where_not_regexp (line 353) | def where_not_regexp(self):
    method where_like (line 360) | def where_like(self):
    method can_compile_join_clause (line 367) | def can_compile_join_clause(self):
    method can_compile_join_clause_with_value (line 380) | def can_compile_join_clause_with_value(self):
    method can_compile_join_clause_with_null (line 392) | def can_compile_join_clause_with_null(self):
    method can_compile_join_clause_with_not_null (line 405) | def can_compile_join_clause_with_not_null(self):
    method can_compile_join_clause_with_lambda (line 418) | def can_compile_join_clause_with_lambda(self):
    method can_compile_left_join_clause_with_lambda (line 431) | def can_compile_left_join_clause_with_lambda(self):
    method can_compile_right_join_clause_with_lambda (line 444) | def can_compile_right_join_clause_with_lambda(self):
    method shared_lock (line 457) | def shared_lock(self):
    method update_lock (line 464) | def update_lock(self):
    method can_user_where_raw_and_where (line 471) | def can_user_where_raw_and_where(self):
    method where_exists_with_lambda (line 477) | def where_exists_with_lambda(self):
    method where_not_exists_with_lambda (line 480) | def where_not_exists_with_lambda(self):
    method where_date (line 483) | def where_date(self):
    method or_where_null (line 488) | def or_where_null(self):
    method select_distinct (line 491) | def select_distinct(self):

FILE: tests/mysql/grammar/test_mysql_update_grammar.py
  class BaseTestCaseUpdateGrammar (line 9) | class BaseTestCaseUpdateGrammar:
    method setUp (line 10) | def setUp(self):
    method test_can_compile_update (line 13) | def test_can_compile_update(self):
    method test_can_compile_multiple_update (line 23) | def test_can_compile_multiple_update(self):
    method test_can_compile_update_with_multiple_where (line 33) | def test_can_compile_update_with_multiple_where(self):
    method test_raw_expression (line 62) | def test_raw_expression(self):
  class TestMySQLUpdateGrammar (line 72) | class TestMySQLUpdateGrammar(BaseTestCaseUpdateGrammar, unittest.TestCase):
    method can_compile_update (line 75) | def can_compile_update(self):
    method raw_expression (line 83) | def raw_expression(self):
    method can_compile_multiple_update (line 91) | def can_compile_multiple_update(self):
    method can_compile_update_with_multiple_where (line 97) | def can_compile_update_with_multiple_where(self):
    method can_compile_increment (line 105) | def can_compile_increment(self):
    method can_compile_decrement (line 111) | def can_compile_decrement(self):

FILE: tests/mysql/model/test_accessors_and_mutators.py
  class User (line 14) | class User(Model):
    method get_name_attribute (line 17) | def get_name_attribute(self):
    method set_name_attribute (line 20) | def set_name_attribute(self, attribute):
  class SetUser (line 24) | class SetUser(Model):
    method set_name_attribute (line 27) | def set_name_attribute(self, attribute):
  class TestAccessor (line 31) | class TestAccessor(unittest.TestCase):
    method test_can_get_accessor (line 32) | def test_can_get_accessor(self):
    method test_mutator (line 40) | def test_mutator(self):

FILE: tests/mysql/model/test_model.py
  class ProfileFillable (line 14) | class ProfileFillable(Model):
  class ProfileFillTimeStamped (line 20) | class ProfileFillTimeStamped(Model):
  class ProfileFillAsterisk (line 25) | class ProfileFillAsterisk(Model):
  class ProfileGuarded (line 31) | class ProfileGuarded(Model):
  class ProfileGuardedAsterisk (line 37) | class ProfileGuardedAsterisk(Model):
  class ProfileSerialize (line 43) | class ProfileSerialize(Model):
  class ProfileSerializeWithVisible (line 49) | class ProfileSerializeWithVisible(Model):
  class ProfileSerializeWithVisibleAndHidden (line 55) | class ProfileSerializeWithVisibleAndHidden(Model):
  class Profile (line 62) | class Profile(Model):
  class Company (line 66) | class Company(Model):
  class User (line 70) | class User(Model):
    method meta (line 72) | def meta(self):
  class ProductNames (line 76) | class ProductNames(Model):
  class TestModel (line 80) | class TestModel(unittest.TestCase):
    method test_create_can_use_fillable (line 81) | def test_create_can_use_fillable(self):
    method test_create_can_use_fillable_asterisk (line 90) | def test_create_can_use_fillable_asterisk(self):
    method test_create_can_use_guarded (line 100) | def test_create_can_use_guarded(self):
    method test_create_can_use_guarded_asterisk (line 109) | def test_create_can_use_guarded_asterisk(self):
    method test_bulk_create_can_use_fillable (line 118) | def test_bulk_create_can_use_fillable(self):
    method test_bulk_create_can_use_fillable_asterisk (line 132) | def test_bulk_create_can_use_fillable_asterisk(self):
    method test_bulk_create_can_use_guarded (line 146) | def test_bulk_create_can_use_guarded(self):
    method test_bulk_create_can_use_guarded_asterisk (line 160) | def test_bulk_create_can_use_guarded_asterisk(self):
    method test_update_can_use_fillable (line 176) | def test_update_can_use_fillable(self):
    method test_update_can_use_fillable_asterisk (line 185) | def test_update_can_use_fillable_asterisk(self):
    method test_update_can_use_guarded (line 195) | def test_update_can_use_guarded(self):
    method test_update_can_use_guarded_asterisk (line 204) | def test_update_can_use_guarded_asterisk(self):
    method test_table_name (line 215) | def test_table_name(self):
    method test_serialize (line 225) | def test_serialize(self):
    method test_json (line 230) | def test_json(self):
    method test_serialize_with_hidden (line 235) | def test_serialize_with_hidden(self):
    method test_serialize_with_visible (line 244) | def test_serialize_with_visible(self):
    method test_serialize_with_visible_and_hidden_raise_error (line 252) | def test_serialize_with_visible_and_hidden_raise_error(self):
    method test_serialize_with_on_the_fly_appends (line 259) | def test_serialize_with_on_the_fly_appends(self):
    method test_serialize_with_model_appends (line 269) | def test_serialize_with_model_appends(self):
    method test_serialize_with_date (line 277) | def test_serialize_with_date(self):
    method test_set_as_date (line 282) | def test_set_as_date(self):
    method test_access_as_date (line 293) | def test_access_as_date(self):
    method test_hydrate_with_none (line 304) | def test_hydrate_with_none(self):
    method test_serialize_with_dirty_attribute (line 309) | def test_serialize_with_dirty_attribute(self):
    method test_attribute_check_with_hasattr (line 315) | def test_attribute_check_with_hasattr(self):
  class MysqlTestModel (line 321) | class MysqlTestModel(unittest.TestCase):
    method test_can_find_first (line 323) | def test_can_find_first(self):
    method test_can_touch (line 326) | def test_can_touch(self):
    method test_find_or_fail_raise_an_exception_if_not_exists (line 336) | def test_find_or_fail_raise_an_exception_if_not_exists(self):
    method test_returns_correct_data_type (line 340) | def test_returns_correct_data_type(self):

FILE: tests/mysql/relationships/test_belongs_to_many.py
  class User (line 16) | class User(Model):
    method profile (line 18) | def profile(self):
  class Profile (line 22) | class Profile(Model):
  class Permission (line 26) | class Permission(Model):
    method role (line 28) | def role(self):
  class PermissionSelect (line 32) | class PermissionSelect(Model):
    method role (line 38) | def role(self):
  class Role (line 42) | class Role(Model):
    method permissions (line 44) | def permissions(self):
  class MySQLRelationships (line 48) | class MySQLRelationships(unittest.TestCase):
    method test_belongs_to_many (line 51) | def test_belongs_to_many(self):
    method test_belongs_to_many_has (line 61) | def test_belongs_to_many_has(self):
    method test_belongs_to_many_or_has (line 69) | def test_belongs_to_many_or_has(self):
    method test_belongs_to_many_or_where_has (line 77) | def test_belongs_to_many_or_where_has(self):
    method test_belongs_to_many_or_doesnt_have (line 89) | def test_belongs_to_many_or_doesnt_have(self):
    method test_where_doesnt_have (line 97) | def test_where_doesnt_have(self):
    method test_or_where_doesnt_have (line 111) | def test_or_where_doesnt_have(self):
    method test_belongs_to_many_where_has (line 125) | def test_belongs_to_many_where_has(self):
    method test_belongs_to_many_relate_method (line 135) | def test_belongs_to_many_relate_method(self):
    method test_belongs_to_many_relate_method_reversed (line 144) | def test_belongs_to_many_relate_method_reversed(self):
    method test_belongs_to_many_joins (line 153) | def test_belongs_to_many_joins(self):
    method test_with_count (line 160) | def test_with_count(self):
    method test_with_count_with_selects (line 168) | def test_with_count_with_selects(self):

FILE: tests/mysql/relationships/test_has_many_through.py
  class InboundShipment (line 12) | class InboundShipment(Model):
    method from_country (line 14) | def from_country(self):
  class Country (line 18) | class Country(Model):
  class Port (line 22) | class Port(Model):
  class MySQLRelationships (line 26) | class MySQLRelationships(unittest.TestCase):
    method test_has_query (line 29) | def test_has_query(self):
    method test_or_has (line 37) | def test_or_has(self):
    method test_where_has_query (line 45) | def test_where_has_query(self):
    method test_or_where_has (line 55) | def test_or_where_has(self):
    method test_doesnt_have (line 67) | def test_doesnt_have(self):
    method test_or_where_doesnt_have (line 75) | def test_or_where_doesnt_have(self):

FILE: tests/mysql/relationships/test_has_one_through.py
  class InboundShipment (line 12) | class InboundShipment(Model):
    method from_country (line 14) | def from_country(self):
  class Country (line 18) | class Country(Model):
  class Port (line 22) | class Port(Model):
  class MySQLHasOneThroughRelationship (line 26) | class MySQLHasOneThroughRelationship(unittest.TestCase):
    method test_has_query (line 29) | def test_has_query(self):
    method test_or_has (line 37) | def test_or_has(self):
    method test_where_has_query (line 45) | def test_where_has_query(self):
    method test_or_where_has (line 55) | def test_or_where_has(self):
    method test_doesnt_have (line 67) | def test_doesnt_have(self):
    method test_or_where_doesnt_have (line 75) | def test_or_where_doesnt_have(self):
    method test_has_one_through_with_count (line 89) | def test_has_one_through_with_count(self):

FILE: tests/mysql/relationships/test_relationships.py
  class User (line 15) | class User(Model):
    method profile (line 17) | def profile(self):
  class Profile (line 21) | class Profile(Model):
    method identification (line 23) | def identification(self):
  class Identification (line 27) | class Identification(Model):
  class MySQLRelationships (line 31) | class MySQLRelationships(unittest.TestCase):
    method test_has (line 34) | def test_has(self):
    method test_has_nested (line 41) | def test_has_nested(self):
    method test_or_has (line 48) | def test_or_has(self):
    method test_or_has_nested (line 56) | def test_or_has_nested(self):
    method test_relationship_where_has (line 64) | def test_relationship_where_has(self):
    method test_relationship_where_has_nested (line 76) | def test_relationship_where_has_nested(self):
    method test_relationship_or_where_has (line 90) | def test_relationship_or_where_has(self):
    method test_relationship_or_where_has_nested (line 102) | def test_relationship_or_where_has_nested(self):
    method test_relationship_doesnt_have (line 116) | def test_relationship_doesnt_have(self):
    method test_relationship_doesnt_have_nested (line 124) | def test_relationship_doesnt_have_nested(self):
    method test_relationship_where_doesnt_have (line 132) | def test_relationship_where_doesnt_have(self):
    method test_relationship_where_doesnt_have_nested (line 142) | def test_relationship_where_doesnt_have_nested(self):
    method test_relationship_or_where_doesnt_have (line 152) | def test_relationship_or_where_doesnt_have(self):
    method test_relationship_or_where_doesnt_have_nested (line 162) | def test_relationship_or_where_doesnt_have_nested(self):
    method test_joins (line 172) | def test_joins(self):
    method test_join_on (line 179) | def test_join_on(self):

FILE: tests/mysql/schema/test_mysql_schema_builder.py
  class Discussion (line 13) | class Discussion(Model):
  class TestMySQLSchemaBuilder (line 17) | class TestMySQLSchemaBuilder(unittest.TestCase):
    method setUp (line 20) | def setUp(self):
    method test_can_add_columns1 (line 29) | def test_can_add_columns1(self):
    method test_can_add_tiny_text (line 42) | def test_can_add_tiny_text(self):
    method test_can_add_unsigned_decimal (line 52) | def test_can_add_unsigned_decimal(self):
    method test_can_create_table_if_not_exists (line 62) | def test_can_create_table_if_not_exists(self):
    method test_can_add_columns_with_constaint (line 75) | def test_can_add_columns_with_constaint(self):
    method test_add_column_comment (line 90) | def test_add_column_comment(self):
    method test_can_add_table_comment (line 102) | def test_can_add_table_comment(self):
    method test_can_add_columns_with_foreign_key_constaint (line 115) | def test_can_add_columns_with_foreign_key_constaint(self):
    method test_can_add_columns_with_foreign_key_constaint (line 139) | def test_can_add_columns_with_foreign_key_constaint(self):
    method test_can_advanced_table_creation (line 158) | def test_can_advanced_table_creation(self):
    method test_can_add_primary_constraint_without_column_name (line 187) | def test_can_add_primary_constraint_without_column_name(self):
    method test_can_advanced_table_creation2 (line 202) | def test_can_advanced_table_creation2(self):
    method test_can_add_columns_with_foreign_key_constraint_name (line 233) | def test_can_add_columns_with_foreign_key_constraint_name(self):
    method test_can_have_composite_keys (line 250) | def test_can_have_composite_keys(self):
    method test_can_have_column_primary_key (line 271) | def test_can_have_column_primary_key(self):
    method test_can_have_unsigned_columns (line 289) | def test_can_have_unsigned_columns(self):
    method test_can_have_default_blank_string (line 313) | def test_can_have_default_blank_string(self):
    method test_can_have_float_type (line 322) | def test_can_have_float_type(self):
    method test_has_table (line 331) | def test_has_table(self):
    method test_can_truncate (line 338) | def test_can_truncate(self):
    method test_can_rename_table (line 343) | def test_can_rename_table(self):
    method test_can_drop_table_if_exists (line 348) | def test_can_drop_table_if_exists(self):
    method test_can_drop_table (line 353) | def test_can_drop_table(self):
    method test_has_column (line 358) | def test_has_column(self):
    method test_can_enable_foreign_keys (line 366) | def test_can_enable_foreign_keys(self):
    method test_can_disable_foreign_keys (line 371) | def test_can_disable_foreign_keys(self):
    method test_can_truncate_without_foreign_keys (line 376) | def test_can_truncate_without_foreign_keys(self):
    method test_can_add_enum (line 388) | def test_can_add_enum(self):

FILE: tests/mysql/schema/test_mysql_schema_builder_alter.py
  class TestMySQLSchemaBuilderAlter (line 11) | class TestMySQLSchemaBuilderAlter(unittest.TestCase):
    method setUp (line 14) | def setUp(self):
    method test_can_add_columns (line 23) | def test_can_add_columns(self):
    method test_can_add_column_comments (line 36) | def test_can_add_column_comments(self):
    method test_can_add_table_comment (line 46) | def test_can_add_table_comment(self):
    method test_can_add_table_comment_with_no_columns (line 57) | def test_can_add_table_comment_with_no_columns(self):
    method test_can_add_column_after (line 67) | def test_can_add_column_after(self):
    method test_alter_rename (line 77) | def test_alter_rename(self):
    method test_alter_add_and_rename (line 89) | def test_alter_add_and_rename(self):
    method test_alter_add_and_rename_to_string (line 105) | def test_alter_add_and_rename_to_string(self):
    method test_alter_drop1 (line 121) | def test_alter_drop1(self):
    method test_alter_add_column_and_foreign_key (line 129) | def test_alter_add_column_and_foreign_key(self):
    method test_alter_drop_foreign_key (line 143) | def test_alter_drop_foreign_key(self):
    method test_alter_drop_foreign_key_shortcut (line 151) | def test_alter_drop_foreign_key_shortcut(self):
    method test_alter_drop_unique_constraint (line 159) | def test_alter_drop_unique_constraint(self):
    method test_alter_add_index (line 167) | def test_alter_add_index(self):
    method test_alter_drop_index (line 175) | def test_alter_drop_index(self):
    method test_alter_add_primary (line 183) | def test_alter_add_primary(self):
    method test_alter_drop_index_shortcut (line 193) | def test_alter_drop_index_shortcut(self):
    method test_alter_drop_unique_constraint_shortcut (line 201) | def test_alter_drop_unique_constraint_shortcut(self):
    method test_alter_drop_primary (line 209) | def test_alter_drop_primary(self):
    method test_change (line 217) | def test_change(self):
    method test_timestamp_alter_add_nullable_column (line 238) | def test_timestamp_alter_add_nullable_column(self):
    method test_drop_add_and_change (line 253) | def test_drop_add_and_change(self):
    method test_can_create_indexes (line 275) | def test_can_create_indexes(self):
    method test_can_add_column_enum (line 298) | def test_can_add_column_enum(self):
    method test_can_change_column_enum (line 310) | def test_can_change_column_enum(self):

FILE: tests/mysql/scopes/test_can_use_global_scopes.py
  class UserSoft (line 13) | class UserSoft(Model, SoftDeletesMixin):
  class User (line 17) | class User(Model):
  class TestMySQLGlobalScopes (line 21) | class TestMySQLGlobalScopes(unittest.TestCase):
    method test_can_use_global_scopes_on_select (line 22) | def test_can_use_global_scopes_on_select(self):
    method test_can_use_global_scopes_on_time (line 36) | def test_can_use_global_scopes_on_time(self):

FILE: tests/mysql/scopes/test_can_use_scopes.py
  class User (line 9) | class User(Model):
    method active (line 13) | def active(self, query, status):
    method gender (line 17) | def gender(self, query, status):
  class UserSoft (line 21) | class UserSoft(Model, SoftDeletesMixin):
  class TestMySQLScopes (line 25) | class TestMySQLScopes(unittest.TestCase):
    method test_can_get_sql (line 26) | def test_can_get_sql(self):
    method test_active_scope (line 30) | def test_active_scope(self):
    method test_active_scope_with_params (line 34) | def test_active_scope_with_params(self):
    method test_can_chain_scopes (line 38) | def test_can_chain_scopes(self):

FILE: tests/mysql/scopes/test_soft_delete.py
  class UserSoft (line 15) | class UserSoft(Model, SoftDeletesMixin):
  class UserSoftArchived (line 19) | class UserSoftArchived(Model, SoftDeletesMixin):
  class TestSoftDeleteScope (line 25) | class TestSoftDeleteScope(unittest.TestCase):
    method get_builder (line 26) | def get_builder(self, table="users"):
    method test_with_trashed (line 37) | def test_with_trashed(self):
    method test_force_delete (line 42) | def test_force_delete(self):
    method test_restore (line 47) | def test_restore(self):
    method test_force_delete_with_wheres (line 52) | def test_force_delete_with_wheres(self):
    method test_that_trashed_users_are_not_returned_by_default (line 59) | def test_that_trashed_users_are_not_returned_by_default(self):
    method test_only_trashed (line 64) | def test_only_trashed(self):
    method test_only_trashed_on_model (line 69) | def test_only_trashed_on_model(self):
    method test_can_change_column (line 73) | def test_can_change_column(self):
    method test_find_with_global_scope (line 77) | def test_find_with_global_scope(self):
    method test_find_with_trashed_scope (line 82) | def test_find_with_trashed_scope(self):
    method test_find_with_only_trashed_scope (line 87) | def test_find_with_only_trashed_scope(self):

FILE: tests/postgres/builder/test_postgres_query_builder.py
  class MockConnection (line 11) | class MockConnection:
    method make_connection (line 14) | def make_connection(self):
    method get_default_query_grammar (line 18) | def get_default_query_grammar(cls):
  class ModelTest (line 22) | class ModelTest(Model):
  class BaseTestQueryBuilder (line 26) | class BaseTestQueryBuilder:
    method get_builder (line 27) | def get_builder(self, table="users", dry=True):
    method test_sum (line 38) | def test_sum(self):
    method test_where_like (line 47) | def test_where_like(self):
    method test_where_not_like (line 56) | def test_where_not_like(self):
    method test_max (line 65) | def test_max(self):
    method test_min (line 74) | def test_min(self):
    method test_avg (line 83) | def test_avg(self):
    method test_all (line 91) | def test_all(self):
    method test_get (line 99) | def test_get(self):
    method test_first (line 107) | def test_first(self):
    method test_select (line 114) | def test_select(self):
    method test_add_select_no_table (line 122) | def test_add_select_no_table(self):
    method test_select_raw (line 138) | def test_select_raw(self):
    method test_create (line 146) | def test_create(self):
    method test_delete (line 156) | def test_delete(self):
    method test_where (line 164) | def test_where(self):
    method test_where_exists (line 172) | def test_where_exists(self):
    method test_limit (line 180) | def test_limit(self):
    method test_offset (line 188) | def test_offset(self):
    method test_join (line 196) | def test_join(self):
    method test_left_join (line 204) | def test_left_join(self):
    method test_right_join (line 212) | def test_right_join(self):
    method test_update (line 220) | def test_update(self):
    method test_count (line 245) | def test_count(self):
    method test_order_by_asc (line 253) | def test_order_by_asc(self):
    method test_order_by_desc (line 261) | def test_order_by_desc(self):
    method test_where_column (line 269) | def test_where_column(self):
    method test_where_not_in (line 277) | def test_where_not_in(self):
    method test_between (line 285) | def test_between(self):
    method test_not_between (line 293) | def test_not_between(self):
    method test_where_in (line 301) | def test_where_in(self):
    method test_where_null (line 310) | def test_where_null(self):
    method test_where_not_null (line 319) | def test_where_not_null(self):
    method test_having (line 328) | def test_having(self):
    method test_group_by (line 339) | def test_group_by(self):
    method test_builder_alone (line 348) | def test_builder_alone(self):
    method test_where_lt (line 369) | def test_where_lt(self):
    method test_where_lte (line 377) | def test_where_lte(self):
    method test_where_gt (line 385) | def test_where_gt(self):
    method test_where_gte (line 393) | def test_where_gte(self):
    method test_where_ne (line 401) | def test_where_ne(self):
    method test_or_where (line 409) | def test_or_where(self):
    method test_can_call_with_schema (line 417) | def test_can_call_with_schema(self):
    method test_truncate (line 430) | def test_truncate(self):
    method test_truncate_without_foreign_keys (line 438) | def test_truncate_without_foreign_keys(self):
    method test_shared_lock (line 446) | def test_shared_lock(self):
    method test_update_lock (line 454) | def test_update_lock(self):
  class PostgresQueryBuilderTest (line 463) | class PostgresQueryBuilderTest(BaseTestQueryBuilder, unittest.TestCase):
    method sum (line 466) | def sum(self):
    method max (line 473) | def max(self):
    method min (line 480) | def min(self):
    method avg (line 487) | def avg(self):
    method first (line 494) | def first(self):
    method all (line 501) | def all(self):
    method get (line 508) | def get(self):
    method select (line 515) | def select(self):
    method add_select_no_table (line 522) | def add_select_no_table(self):
    method select_raw (line 533) | def select_raw(self):
    method create (line 540) | def create(self):
    method delete (line 547) | def delete(self):
    method where (line 554) | def where(self):
    method where_exists (line 561) | def where_exists(self):
    method limit (line 568) | def limit(self):
    method offset (line 575) | def offset(self):
    method join (line 582) | def join(self):
    method left_join (line 588) | def left_join(self):
    method right_join (line 594) | def right_join(self):
    method update (line 600) | def update(self):
    method increment (line 606) | def increment(self):
    method decrement (line 612) | def decrement(self):
    method count (line 618) | def count(self):
    method order_by_asc (line 624) | def order_by_asc(self):
    method order_by_desc (line 630) | def order_by_desc(self):
    method where_column (line 636) | def where_column(self):
    method where_null (line 642) | def where_null(self):
    method where_not_null (line 648) | def where_not_null(self):
    method where_not_in (line 654) | def where_not_in(self):
    method where_in (line 660) | def where_in(self):
    method between (line 666) | def between(self):
    method not_between (line 672) | def not_between(self):
    method having (line 678) | def having(self):
    method group_by (line 684) | def group_by(self):
    method where_lt (line 690) | def where_lt(self):
    method where_lte (line 697) | def where_lte(self):
    method where_gt (line 704) | def where_gt(self):
    method where_gte (line 711) | def where_gte(self):
    method where_ne (line 718) | def where_ne(self):
    method or_where (line 725) | def or_where(self):
    method where_like (line 732) | def where_like(self):
    method where_not_like (line 739) | def where_not_like(self):
    method truncate (line 746) | def truncate(self):
    method truncate_without_foreign_keys (line 753) | def truncate_without_foreign_keys(self):
    method update_lock (line 760) | def update_lock(self):
    method shared_lock (line 767) | def shared_lock(self):
    method test_latest (line 774) | def test_latest(self):
    method test_oldest (line 782) | def test_oldest(self):
    method oldest (line 790) | def oldest(self):
    method latest (line 796) | def latest(self):

FILE: tests/postgres/builder/test_postgres_transaction.py
  class User (line 15) | class User(Model):
  class BaseTestQueryRelationships (line 19) | class BaseTestQueryRelationships(unittest.TestCase):
    method get_builder (line 22) | def get_builder(self, table="users"):
    method test_transaction (line 31) | def test_transaction(self):

FILE: tests/postgres/grammar/test_delete_grammar.py
  class BaseDeleteGrammarTest (line 8) | class BaseDeleteGrammarTest:
    method setUp (line 9) | def setUp(self):
    method test_can_compile_delete (line 12) | def test_can_compile_delete(self):
    method test_can_compile_delete_in (line 20) | def test_can_compile_delete_in(self):
    method test_can_compile_delete_with_where (line 28) | def test_can_compile_delete_with_where(self):
  class TestPostgresDeleteGrammar (line 43) | class TestPostgresDeleteGrammar(BaseDeleteGrammarTest, unittest.TestCase):
    method can_compile_delete (line 46) | def can_compile_delete(self):
    method can_compile_delete_in (line 56) | def can_compile_delete_in(self):
    method can_compile_delete_with_where (line 66) | def can_compile_delete_with_where(self):

FILE: tests/postgres/grammar/test_insert_grammar.py
  class BaseInsertGrammarTest (line 8) | class BaseInsertGrammarTest:
    method setUp (line 9) | def setUp(self):
    method test_can_compile_insert (line 12) | def test_can_compile_insert(self):
    method test_can_compile_insert_with_keywords (line 20) | def test_can_compile_insert_with_keywords(self):
    method test_can_compile_bulk_create (line 28) | def test_can_compile_bulk_create(self):
    method test_can_compile_bulk_create_qmark (line 44) | def test_can_compile_bulk_create_qmark(self):
  class TestPostgresUpdateGrammar (line 55) | class TestPostgresUpdateGrammar(BaseInsertGrammarTest, unittest.TestCase):
    method can_compile_insert (line 58) | def can_compile_insert(self):
    method can_compile_insert_with_keywords (line 66) | def can_compile_insert_with_keywords(self):
    method can_compile_bulk_create (line 72) | def can_compile_bulk_create(self):
    method can_compile_bulk_create_qmark (line 78) | def can_compile_bulk_create_qmark(self):

FILE: tests/postgres/grammar/test_select_grammar.py
  class TestPostgresGrammar (line 8) | class TestPostgresGrammar(BaseTestCaseSelectGrammar, unittest.TestCase):
    method can_compile_select (line 11) | def can_compile_select(self):
    method can_compile_with_columns (line 17) | def can_compile_with_columns(self):
    method can_compile_with_where (line 23) | def can_compile_with_where(self):
    method can_compile_with_several_where (line 29) | def can_compile_with_several_where(self):
    method can_compile_with_several_where_and_limit (line 35) | def can_compile_with_several_where_and_limit(self):
    method can_compile_with_sum (line 41) | def can_compile_with_sum(self):
    method can_compile_with_max (line 47) | def can_compile_with_max(self):
    method can_compile_with_max_and_columns (line 53) | def can_compile_with_max_and_columns(self):
    method can_compile_with_max_and_columns_different_order (line 59) | def can_compile_with_max_and_columns_different_order(self):
    method can_compile_with_order_by (line 65) | def can_compile_with_order_by(self):
    method can_compile_with_multiple_order_by (line 71) | def can_compile_with_multiple_order_by(self):
    method can_compile_with_group_by (line 79) | def can_compile_with_group_by(self):
    method can_compile_where_in (line 85) | def can_compile_where_in(self):
    method can_compile_where_in_empty (line 91) | def can_compile_where_in_empty(self):
    method can_compile_where_not_in (line 97) | def can_compile_where_not_in(self):
    method can_compile_where_null (line 103) | def can_compile_where_null(self):
    method can_compile_where_not_null (line 109) | def can_compile_where_not_null(self):
    method can_compile_where_raw (line 117) | def can_compile_where_raw(self):
    method can_compile_having_raw (line 123) | def can_compile_having_raw(self):
    method can_compile_select_raw (line 129) | def can_compile_select_raw(self):
    method can_compile_limit_and_offset (line 135) | def can_compile_limit_and_offset(self):
    method can_compile_select_raw_with_select (line 141) | def can_compile_select_raw_with_select(self):
    method can_compile_count (line 147) | def can_compile_count(self):
    method can_compile_count_column (line 154) | def can_compile_count_column(self):
    method can_compile_where_column (line 161) | def can_compile_where_column(self):
    method can_compile_or_where (line 168) | def can_compile_or_where(self):
    method can_grouped_where (line 174) | def can_grouped_where(self):
    method can_compile_sub_select (line 180) | def can_compile_sub_select(self):
    method can_compile_sub_select_from_lambda (line 189) | def can_compile_sub_select_from_lambda(self):
    method can_compile_sub_select_where (line 198) | def can_compile_sub_select_where(self):
    method can_compile_sub_select_value (line 207) | def can_compile_sub_select_value(self):
    method can_compile_complex_sub_select (line 216) | def can_compile_complex_sub_select(self):
    method can_compile_exists (line 227) | def can_compile_exists(self):
    method can_compile_not_exists (line 235) | def can_compile_not_exists(self):
    method can_compile_having (line 243) | def can_compile_having(self):
    method can_compile_having_order (line 249) | def can_compile_having_order(self):
    method can_compile_having_with_expression (line 255) | def can_compile_having_with_expression(self):
    method can_compile_order_by_and_first (line 261) | def can_compile_order_by_and_first(self):
    method can_compile_having_with_greater_than_expression (line 267) | def can_compile_having_with_greater_than_expression(self):
    method can_compile_join (line 273) | def can_compile_join(self):
    method can_compile_left_join (line 279) | def can_compile_left_join(self):
    method can_compile_multiple_join (line 285) | def can_compile_multiple_join(self):
    method can_compile_between (line 291) | def can_compile_between(self):
    method can_compile_not_between (line 297) | def can_compile_not_between(self):
    method test_can_compile_where_raw (line 303) | def test_can_compile_where_raw(self):
    method test_can_compile_having_raw (line 307) | def test_can_compile_having_raw(self):
    method test_can_compile_having_raw_order (line 317) | def test_can_compile_having_raw_order(self):
    method test_can_compile_where_raw_and_where_with_multiple_bindings (line 329) | def test_can_compile_where_raw_and_where_with_multiple_bindings(self):
    method test_can_compile_select_raw (line 339) | def test_can_compile_select_raw(self):
    method test_can_compile_select_raw_with_select (line 343) | def test_can_compile_select_raw_with_select(self):
    method can_compile_first_or_fail (line 347) | def can_compile_first_or_fail(self):
    method where_not_like (line 354) | def where_not_like(self):
    method where_like (line 361) | def where_like(self):
    method where_regexp (line 368) | def where_regexp(self):
    method where_not_regexp (line 375) | def where_not_regexp(self):
    method can_compile_join_clause (line 382) | def can_compile_join_clause(self):
    method can_compile_join_clause_with_value (line 395) | def can_compile_join_clause_with_value(self):
    method can_compile_join_clause_with_null (line 407) | def can_compile_join_clause_with_null(self):
    method can_compile_join_clause_with_not_null (line 420) | def can_compile_join_clause_with_not_null(self):
    method can_compile_join_clause_with_lambda (line 433) | def can_compile_join_clause_with_lambda(self):
    method can_compile_left_join_clause_with_lambda (line 446) | def can_compile_left_join_clause_with_lambda(self):
    method can_compile_right_join_clause_with_lambda (line 459) | def can_compile_right_join_clause_with_lambda(self):
    method shared_lock (line 472) | def shared_lock(self):
    method update_lock (line 479) | def update_lock(self):
    method can_user_where_raw_and_where (line 486) | def can_user_where_raw_and_where(self):
    method where_exists_with_lambda (line 492) | def where_exists_with_lambda(self):
    method where_not_exists_with_lambda (line 495) | def where_not_exists_with_lambda(self):
    method where_date (line 498) | def where_date(self):
    method or_where_null (line 503) | def or_where_null(self):
    method select_distinct (line 506) | def select_distinct(self):

FILE: tests/postgres/grammar/test_update_grammar.py
  class BaseTestCaseUpdateGrammar (line 10) | class BaseTestCaseUpdateGrammar:
    method setUp (line 11) | def setUp(self):
    method test_can_compile_update (line 16) | def test_can_compile_update(self):
    method test_can_compile_multiple_update (line 26) | def test_can_compile_multiple_update(self):
    method test_can_compile_update_with_multiple_where (line 36) | def test_can_compile_update_with_multiple_where(self):
    method test_raw_expression (line 65) | def test_raw_expression(self):
    method test_update_null (line 74) | def test_update_null(self):
  class TestPostgresUpdateGrammar (line 83) | class TestPostgresUpdateGrammar(BaseTestCaseUpdateGrammar, unittest.Test...
    method can_compile_update (line 86) | def can_compile_update(self):
    method raw_expression (line 94) | def raw_expression(self):
    method can_compile_multiple_update (line 102) | def can_compile_multiple_update(self):
    method can_compile_update_with_multiple_where (line 108) | def can_compile_update_with_multiple_where(self):
    method can_compile_increment (line 116) | def can_compile_increment(self):
    method can_compile_decrement (line 122) | def can_compile_decrement(self):

FILE: tests/postgres/relationships/test_postgres_relationships.py
  class Profile (line 9) | class Profile(Model):
  class Articles (line 13) | class Articles(Model):
    method logo (line 18) | def logo(self):
  class Logo (line 21) | class Logo(Model):
  class User (line 25) | class User(Model):
    method profile (line 33) | def profile(self):
    method articles (line 37) | def articles(self):
    method get_is_admin (line 40) | def get_is_admin(self):
  class TestRelationships (line 43) | class TestRelationships(unittest.TestCase):
    method test_relationship_can_be_callable (line 46) | def test_relationship_can_be_callable(self):
    method test_can_access_relationship (line 52) | def test_can_access_relationship(self):
    method test_can_access_has_many_relationship (line 56) | def test_can_access_has_many_relationship(self):
    method test_can_access_relationship_multiple_times (line 60) | def test_can_access_relationship_multiple_times(self):
    method test_loading (line 65) | def test_loading(self):
    method test_casting (line 70) | def test_casting(self):
    method test_setting (line 75) | def test_setting(self):
    method test_relationship_has (line 82) | def test_relationship_has(self):
    method test_relationship_has_off_builder (line 91) | def test_relationship_has_off_builder(self):
    method test_relationship_multiple_has (line 100) | def test_relationship_multiple_has(self):
    method test_nested_has (line 114) | def test_nested_has(self):
    method test_relationship_where_has (line 124) | def test_relationship_where_has(self):

FILE: tests/postgres/schema/test_postgres_schema_builder.py
  class TestPostgresSchemaBuilder (line 9) | class TestPostgresSchemaBuilder(unittest.TestCase):
    method setUp (line 12) | def setUp(self):
    method test_can_add_columns (line 21) | def test_can_add_columns(self):
    method test_can_add_tiny_text (line 34) | def test_can_add_tiny_text(self):
    method test_can_add_unsigned_decimal (line 43) | def test_can_add_unsigned_decimal(self):
    method test_can_create_table_if_not_exists (line 53) | def test_can_create_table_if_not_exists(self):
    method test_can_add_column_comment (line 66) | def test_can_add_column_comment(self):
    method test_can_add_table_comment (line 79) | def test_can_add_table_comment(self):
    method test_can_truncate (line 93) | def test_can_truncate(self):
    method test_can_rename_table (line 98) | def test_can_rename_table(self):
    method test_can_drop_table_if_exists (line 103) | def test_can_drop_table_if_exists(self):
    method test_can_drop_table (line 108) | def test_can_drop_table(self):
    method test_has_column (line 113) | def test_has_column(self):
    method test_can_add_columns_with_constaint (line 121) | def test_can_add_columns_with_constaint(self):
    method test_can_add_columns_with_long_text (line 135) | def test_can_add_columns_with_long_text(self):
    method test_can_have_unsigned_columns (line 144) | def test_can_have_unsigned_columns(self):
    method test_can_add_columns_with_foreign_key_constaint (line 164) | def test_can_add_columns_with_foreign_key_constaint(self):
    method test_can_advanced_table_creation (line 181) | def test_can_advanced_table_creation(self):
    method test_can_advanced_table_creation2 (line 204) | def test_can_advanced_table_creation2(self):
    method test_can_add_uuid_column (line 243) | def test_can_add_uuid_column(self):
    method test_can_add_columns_with_foreign_key_constraint_name (line 261) | def test_can_add_columns_with_foreign_key_constraint_name(self):
    method test_can_have_composite_keys (line 278) | def test_can_have_composite_keys(self):
    method test_can_have_column_primary_key (line 298) | def test_can_have_column_primary_key(self):
    method test_can_add_other_integer_types_column (line 316) | def test_can_add_other_integer_types_column(self):
    method test_can_add_binary_column (line 331) | def test_can_add_binary_column(self):
    method test_can_have_float_type (line 341) | def test_can_have_float_type(self):
    method test_can_enable_foreign_keys (line 350) | def test_can_enable_foreign_keys(self):
    method test_can_disable_foreign_keys (line 355) | def test_can_disable_foreign_keys(self):
    method test_can_truncate_without_foreign_keys (line 360) | def test_can_truncate_without_foreign_keys(self):
    method test_can_add_enum (line 372) | def test_can_add_enum(self):

FILE: tests/postgres/schema/test_postgres_schema_builder_alter.py
  class TestPostgresSchemaBuilderAlter (line 10) | class TestPostgresSchemaBuilderAlter(unittest.TestCase):
    method setUp (line 13) | def setUp(self):
    method test_can_add_columns (line 22) | def test_can_add_columns(self):
    method test_can_add_column_comments (line 35) | def test_can_add_column_comments(self):
    method test_can_add_table_comment (line 48) | def test_can_add_table_comment(self):
    method test_alter_ren
Condensed preview — 224 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,122K chars).
[
  {
    "path": ".deepsource.toml",
    "chars": 203,
    "preview": "# generated by deepsource.io\nversion = 1\n\ntest_patterns = [\n  'tests/**/*.py'\n]\n\nexclude_patterns = [\n  'databases/migra"
  },
  {
    "path": ".env-example",
    "chars": 283,
    "preview": "\nRUN_MYSQL_DATABASE=False\n\nMYSQL_DATABASE_HOST=\nMYSQL_DATABASE_USER=\nMYSQL_DATABASE_PASSWORD=\nMYSQL_DATABASE_DATABASE=\nM"
  },
  {
    "path": ".envrc",
    "chars": 23,
    "preview": "use asdf\nlayout python\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 1010,
    "preview": "---\nname: Bug report\nabout: A bug would be defined as an issue / problem in the original requirement. If the feature wor"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 515,
    "preview": "---\nname: Feature request or enhancement\nabout: Suggest an idea or improvement for this project.\ntitle: ''\nlabels: enhan"
  },
  {
    "path": ".github/workflows/pythonapp.yml",
    "chars": 2224,
    "preview": "name: Test Application\n\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-20.04\n\n    services:\n      postgres"
  },
  {
    "path": ".github/workflows/pythonpublish.yml",
    "chars": 2669,
    "preview": "name: Upload Python Package\n\non:\n  release:\n    types: [created]\n\njobs:\n  build:\n    runs-on: ubuntu-20.04\n\n    services"
  },
  {
    "path": ".gitignore",
    "chars": 242,
    "preview": "venv\n.direnv\n.python-version\n.vscode\n.pytest_*\n**/*__pycache__*\n**/*.DS_Store*\nmasonite_validation*\ndist\n.env\n*.db\n*.sql"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 612,
    "preview": "repos:\n  - repo: https://github.com/psf/black\n    rev: 25.1.0\n    hooks:\n      - id: black\n        exclude: |\n          "
  },
  {
    "path": ".pypirc",
    "chars": 90,
    "preview": "[distutils]\nindex-servers =\n  pypi\n  pypitest\n\n[pypi]\nusername=username\npassword=password\n"
  },
  {
    "path": ".tool-versions",
    "chars": 14,
    "preview": "python 3.8.10\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 5373,
    "preview": "# Contributing Guide\n\nThis guide is intended to explain how to contribute to this project.\n\n## Preface\n\nNote that you do"
  },
  {
    "path": "LICENSE",
    "chars": 1071,
    "preview": "MIT License\n\nCopyright (c) 2020 Joseph Mancuso\n\nPermission is hereby granted, free of charge, to any person obtaining a "
  },
  {
    "path": "MANIFEST.in",
    "chars": 79,
    "preview": "# include src/package/some/directory/*\ninclude src/masoniteorm/commands/stubs/*"
  },
  {
    "path": "README.md",
    "chars": 2917,
    "preview": "<p align=\"center\">\n  <img src=\"https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4trhpkkdbbzutc5ufxi9.png\" width="
  },
  {
    "path": "TODO.md",
    "chars": 430,
    "preview": "- [x] fix scopes - need to find a new way to perform scopes\n\n- [x] scopes need to be set on the model and then passed of"
  },
  {
    "path": "app/observers/UserObserver.py",
    "chars": 2279,
    "preview": "\"\"\"User Observer\"\"\"\n\nfrom masoniteorm.models import Model\n\n\nclass UserObserver:\n    def created(self, clients):\n        "
  },
  {
    "path": "cc.py",
    "chars": 1071,
    "preview": "\"\"\"Sandbox experimental file used to quickly feature test features of the package\n\"\"\"\n\nfrom src.masoniteorm.query import"
  },
  {
    "path": "conda/conda_build_config.yaml",
    "chars": 40,
    "preview": "python:\n  - 3.6\n  - 3.7\n  - 3.8\n  - 3.9\n"
  },
  {
    "path": "conda/meta.yaml",
    "chars": 428,
    "preview": "{% set data = load_setup_py_data() %}\n\npackage:\n  name: masonite-orm\n  version: {{ data['version'] }}\n\nsource:\n  path: ."
  },
  {
    "path": "config/test-database.py",
    "chars": 661,
    "preview": "from src.masoniteorm.connections import ConnectionResolver\n\nDATABASES = {\n  \"default\": \"mysql\",\n  \"mysql\": {\n    \"host\":"
  },
  {
    "path": "databases/migrations/2018_01_09_043202_create_users_table.py",
    "chars": 886,
    "preview": "from src.masoniteorm.migrations import Migration\nfrom tests.User import User\n\n\nclass CreateUsersTable(Migration):\n\n    d"
  },
  {
    "path": "databases/migrations/2020_04_17_000000_create_friends_table.py",
    "chars": 436,
    "preview": "from src.masoniteorm.migrations.Migration import Migration\n\nclass CreateFriendsTable(Migration):\n\n    def up(self):  \n  "
  },
  {
    "path": "databases/migrations/2020_04_17_00000_create_articles_table.py",
    "chars": 430,
    "preview": "from src.masoniteorm.migrations.Migration import Migration\n\nclass CreateArticlesTable(Migration):\n\n    def up(self):  \n "
  },
  {
    "path": "databases/migrations/2020_10_20_152904_create_table_schema_migration.py",
    "chars": 486,
    "preview": "\"\"\"CreateTableSchemaMigration Migration.\"\"\"\n\nfrom src.masoniteorm.migrations import Migration\n\n\nclass CreateTableSchemaM"
  },
  {
    "path": "databases/migrations/__init__.py",
    "chars": 50,
    "preview": "import os\nimport sys\nsys.path.append(os.getcwd())\n"
  },
  {
    "path": "databases/seeds/database_seeder.py",
    "chars": 248,
    "preview": "\"\"\"Base Database Seeder Module.\"\"\"\n\nfrom src.masoniteorm.seeds import Seeder\nfrom .user_table_seeder import UserTableSee"
  },
  {
    "path": "databases/seeds/user_table_seeder.py",
    "chars": 414,
    "preview": "\"\"\"UserTableSeeder Seeder.\"\"\"\n\nfrom src.masoniteorm.seeds import Seeder\nfrom src.masoniteorm.factories import Factory as"
  },
  {
    "path": "makefile",
    "chars": 1230,
    "preview": "SHELL := /bin/bash\n\ninit: .env .bootstrapped-pip .git/hooks/pre-commit\ninit-ci:\n\ttouch .ignore-pre-commit\n\tmake init\n\n.b"
  },
  {
    "path": "orm",
    "chars": 1167,
    "preview": "\"\"\"Craft Command.\n\nThis module is really used for backup only if the masonite CLI cannot import this for you.\nThis can b"
  },
  {
    "path": "pyproject.toml",
    "chars": 428,
    "preview": "[tool.black]\ntarget-version = ['py38']\ninclude = '\\.pyi?$'\nline-length = 79\n\n[tool.isort]\nprofile = \"black\"\nmulti_line_o"
  },
  {
    "path": "pytest.ini",
    "chars": 57,
    "preview": "[pytest]\nenv = \n    D:DB_CONFIG_PATH=config/test-database"
  },
  {
    "path": "requirements.dev",
    "chars": 72,
    "preview": "flake8-pyproject\nblack\nfaker\npytest\npytest-cov\npytest-env\npymysql\nisort\n"
  },
  {
    "path": "requirements.txt",
    "chars": 98,
    "preview": "inflection==0.3.1\npsycopg2-binary\npyodbc\npendulum>=2.1,<3.1\ncleo>=0.8.0,<0.9\npython-dotenv==0.14.0"
  },
  {
    "path": "setup.py",
    "chars": 4749,
    "preview": "from setuptools import setup\n\nwith open(\"README.md\", \"r\") as fh:\n    long_description = fh.read()\n\nsetup(\n    name=\"maso"
  },
  {
    "path": "src/masoniteorm/.gitignore",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/masoniteorm/__init__.py",
    "chars": 65,
    "preview": "from .models import Model\nfrom .factories.Factory import Factory\n"
  },
  {
    "path": "src/masoniteorm/collection/Collection.py",
    "chars": 16668,
    "preview": "import json\nimport random\nimport operator\nfrom functools import reduce\n\n\nclass Collection:\n    \"\"\"Wraps various data typ"
  },
  {
    "path": "src/masoniteorm/collection/__init__.py",
    "chars": 35,
    "preview": "from .Collection import Collection\n"
  },
  {
    "path": "src/masoniteorm/commands/CanOverrideConfig.py",
    "chars": 464,
    "preview": "from cleo import Command\n\n\nclass CanOverrideConfig(Command):\n    def __init__(self):\n        super().__init__()\n        "
  },
  {
    "path": "src/masoniteorm/commands/CanOverrideOptionsDefault.py",
    "chars": 988,
    "preview": "from inflection import underscore\n\n\nclass CanOverrideOptionsDefault:\n    \"\"\"Command mixin to allow to override optional "
  },
  {
    "path": "src/masoniteorm/commands/Command.py",
    "chars": 186,
    "preview": "from .CanOverrideConfig import CanOverrideConfig\nfrom .CanOverrideOptionsDefault import CanOverrideOptionsDefault\n\n\nclas"
  },
  {
    "path": "src/masoniteorm/commands/Entry.py",
    "chars": 1193,
    "preview": "\"\"\"Craft Command.\n\nThis module is really used for backup only if the masonite CLI cannot import this for you.\nThis can b"
  },
  {
    "path": "src/masoniteorm/commands/MakeMigrationCommand.py",
    "chars": 1607,
    "preview": "import datetime\nimport os\nimport pathlib\n\nfrom inflection import camelize, tableize\n\nfrom .Command import Command\n\n\nclas"
  },
  {
    "path": "src/masoniteorm/commands/MakeModelCommand.py",
    "chars": 2593,
    "preview": "import os\nimport pathlib\n\nfrom inflection import camelize, tableize, underscore\n\nfrom .Command import Command\n\n\nclass Ma"
  },
  {
    "path": "src/masoniteorm/commands/MakeModelDocstringCommand.py",
    "chars": 1371,
    "preview": "from ..config import load_config\nfrom .Command import Command\n\n\nclass MakeModelDocstringCommand(Command):\n    \"\"\"\n    Ge"
  },
  {
    "path": "src/masoniteorm/commands/MakeObserverCommand.py",
    "chars": 1578,
    "preview": "import os\nimport pathlib\n\nfrom inflection import camelize, underscore\n\nfrom .Command import Command\n\n\nclass MakeObserver"
  },
  {
    "path": "src/masoniteorm/commands/MakeSeedCommand.py",
    "chars": 1372,
    "preview": "import os\nimport pathlib\n\nfrom inflection import camelize, underscore\n\nfrom .Command import Command\n\n\nclass MakeSeedComm"
  },
  {
    "path": "src/masoniteorm/commands/MigrateCommand.py",
    "chars": 1646,
    "preview": "import os\n\nfrom ..migrations import Migration\nfrom .Command import Command\n\n\nclass MigrateCommand(Command):\n    \"\"\"\n    "
  },
  {
    "path": "src/masoniteorm/commands/MigrateFreshCommand.py",
    "chars": 1505,
    "preview": "from ..migrations import Migration\n\nfrom .Command import Command\n\n\nclass MigrateFreshCommand(Command):\n    \"\"\"\n    Drops"
  },
  {
    "path": "src/masoniteorm/commands/MigrateRefreshCommand.py",
    "chars": 1498,
    "preview": "from ..migrations import Migration\n\nfrom .Command import Command\n\n\nclass MigrateRefreshCommand(Command):\n    \"\"\"\n    Rol"
  },
  {
    "path": "src/masoniteorm/commands/MigrateResetCommand.py",
    "chars": 786,
    "preview": "from ..migrations import Migration\nfrom .Command import Command\n\n\nclass MigrateResetCommand(Command):\n    \"\"\"\n    Reset "
  },
  {
    "path": "src/masoniteorm/commands/MigrateRollbackCommand.py",
    "chars": 907,
    "preview": "from ..migrations import Migration\nfrom .Command import Command\n\n\nclass MigrateRollbackCommand(Command):\n    \"\"\"\n    Rol"
  },
  {
    "path": "src/masoniteorm/commands/MigrateStatusCommand.py",
    "chars": 1590,
    "preview": "from ..migrations import Migration\nfrom .Command import Command\n\n\nclass MigrateStatusCommand(Command):\n    \"\"\"\n    Displ"
  },
  {
    "path": "src/masoniteorm/commands/SeedRunCommand.py",
    "chars": 1112,
    "preview": "from inflection import camelize, underscore\n\nfrom ..seeds import Seeder\nfrom .Command import Command\n\n\nclass SeedRunComm"
  },
  {
    "path": "src/masoniteorm/commands/ShellCommand.py",
    "chars": 7216,
    "preview": "import subprocess\nimport os\nimport re\nimport shlex\nfrom collections import OrderedDict\n\nfrom ..config import load_config"
  },
  {
    "path": "src/masoniteorm/commands/__init__.py",
    "chars": 719,
    "preview": "import os\nimport sys\n\nsys.path.append(os.getcwd())\n\nfrom .MigrateCommand import MigrateCommand\nfrom .MigrateRollbackComm"
  },
  {
    "path": "src/masoniteorm/commands/stubs/create_migration.stub",
    "chars": 437,
    "preview": "\"\"\"__MIGRATION_NAME__ Migration.\"\"\"\n\nfrom masoniteorm.migrations import Migration\n\n\nclass __MIGRATION_NAME__(Migration):"
  },
  {
    "path": "src/masoniteorm/commands/stubs/create_seed.stub",
    "chars": 171,
    "preview": "\"\"\"__SEEDER_NAME__ Seeder.\"\"\"\n\nfrom masoniteorm.seeds import Seeder\n\n\nclass __SEEDER_NAME__(Seeder):\n    def run(self):\n"
  },
  {
    "path": "src/masoniteorm/commands/stubs/model.stub",
    "chars": 124,
    "preview": "\"\"\" __CLASS__ Model \"\"\"\n\nfrom masoniteorm.models import Model\n\n\nclass __CLASS__(Model):\n    \"\"\"__CLASS__ Model\"\"\"\n\n    p"
  },
  {
    "path": "src/masoniteorm/commands/stubs/observer.stub",
    "chars": 2601,
    "preview": "\"\"\"__CLASS__ Observer\"\"\"\n\nfrom masoniteorm.models import Model\n\n\nclass __CLASS__Observer:\n    def created(self, __MODEL_"
  },
  {
    "path": "src/masoniteorm/commands/stubs/table_migration.stub",
    "chars": 419,
    "preview": "\"\"\"__MIGRATION_NAME__ Migration.\"\"\"\n\nfrom masoniteorm.migrations import Migration\n\n\nclass __MIGRATION_NAME__(Migration):"
  },
  {
    "path": "src/masoniteorm/config.py",
    "chars": 4151,
    "preview": "import os\nimport pydoc\nimport urllib.parse as urlparse\n\nfrom .exceptions import ConfigurationNotFound\nfrom .exceptions i"
  },
  {
    "path": "src/masoniteorm/connections/.gitignore",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/masoniteorm/connections/BaseConnection.py",
    "chars": 2851,
    "preview": "import logging\nfrom timeit import default_timer as timer\nfrom .ConnectionResolver import ConnectionResolver\n\n\nclass Base"
  },
  {
    "path": "src/masoniteorm/connections/ConnectionFactory.py",
    "chars": 1652,
    "preview": "from ..config import load_config\n\n\nclass ConnectionFactory:\n    \"\"\"Class for controlling the registration and creation o"
  },
  {
    "path": "src/masoniteorm/connections/ConnectionResolver.py",
    "chars": 3949,
    "preview": "from contextlib import contextmanager\n\n\nclass ConnectionResolver:\n    _connection_details = {}\n    _connections = {}\n   "
  },
  {
    "path": "src/masoniteorm/connections/MSSQLConnection.py",
    "chars": 5751,
    "preview": "from ..exceptions import DriverNotFound\nfrom .BaseConnection import BaseConnection\nfrom ..query.grammars import MSSQLGra"
  },
  {
    "path": "src/masoniteorm/connections/MySQLConnection.py",
    "chars": 6811,
    "preview": "from ..exceptions import DriverNotFound\nfrom .BaseConnection import BaseConnection\nfrom ..query.grammars import MySQLGra"
  },
  {
    "path": "src/masoniteorm/connections/PostgresConnection.py",
    "chars": 7202,
    "preview": "from ..exceptions import DriverNotFound\nfrom .BaseConnection import BaseConnection\nfrom ..query.grammars import Postgres"
  },
  {
    "path": "src/masoniteorm/connections/SQLiteConnection.py",
    "chars": 5132,
    "preview": "from ..query.grammars import SQLiteGrammar\nfrom .BaseConnection import BaseConnection\nfrom ..schema.platforms import SQL"
  },
  {
    "path": "src/masoniteorm/connections/__init__.py",
    "chars": 288,
    "preview": "from .ConnectionResolver import ConnectionResolver\nfrom .ConnectionFactory import ConnectionFactory\nfrom .MySQLConnectio"
  },
  {
    "path": "src/masoniteorm/exceptions.py",
    "chars": 465,
    "preview": "class DriverNotFound(Exception):\n    pass\n\n\nclass ModelNotFound(Exception):\n    pass\n\n\nclass HTTP404(Exception):\n    pas"
  },
  {
    "path": "src/masoniteorm/expressions/__init__.py",
    "chars": 65,
    "preview": "from .expressions import Raw\nfrom .expressions import JoinClause\n"
  },
  {
    "path": "src/masoniteorm/expressions/expressions.py",
    "chars": 7565,
    "preview": "from ..helpers.misc import deprecated\n\n\nclass QueryExpression:\n    \"\"\"A helper class to manage query expressions.\"\"\"\n\n  "
  },
  {
    "path": "src/masoniteorm/factories/Factory.py",
    "chars": 3581,
    "preview": "from faker import Faker\nimport random\n\n\nclass Factory:\n    _factories = {}\n    _after_creates = {}\n    _faker = None\n\n  "
  },
  {
    "path": "src/masoniteorm/factories/__init__.py",
    "chars": 29,
    "preview": "from .Factory import Factory\n"
  },
  {
    "path": "src/masoniteorm/helpers/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/masoniteorm/helpers/misc.py",
    "chars": 535,
    "preview": "\"\"\"Module for miscellaneous helper methods.\"\"\"\n\nimport warnings\n\n\ndef deprecated(message):\n    warnings.simplefilter(\"de"
  },
  {
    "path": "src/masoniteorm/migrations/Migration.py",
    "chars": 10805,
    "preview": "import os\nfrom os import listdir\nfrom os.path import isfile, join\nfrom pydoc import locate\n\nfrom inflection import camel"
  },
  {
    "path": "src/masoniteorm/migrations/__init__.py",
    "chars": 33,
    "preview": "from .Migration import Migration\n"
  },
  {
    "path": "src/masoniteorm/models/MigrationModel.py",
    "chars": 191,
    "preview": "from .Model import Model\n\n\nclass MigrationModel(Model):\n    __table__ = \"migrations\"\n    __fillable__ = [\"migration\", \"b"
  },
  {
    "path": "src/masoniteorm/models/Model.py",
    "chars": 34225,
    "preview": "import inspect\nimport json\nimport logging\nfrom datetime import date as datetimedate\nfrom datetime import datetime\nfrom d"
  },
  {
    "path": "src/masoniteorm/models/Model.pyi",
    "chars": 20712,
    "preview": "from typing import Any, Dict\n\nfrom typing_extensions import Self\n\nfrom ..query.QueryBuilder import QueryBuilder\n\nclass M"
  },
  {
    "path": "src/masoniteorm/models/Pivot.py",
    "chars": 74,
    "preview": "from .Model import Model\n\n\nclass Pivot(Model):\n    __primary_key__ = \"id\"\n"
  },
  {
    "path": "src/masoniteorm/models/__init__.py",
    "chars": 25,
    "preview": "from .Model import Model\n"
  },
  {
    "path": "src/masoniteorm/observers/ObservesEvents.py",
    "chars": 850,
    "preview": "class ObservesEvents:\n    def observe_events(self, model, event):\n        if model.__has_events__ == True:\n            f"
  },
  {
    "path": "src/masoniteorm/observers/__init__.py",
    "chars": 43,
    "preview": "from .ObservesEvents import ObservesEvents\n"
  },
  {
    "path": "src/masoniteorm/pagination/BasePaginator.py",
    "chars": 187,
    "preview": "import json\n\n\nclass BasePaginator:\n    def __iter__(self):\n        for result in self.result:\n            yield result\n\n"
  },
  {
    "path": "src/masoniteorm/pagination/LengthAwarePaginator.py",
    "chars": 1091,
    "preview": "import math\nfrom .BasePaginator import BasePaginator\n\n\nclass LengthAwarePaginator(BasePaginator):\n    def __init__(self,"
  },
  {
    "path": "src/masoniteorm/pagination/SimplePaginator.py",
    "chars": 898,
    "preview": "from .BasePaginator import BasePaginator\n\n\nclass SimplePaginator(BasePaginator):\n    def __init__(self, result, per_page"
  },
  {
    "path": "src/masoniteorm/pagination/__init__.py",
    "chars": 100,
    "preview": "from .LengthAwarePaginator import LengthAwarePaginator\nfrom .SimplePaginator import SimplePaginator\n"
  },
  {
    "path": "src/masoniteorm/providers/ORMProvider.py",
    "chars": 971,
    "preview": "from masonite.providers import Provider\n\nfrom masoniteorm.commands import (\n    MigrateCommand,\n    MigrateRollbackComma"
  },
  {
    "path": "src/masoniteorm/providers/__init__.py",
    "chars": 37,
    "preview": "from .ORMProvider import ORMProvider\n"
  },
  {
    "path": "src/masoniteorm/query/EagerRelation.py",
    "chars": 1403,
    "preview": "class EagerRelations:\n    def __init__(self, relation=None):\n        self.eagers = []\n        self.nested_eagers = {}\n  "
  },
  {
    "path": "src/masoniteorm/query/QueryBuilder.py",
    "chars": 71028,
    "preview": "import inspect\nfrom copy import deepcopy\nfrom datetime import datetime\nfrom typing import Any, Callable, Dict, List, Opt"
  },
  {
    "path": "src/masoniteorm/query/__init__.py",
    "chars": 39,
    "preview": "from .QueryBuilder import QueryBuilder\n"
  },
  {
    "path": "src/masoniteorm/query/grammars/BaseGrammar.py",
    "chars": 32184,
    "preview": "import re\n\nfrom ...expressions.expressions import (\n    JoinClause,\n    OnClause,\n    SelectExpression,\n    SubGroupExpr"
  },
  {
    "path": "src/masoniteorm/query/grammars/MSSQLGrammar.py",
    "chars": 5289,
    "preview": "from .BaseGrammar import BaseGrammar\n\n\nclass MSSQLGrammar(BaseGrammar):\n    \"\"\"Microsoft SQL Server grammar class.\"\"\"\n\n "
  },
  {
    "path": "src/masoniteorm/query/grammars/MySQLGrammar.py",
    "chars": 6752,
    "preview": "from .BaseGrammar import BaseGrammar\n\n\nclass MySQLGrammar(BaseGrammar):\n    \"\"\"MySQL grammar class.\"\"\"\n\n    aggregate_op"
  },
  {
    "path": "src/masoniteorm/query/grammars/PostgresGrammar.py",
    "chars": 5896,
    "preview": "import re\n\nfrom .BaseGrammar import BaseGrammar\n\n\nclass PostgresGrammar(BaseGrammar):\n    \"\"\"Postgres grammar class.\"\"\"\n"
  },
  {
    "path": "src/masoniteorm/query/grammars/SQLiteGrammar.py",
    "chars": 6288,
    "preview": "import re\n\nfrom .BaseGrammar import BaseGrammar\n\n\nclass SQLiteGrammar(BaseGrammar):\n    \"\"\"SQLite grammar class.\"\"\"\n\n   "
  },
  {
    "path": "src/masoniteorm/query/grammars/__init__.py",
    "chars": 164,
    "preview": "from .MSSQLGrammar import MSSQLGrammar\nfrom .MySQLGrammar import MySQLGrammar\nfrom .PostgresGrammar import PostgresGramm"
  },
  {
    "path": "src/masoniteorm/query/processors/MSSQLPostProcessor.py",
    "chars": 2277,
    "preview": "class MSSQLPostProcessor:\n    \"\"\"Post processor classes are responsable for modifying the result after a query.\n\n    Pos"
  },
  {
    "path": "src/masoniteorm/query/processors/MySQLPostProcessor.py",
    "chars": 2025,
    "preview": "class MySQLPostProcessor:\n    \"\"\"Post processor classes are responsable for modifying the result after a query.\n\n    Pos"
  },
  {
    "path": "src/masoniteorm/query/processors/PostgresPostProcessor.py",
    "chars": 2074,
    "preview": "class PostgresPostProcessor:\n    \"\"\"Post processor classes are responsable for modifying the result after a query.\n\n    "
  },
  {
    "path": "src/masoniteorm/query/processors/SQLitePostProcessor.py",
    "chars": 2037,
    "preview": "class SQLitePostProcessor:\n    \"\"\"Post processor classes are responsable for modifying the result after a query.\n\n    Po"
  },
  {
    "path": "src/masoniteorm/query/processors/__init__.py",
    "chars": 212,
    "preview": "from .MSSQLPostProcessor import MSSQLPostProcessor\nfrom .MySQLPostProcessor import MySQLPostProcessor\nfrom .PostgresPost"
  },
  {
    "path": "src/masoniteorm/relationships/BaseRelationship.py",
    "chars": 5685,
    "preview": "class BaseRelationship:\n    def __init__(self, fn, local_key=None, foreign_key=None):\n        if isinstance(fn, str):\n  "
  },
  {
    "path": "src/masoniteorm/relationships/BelongsTo.py",
    "chars": 4123,
    "preview": "from ..collection import Collection\nfrom .BaseRelationship import BaseRelationship\n\n\nclass BelongsTo(BaseRelationship):\n"
  },
  {
    "path": "src/masoniteorm/relationships/BelongsToMany.py",
    "chars": 20117,
    "preview": "import pendulum\nfrom inflection import singularize\n\nfrom ..collection import Collection\nfrom ..models.Pivot import Pivot"
  },
  {
    "path": "src/masoniteorm/relationships/HasMany.py",
    "chars": 2080,
    "preview": "from ..collection import Collection\nfrom .BaseRelationship import BaseRelationship\n\n\nclass HasMany(BaseRelationship):\n  "
  },
  {
    "path": "src/masoniteorm/relationships/HasManyThrough.py",
    "chars": 9447,
    "preview": "from ..collection import Collection\nfrom .BaseRelationship import BaseRelationship\n\n\nclass HasManyThrough(BaseRelationsh"
  },
  {
    "path": "src/masoniteorm/relationships/HasOne.py",
    "chars": 3788,
    "preview": "from ..collection import Collection\nfrom .BaseRelationship import BaseRelationship\n\n\nclass HasOne(BaseRelationship):\n   "
  },
  {
    "path": "src/masoniteorm/relationships/HasOneThrough.py",
    "chars": 9264,
    "preview": "from ..collection import Collection\nfrom .BaseRelationship import BaseRelationship\n\n\nclass HasOneThrough(BaseRelationshi"
  },
  {
    "path": "src/masoniteorm/relationships/MorphMany.py",
    "chars": 5349,
    "preview": "from ..collection import Collection\nfrom ..config import load_config\nfrom .BaseRelationship import BaseRelationship\n\n\ncl"
  },
  {
    "path": "src/masoniteorm/relationships/MorphOne.py",
    "chars": 5392,
    "preview": "from ..collection import Collection\nfrom ..config import load_config\nfrom .BaseRelationship import BaseRelationship\n\n\ncl"
  },
  {
    "path": "src/masoniteorm/relationships/MorphTo.py",
    "chars": 3996,
    "preview": "from ..collection import Collection\nfrom ..config import load_config\nfrom .BaseRelationship import BaseRelationship\n\n\ncl"
  },
  {
    "path": "src/masoniteorm/relationships/MorphToMany.py",
    "chars": 3911,
    "preview": "from ..collection import Collection\nfrom ..config import load_config\nfrom .BaseRelationship import BaseRelationship\n\n\ncl"
  },
  {
    "path": "src/masoniteorm/relationships/__init__.py",
    "chars": 495,
    "preview": "from .BelongsTo import BelongsTo as belongs_to\nfrom .BelongsToMany import BelongsToMany as belongs_to_many\nfrom .HasMany"
  },
  {
    "path": "src/masoniteorm/schema/Blueprint.py",
    "chars": 33315,
    "preview": "class Blueprint:\n    \"\"\"Used for building schemas for creating, modifying or altering schema.\"\"\"\n\n    def __init__(\n    "
  },
  {
    "path": "src/masoniteorm/schema/Column.py",
    "chars": 3313,
    "preview": "class Column:\n    \"\"\"Used for creating or modifying columns.\"\"\"\n\n    def __init__(\n        self,\n        name,\n        c"
  },
  {
    "path": "src/masoniteorm/schema/ColumnDiff.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/masoniteorm/schema/Constraint.py",
    "chars": 188,
    "preview": "class Constraint:\n    def __init__(self, name, constraint_type, columns=None):\n        self.name = name\n        self.con"
  },
  {
    "path": "src/masoniteorm/schema/ForeignKeyConstraint.py",
    "chars": 791,
    "preview": "class ForeignKeyConstraint:\n    def __init__(self, column, foreign_table, foreign_column, name=None):\n        self.colum"
  },
  {
    "path": "src/masoniteorm/schema/Index.py",
    "chars": 154,
    "preview": "class Index:\n    def __init__(self, column, name, index_type):\n        self.column = column\n        self.name = name\n   "
  },
  {
    "path": "src/masoniteorm/schema/Schema.py",
    "chars": 10306,
    "preview": "from .Blueprint import Blueprint\nfrom .Table import Table\nfrom .TableDiff import TableDiff\nfrom ..exceptions import Conn"
  },
  {
    "path": "src/masoniteorm/schema/Table.py",
    "chars": 2501,
    "preview": "from .Column import Column\nfrom .Constraint import Constraint\nfrom .Index import Index\nfrom .ForeignKeyConstraint import"
  },
  {
    "path": "src/masoniteorm/schema/TableDiff.py",
    "chars": 2270,
    "preview": "from .Column import Column\nfrom .Table import Table\n\n\nclass TableDiff(Table):\n    def __init__(self, name):\n        self"
  },
  {
    "path": "src/masoniteorm/schema/__init__.py",
    "chars": 79,
    "preview": "from .Schema import Schema\nfrom .Table import Table\nfrom .Column import Column\n"
  },
  {
    "path": "src/masoniteorm/schema/platforms/MSSQLPlatform.py",
    "chars": 12943,
    "preview": "from .Platform import Platform\nfrom ..Table import Table\n\n\nclass MSSQLPlatform(Platform):\n    types_without_lengths = [\n"
  },
  {
    "path": "src/masoniteorm/schema/platforms/MySQLPlatform.py",
    "chars": 18585,
    "preview": "from ...schema import Schema\nfrom .Platform import Platform\nfrom ..Table import Table\nimport re\n\n\nclass MySQLPlatform(Pl"
  },
  {
    "path": "src/masoniteorm/schema/platforms/Platform.py",
    "chars": 3397,
    "preview": "class Platform:\n    foreign_key_actions = {\n        \"cascade\": \"CASCADE\",\n        \"set null\": \"SET NULL\",\n        \"casca"
  },
  {
    "path": "src/masoniteorm/schema/platforms/PostgresPlatform.py",
    "chars": 19890,
    "preview": "from ...schema import Schema\nfrom .Platform import Platform\nfrom ..Table import Table\n\n\nclass PostgresPlatform(Platform)"
  },
  {
    "path": "src/masoniteorm/schema/platforms/SQLitePlatform.py",
    "chars": 17578,
    "preview": "from ...schema import Schema\nfrom ..Table import Table\nfrom .Platform import Platform\n\n\nclass SQLitePlatform(Platform):\n"
  },
  {
    "path": "src/masoniteorm/schema/platforms/__init__.py",
    "chars": 172,
    "preview": "from .SQLitePlatform import SQLitePlatform\nfrom .MySQLPlatform import MySQLPlatform\nfrom .MSSQLPlatform import MSSQLPlat"
  },
  {
    "path": "src/masoniteorm/scopes/BaseScope.py",
    "chars": 156,
    "preview": "class BaseScope:\n    def on_boot(self, builder):\n        raise NotImplementedError()\n\n    def on_remove(self, builder):\n"
  },
  {
    "path": "src/masoniteorm/scopes/SoftDeleteScope.py",
    "chars": 1891,
    "preview": "from .BaseScope import BaseScope\n\n\nclass SoftDeleteScope(BaseScope):\n    \"\"\"Global scope class to add soft deleting to m"
  },
  {
    "path": "src/masoniteorm/scopes/SoftDeletesMixin.py",
    "chars": 358,
    "preview": "from .SoftDeleteScope import SoftDeleteScope\n\n\nclass SoftDeletesMixin:\n    \"\"\"Global scope class to add soft deleting to"
  },
  {
    "path": "src/masoniteorm/scopes/TimeStampsMixin.py",
    "chars": 337,
    "preview": "from .TimeStampsScope import TimeStampsScope\n\n\nclass TimeStampsMixin:\n    \"\"\"Global scope class to add soft deleting to "
  },
  {
    "path": "src/masoniteorm/scopes/TimeStampsScope.py",
    "chars": 1452,
    "preview": "from ..expressions.expressions import UpdateQueryExpression\nfrom .BaseScope import BaseScope\n\n\nclass TimeStampsScope(Bas"
  },
  {
    "path": "src/masoniteorm/scopes/UUIDPrimaryKeyMixin.py",
    "chars": 255,
    "preview": "from .UUIDPrimaryKeyScope import UUIDPrimaryKeyScope\n\n\nclass UUIDPrimaryKeyMixin:\n    \"\"\"Global scope class to add UUID "
  },
  {
    "path": "src/masoniteorm/scopes/UUIDPrimaryKeyScope.py",
    "chars": 1668,
    "preview": "import uuid\n\nfrom .BaseScope import BaseScope\n\n\nclass UUIDPrimaryKeyScope(BaseScope):\n    \"\"\"Global scope class to use U"
  },
  {
    "path": "src/masoniteorm/scopes/__init__.py",
    "chars": 346,
    "preview": "from .scope import scope\nfrom .BaseScope import BaseScope\nfrom .SoftDeletesMixin import SoftDeletesMixin\nfrom .SoftDelet"
  },
  {
    "path": "src/masoniteorm/scopes/scope.py",
    "chars": 489,
    "preview": "class scope:\n    def __init__(self, callback, *params, **kwargs):\n        self.fn = callback\n\n    def __set_name__(self,"
  },
  {
    "path": "src/masoniteorm/seeds/Seeder.py",
    "chars": 1260,
    "preview": "import pydoc\n\n\nclass Seeder:\n    def __init__(self, dry=False, seed_path=\"databases/seeds\", connection=None):\n        se"
  },
  {
    "path": "src/masoniteorm/seeds/__init__.py",
    "chars": 27,
    "preview": "from .Seeder import Seeder\n"
  },
  {
    "path": "src/masoniteorm/stubs/create-migration.html",
    "chars": 295,
    "preview": "from masoniteorm.migrations import Migration\n\n\nclass CreateUsersTable(Migration):\n\n    def up(self):\n        \"\"\"Run the "
  },
  {
    "path": "src/masoniteorm/stubs/table-migration.html",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/masoniteorm/testing/BaseTestCaseSelectGrammar.py",
    "chars": 19117,
    "preview": "import inspect\n\nfrom ..query import QueryBuilder\nfrom ..expressions import JoinClause\nfrom ..models import Model\n\n\nclass"
  },
  {
    "path": "src/masoniteorm/testing/__init__.py",
    "chars": 65,
    "preview": "from .BaseTestCaseSelectGrammar import BaseTestCaseSelectGrammar\n"
  },
  {
    "path": "tests/User.py",
    "chars": 248,
    "preview": "\"\"\" User Model \"\"\"\n\nfrom src.masoniteorm import Model\n\n\nclass User(Model):\n    \"\"\"User Model\"\"\"\n\n    __fillable__ = [\"na"
  },
  {
    "path": "tests/collection/test_collection.py",
    "chars": 23275,
    "preview": "import unittest\n\nfrom src.masoniteorm.collection import Collection\nfrom src.masoniteorm.factories import Factory as fact"
  },
  {
    "path": "tests/commands/test_shell.py",
    "chars": 2985,
    "preview": "import unittest\nfrom cleo import CommandTester\n\nfrom src.masoniteorm.commands import ShellCommand\n\n\nclass TestShellComma"
  },
  {
    "path": "tests/config/test_db_url.py",
    "chars": 4289,
    "preview": "import os\nimport pytest\nimport unittest\n\nfrom src.masoniteorm.config import db_url, load_config\nfrom src.masoniteorm.exc"
  },
  {
    "path": "tests/connections/test_base_connections.py",
    "chars": 890,
    "preview": "import unittest\n\nfrom src.masoniteorm.connections import ConnectionResolver\nfrom tests.integrations.config.database impo"
  },
  {
    "path": "tests/eagers/test_eager.py",
    "chars": 2518,
    "preview": "import os\nimport unittest\n\nfrom src.masoniteorm.query.EagerRelation import EagerRelations\n\n\nclass TestEagerRelation(unit"
  },
  {
    "path": "tests/factories/test_factories.py",
    "chars": 2033,
    "preview": "import os\nimport unittest\n\nfrom src.masoniteorm import Factory as factory\nfrom src.masoniteorm.models import Model\nfrom "
  },
  {
    "path": "tests/integrations/config/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/integrations/config/database.py",
    "chars": 4674,
    "preview": "\"\"\" Database Settings \"\"\"\nimport os\nimport logging\n\nfrom dotenv import load_dotenv\n\nfrom src.masoniteorm.connections imp"
  },
  {
    "path": "tests/models/test_models.py",
    "chars": 9878,
    "preview": "import datetime\nimport json\nimport unittest\n\nimport pendulum\n\nfrom src.masoniteorm.models import Model\n\n\nclass ModelTest"
  },
  {
    "path": "tests/mssql/builder/test_mssql_query_builder.py",
    "chars": 13947,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.connections import ConnectionFactory\nfrom src.masoniteorm.models im"
  },
  {
    "path": "tests/mssql/builder/test_mssql_query_builder_relationships.py",
    "chars": 4082,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.connections import ConnectionFactory\nfrom src.masoniteorm.models im"
  },
  {
    "path": "tests/mssql/grammar/test_mssql_delete_grammar.py",
    "chars": 861,
    "preview": "import unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars import MSSQLGrammar\n"
  },
  {
    "path": "tests/mssql/grammar/test_mssql_insert_grammar.py",
    "chars": 1315,
    "preview": "import unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars import MSSQLGrammar\n"
  },
  {
    "path": "tests/mssql/grammar/test_mssql_qmark.py",
    "chars": 1743,
    "preview": "import unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars import MSSQLGrammar\n"
  },
  {
    "path": "tests/mssql/grammar/test_mssql_select_grammar.py",
    "chars": 18231,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query.grammars import MSSQLGrammar\nfrom src.masoniteorm.testing imp"
  },
  {
    "path": "tests/mssql/grammar/test_mssql_update_grammar.py",
    "chars": 1193,
    "preview": "import unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars import MSSQLGrammar\n"
  },
  {
    "path": "tests/mssql/schema/test_mssql_schema_builder.py",
    "chars": 12838,
    "preview": "import unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.connections import MSSQLC"
  },
  {
    "path": "tests/mssql/schema/test_mssql_schema_builder_alter.py",
    "chars": 9841,
    "preview": "import unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.connections import MSSQLC"
  },
  {
    "path": "tests/mysql/builder/test_mysql_builder_transaction.py",
    "chars": 1568,
    "preview": "import inspect\nimport os\nimport unittest\n\nfrom src.masoniteorm.connections import ConnectionFactory\nfrom src.masoniteorm"
  },
  {
    "path": "tests/mysql/builder/test_query_builder.py",
    "chars": 30915,
    "preview": "import datetime\nimport inspect\nimport unittest\n\nfrom src.masoniteorm.exceptions import InvalidArgument\nfrom src.masonite"
  },
  {
    "path": "tests/mysql/builder/test_query_builder_scopes.py",
    "chars": 2328,
    "preview": "import inspect\nimport unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.models imp"
  },
  {
    "path": "tests/mysql/builder/test_transactions.py",
    "chars": 1128,
    "preview": "import inspect\nimport os\nimport unittest\n\nfrom src.masoniteorm.connections.ConnectionFactory import ConnectionFactory\nfr"
  },
  {
    "path": "tests/mysql/connections/test_mysql_connection_selects.py",
    "chars": 1411,
    "preview": "import os\nimport unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.query import QueryBuilder\nfrom "
  },
  {
    "path": "tests/mysql/grammar/test_mysql_delete_grammar.py",
    "chars": 2089,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/mysql/grammar/test_mysql_insert_grammar.py",
    "chars": 3284,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/mysql/grammar/test_mysql_qmark.py",
    "chars": 5480,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/mysql/grammar/test_mysql_select_grammar.py",
    "chars": 17942,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query.grammars import MySQLGrammar\nfrom src.masoniteorm.testing imp"
  },
  {
    "path": "tests/mysql/grammar/test_mysql_update_grammar.py",
    "chars": 3575,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/mysql/model/test_accessors_and_mutators.py",
    "chars": 1200,
    "preview": "import datetime\nimport json\nimport os\nimport unittest\n\nimport pendulum\n\nfrom src.masoniteorm.collection import Collectio"
  },
  {
    "path": "tests/mysql/model/test_model.py",
    "chars": 10774,
    "preview": "import datetime\nimport json\nimport os\nimport unittest\n\nimport pendulum\n\nfrom src.masoniteorm.collection import Collectio"
  },
  {
    "path": "tests/mysql/relationships/test_belongs_to_many.py",
    "chars": 7572,
    "preview": "import unittest\n\n# from src.masoniteorm import query\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.relat"
  },
  {
    "path": "tests/mysql/relationships/test_has_many_through.py",
    "chars": 3305,
    "preview": "import unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.relationships import (\n    has_many_throu"
  },
  {
    "path": "tests/mysql/relationships/test_has_one_through.py",
    "chars": 3771,
    "preview": "import unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.relationships import (\n    has_one_throug"
  },
  {
    "path": "tests/mysql/relationships/test_relationships.py",
    "chars": 7066,
    "preview": "import unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.relationships import (\n    has_one,\n    b"
  },
  {
    "path": "tests/mysql/schema/test_mysql_schema_builder.py",
    "chars": 15912,
    "preview": "import os\nimport unittest\n\nfrom src.masoniteorm import Model\nfrom tests.integrations.config.database import DATABASES\nfr"
  },
  {
    "path": "tests/mysql/schema/test_mysql_schema_builder_alter.py",
    "chars": 11363,
    "preview": "import unittest\nimport os\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.connections imp"
  },
  {
    "path": "tests/mysql/scopes/test_can_use_global_scopes.py",
    "chars": 1376,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.scopes import (\n    SoftDe"
  },
  {
    "path": "tests/mysql/scopes/test_can_use_scopes.py",
    "chars": 1326,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.scopes import SoftDeletesM"
  },
  {
    "path": "tests/mysql/scopes/test_soft_delete.py",
    "chars": 3576,
    "preview": "import unittest\n\nimport pendulum\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.query im"
  },
  {
    "path": "tests/postgres/builder/test_postgres_query_builder.py",
    "chars": 24925,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.connections import ConnectionFactory\nfrom src.masoniteorm.models im"
  },
  {
    "path": "tests/postgres/builder/test_postgres_transaction.py",
    "chars": 1407,
    "preview": "import inspect\nimport os\nimport unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm."
  },
  {
    "path": "tests/postgres/grammar/test_delete_grammar.py",
    "chars": 2089,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/postgres/grammar/test_insert_grammar.py",
    "chars": 2638,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query import QueryBuilder\nfrom src.masoniteorm.query.grammars impor"
  },
  {
    "path": "tests/postgres/grammar/test_select_grammar.py",
    "chars": 18714,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.query.grammars import PostgresGrammar\nfrom src.masoniteorm.testing "
  },
  {
    "path": "tests/postgres/grammar/test_update_grammar.py",
    "chars": 3862,
    "preview": "import inspect\nimport unittest\n\nfrom src.masoniteorm.connections import PostgresConnection\nfrom src.masoniteorm.query im"
  },
  {
    "path": "tests/postgres/relationships/test_postgres_relationships.py",
    "chars": 4527,
    "preview": "import os\nimport unittest\n\nfrom src.masoniteorm.models import Model\nfrom src.masoniteorm.relationships import belongs_to"
  },
  {
    "path": "tests/postgres/schema/test_postgres_schema_builder.py",
    "chars": 15176,
    "preview": "import unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.connections import Postgr"
  },
  {
    "path": "tests/postgres/schema/test_postgres_schema_builder_alter.py",
    "chars": 11617,
    "preview": "import unittest\n\nfrom tests.integrations.config.database import DATABASES\nfrom src.masoniteorm.connections import Postgr"
  }
]

// ... and 24 more files (download for full content)

About this extraction

This page contains the full source code of the MasoniteFramework/orm GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 224 files (1020.6 KB), approximately 232.3k tokens, and a symbol index with 3071 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!