Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/relationships #911

Open
wants to merge 344 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
344 commits
Select commit Hold shift + click to select a range
79b918e
Try a fix for getting attrs on base class only
Nov 17, 2022
36e9fae
Remove to_sql from QueryBuilder query=True args
Nov 17, 2022
4d0d2c2
Add ability to run tests locally with test DB config file
Nov 21, 2022
f172e68
Fix model booting check
Nov 21, 2022
961fab2
Add `make check`, refactor makefile, lint fixes
Nov 21, 2022
5aa8106
Fix subclass check to exclude Model instances
Nov 21, 2022
74744aa
Add fillable/guarded tests, fix update method a bit
Nov 21, 2022
f465806
Combine black formatting commands
Nov 21, 2022
c3123ac
combine isort commands, add sort to `make check`
Nov 21, 2022
b6da63b
Move test_can_touch
Nov 22, 2022
39f9b3f
Remove TESTING env var
Jan 2, 2023
eab41dd
Add support for asdf + direnv
Jan 2, 2023
6790ec3
Pin action to use ubuntu-20.04 instead of latest
Jan 2, 2023
229f71e
Migrations should ignore dotfiles.
bezborodow Jan 31, 2023
3a17030
Merge pull request #830 from stoutput/fix-fillable-guarded-behavior
josephmancuso Feb 1, 2023
21e653d
Update setup.py
josephmancuso Feb 1, 2023
4560c1c
Update setup.py
josephmancuso Feb 1, 2023
8197b55
Retrieves record by primary key. If no record exists matching the giv…
JarriqTheTechie Feb 1, 2023
deea39e
Retrieves record by primary key. If no record exists matching the giv…
JarriqTheTechie Feb 1, 2023
c813103
Fixed linting issue
JarriqTheTechie Feb 1, 2023
7aa546f
Get a single column's value from the first result of a query.
JarriqTheTechie Feb 1, 2023
7b6a269
Get a single column's value from the first result of a query.
JarriqTheTechie Feb 1, 2023
09e91a9
Update QueryBuilder.py
JarriqTheTechie Feb 1, 2023
91489eb
Merge branch 'MasoniteFramework:2.0' into issues/masonite/743
bezborodow Feb 3, 2023
e261a07
Use dynamic model variables for timestamp column names
Feb 15, 2023
03b2320
Fixed json serialization error if model contains pbjects that are not…
circulon Feb 16, 2023
51260aa
Fixed mass assign issue on save
josephmancuso Feb 19, 2023
c4fd787
Format
josephmancuso Feb 19, 2023
882e677
Merge pull request #842 from MasoniteFramework/fix/mass-assign-issue-…
josephmancuso Feb 19, 2023
4445730
Merge pull request #841 from circulon/feature/fix_model_to_json_seria…
josephmancuso Feb 19, 2023
1d81e8b
Merge pull request #835 from bezborodow/issues/masonite/743
josephmancuso Feb 19, 2023
eb18ce6
Update setup.py
josephmancuso Feb 19, 2023
013ccca
Fixed UUID PK Mixin not creating primary key
circulon Mar 11, 2023
e0be900
fixed class model has no attribute id
sfinktah Sep 7, 2023
2449f19
Close Cursor and Close DB when Commit MySQLConnection.py
felipehertzer Sep 12, 2023
9fa48b9
fixed duplicate id issue
josephmancuso Sep 25, 2023
3e08b07
formatted
josephmancuso Sep 25, 2023
b2e6bcb
fixed id key again
josephmancuso Sep 25, 2023
7e66caf
Merge pull request #856 from MasoniteFramework/fix/id
josephmancuso Sep 25, 2023
a1121ce
Update setup.py
josephmancuso Sep 25, 2023
5d47746
Merge branch 'MasoniteFramework:2.0' into 2.0
felipehertzer Sep 26, 2023
0e0ead2
Fix TypeError: 'NoneType' object is not iterable
cgslivre Sep 30, 2023
1edbb44
Merge pull request #845 from circulon/feature/bulk_create_no_uuid_pk
josephmancuso Sep 30, 2023
f2d57f7
Merge pull request #838 from JarriqTheTechie/feature/value
josephmancuso Sep 30, 2023
d9c8e13
Merge pull request #839 from stoutput/stoutput/use-model-attr-for-tim…
josephmancuso Sep 30, 2023
a37ef7b
Merge branch '2.0' into sfink-fix-stuff
josephmancuso Sep 30, 2023
1adac4b
Merge pull request #857 from felipehertzer/2.0
josephmancuso Sep 30, 2023
64675ab
Merge pull request #858 from cgslivre/2.0
josephmancuso Sep 30, 2023
0b0ca18
linted
josephmancuso Sep 30, 2023
39c5cd0
add batch number to status command
eaguad1337 Oct 22, 2023
eb140ef
replace walrus operator to improve compatibility
eaguad1337 Oct 25, 2023
2736834
implement migrate:fresh
eaguad1337 Oct 28, 2023
2288c40
Merge pull request #859 from eaguad1337/fix/migrate-status
josephmancuso Oct 28, 2023
5a50918
add ignore_fk param
eaguad1337 Oct 28, 2023
dbbdbc7
revert hotfix
eaguad1337 Oct 29, 2023
5abf3e2
Bump setup-python github action versions
stoutput Oct 30, 2023
879a904
Add optional config path to ConnectionResolver and ConnectionFactory
matt2930 Dec 5, 2023
7a09edd
Add config_path to Schema and QueryBuilder classes
matt2930 Dec 5, 2023
541a8c7
Added tests
Dec 6, 2023
0ee98f3
Merge pull request #864 from matt2930/feature/863-config-path
josephmancuso Dec 6, 2023
946a474
Merge pull request #862 from stoutput/stouput/bump-setup-python-gh-ac…
josephmancuso Dec 6, 2023
0c455d0
Merge pull request #861 from eaguad1337/feat/860
josephmancuso Dec 6, 2023
c01e632
Merge pull request #855 from sfinktah/sfink-fix-stuff
josephmancuso Dec 6, 2023
74355a3
Merge pull request #837 from JarriqTheTechie/feature/find_or
josephmancuso Dec 6, 2023
9bed4f8
Merge branch '2.0' into feature/748-1
josephmancuso Dec 6, 2023
45b6323
Merge pull request #771 from MasoniteFramework/feature/748-1
josephmancuso Dec 6, 2023
b9dd047
reverted #855
josephmancuso Dec 6, 2023
22a5c01
black formatted
josephmancuso Dec 6, 2023
e8c6a50
Added method "only" to model class.
Dec 9, 2023
5da5423
updated only to support aliasing attribute names. This can be useful …
Dec 9, 2023
bf8ff3f
Update Model.py
JarriqTheTechie Dec 9, 2023
57aa5cf
Update setup.py
josephmancuso Dec 10, 2023
1492f7a
fixed issue. needs refactoring
josephmancuso Jan 4, 2024
7297bac
removed prints
josephmancuso Jan 4, 2024
b44e74f
fixed php ini
josephmancuso Jan 4, 2024
0afd57e
formatted
josephmancuso Jan 4, 2024
ea7f06e
format
josephmancuso Jan 4, 2024
5eb85f2
Merge branch 'features/only' of https://github.com/JarriqTheTechie/or…
josephmancuso Jan 4, 2024
b9ba91d
added check for strings
josephmancuso Jan 4, 2024
427fc9d
added tests
josephmancuso Jan 4, 2024
98a6393
Merge pull request #866 from JarriqTheTechie/features/only
josephmancuso Jan 4, 2024
c11fcc4
Merge pull request #868 from MasoniteFramework/fix/816
josephmancuso Jan 4, 2024
1a3b0c4
BaseRelationship: s/self/instance
pmn4 Feb 12, 2024
378b8c3
Mysql close the connection on rollback
felipehertzer Feb 23, 2024
6f44e9b
feat: add `Collection.min` method
amirhoseinsalimi Mar 3, 2024
61749cc
fix: fix a typo in docs of `Collection.max`
amirhoseinsalimi Mar 3, 2024
e7defe2
Merge pull request #870 from felipehertzer/patch-1
josephmancuso Mar 5, 2024
11fd4d9
Merge pull request #872 from amirhoseinsalimi/patch-1
josephmancuso Mar 12, 2024
f487eaa
Merge branch 'feature/collection-min' of https://github.com/amirhosei…
josephmancuso Mar 12, 2024
3bc3406
added min test
josephmancuso Mar 12, 2024
1ea4d60
Merge pull request #874 from amirhoseinsalimi/feature/collection-min
josephmancuso Mar 12, 2024
cc30732
linted
josephmancuso Mar 12, 2024
f963387
Update setup.py
josephmancuso Mar 12, 2024
29426df
wip: hasmany performance fix
eaguad1337 Apr 2, 2024
a6a5eea
fixed tests and made attempt
josephmancuso Apr 3, 2024
64585fb
fix: tests
eaguad1337 Apr 6, 2024
9393f8e
fix: foreign key call
eaguad1337 Apr 6, 2024
41c49c4
removed print
josephmancuso Apr 6, 2024
d6f2528
Merge pull request #880 from MasoniteFramework/fix/relationship-perfo…
josephmancuso Apr 6, 2024
6f93468
Update setup.py
josephmancuso Apr 6, 2024
c9e7617
Merge pull request #869 from pmn4/pmn4.base-relationship
josephmancuso Apr 7, 2024
2916fc4
add configuration option to enable or disable foreign keys check for …
martinszemitis May 1, 2024
0524421
Merge pull request #883 from martinszemitis/2.0
josephmancuso Jun 9, 2024
f670552
fix: values in compile_alter_sql
Kyrela Jun 19, 2024
fff45ac
lint: remove additional blank line at end of file
Kyrela Jun 19, 2024
8e6a27b
tests: `test_can_add_column_enum` and `test_can_change_column_enum`
Kyrela Jun 19, 2024
ec31a17
tests: `test_can_add_enum`
Kyrela Jun 19, 2024
ab39abf
fix: values in compile_alter_sql
Kyrela Jun 20, 2024
736eaf8
fixed query builder
josephmancuso Jun 27, 2024
5649282
Merge pull request #885 from Kyrela/2.0
josephmancuso Jul 30, 2024
e4459d6
fixed has many though relationship
josephmancuso Aug 18, 2024
25a965a
fixed has many
josephmancuso Sep 1, 2024
8c9a6bb
fixed querybuilder
josephmancuso Sep 1, 2024
bff9d8b
fixed eager load
josephmancuso Sep 1, 2024
100c791
Merge pull request #890 from MasoniteFramework/hotfix/has-many
josephmancuso Sep 1, 2024
0d0411f
bumped version
josephmancuso Sep 1, 2024
a43ed0e
Merge branch '2.0' of https://github.com/MasoniteFramework/orm into h…
josephmancuso Sep 1, 2024
15eca45
Merge pull request #889 from MasoniteFramework/hotfix/fix-has_many_th…
josephmancuso Sep 1, 2024
e2bb610
bumped version
josephmancuso Sep 1, 2024
26fcdba
fixed missing where on has many through relationship
josephmancuso Sep 1, 2024
60c8d1e
Merge pull request #891 from MasoniteFramework/hotfix/has-many-throug…
josephmancuso Sep 1, 2024
637ae01
bumped version
josephmancuso Sep 1, 2024
4671816
fixed version
josephmancuso Sep 1, 2024
2649b5d
use scopes helper method
circulon Sep 10, 2024
c9f4065
make QueryBuilder find respect scopes
circulon Sep 10, 2024
c4bc92b
Added modles testts using scope
circulon Sep 10, 2024
f4dda56
consolidate duplicated calls
circulon Sep 10, 2024
1ca31b1
Fixed queryBuilder .all() test
circulon Sep 10, 2024
7e07531
fixed query=True not returning builder
circulon Sep 10, 2024
10e6478
use raw sql for clarity
circulon Sep 10, 2024
27760ed
updated Model find and create
circulon Sep 10, 2024
43a80e5
moved find scope tests in with other tests
circulon Sep 11, 2024
7e2e551
Fixed HasOneThrough not loading distant model
circulon Oct 17, 2024
1ac4d29
Fixed HasOneThrough with additional queries
circulon Oct 18, 2024
4f41fc9
Fixed tests
circulon Oct 18, 2024
9cdf560
Update pendulum version requirement
josephmancuso Oct 18, 2024
511e20c
Update pendulum version requirement
josephmancuso Oct 18, 2024
d534e28
Update pendulum version requirement
josephmancuso Oct 18, 2024
4114949
Merge pull request #898 from MasoniteFramework/feature/876-1
josephmancuso Oct 18, 2024
d5433af
Update setup.py
josephmancuso Oct 18, 2024
817e44e
removed unused importsa and duplicate test
circulon Oct 20, 2024
79fad5f
Fixed linting
circulon Oct 20, 2024
59e6d1b
Fixed typos
circulon Oct 20, 2024
7d30357
Fixed eager loading
circulon Oct 20, 2024
80aeb84
Added tests for HasOneThrough eager loading
circulon Oct 20, 2024
cd40bf9
removed unused import
circulon Oct 20, 2024
ad33eff
removed unused imports
circulon Oct 20, 2024
d377d37
Fixed using .first()
circulon Oct 21, 2024
19eda09
Refactor MySQLConnection to use connection pooling
josephmancuso Oct 21, 2024
8a66a07
Update version and dependencies in setup.py
josephmancuso Oct 21, 2024
fd7d200
Refactor PostgresConnection to use connection pooling
josephmancuso Oct 22, 2024
e033bfd
fixed .on_null and .on_not_null had to be last criteria
circulon Oct 24, 2024
afb140b
updated tests fo .on_null and .on_not_null
circulon Oct 25, 2024
1efddf6
Merge pull request #901 from circulon/fix/on_null_always_last_criteria
josephmancuso Oct 26, 2024
8d5da73
Merge pull request #893 from circulon/fix/find_cannot_use_scopes
josephmancuso Oct 26, 2024
55ff6dd
Merge pull request #895 from circulon/fix/has_one_through_not_working
josephmancuso Oct 26, 2024
3ff0a83
Refactor MySQLConnection to use connection pooling
josephmancuso Oct 26, 2024
bc08c93
Refactor MySQLConnection to use connection pooling and add connection…
josephmancuso Oct 27, 2024
28418eb
Refactor MySQLConnection to use connection pooling and initialize con…
josephmancuso Oct 27, 2024
341db08
Refactor MySQLConnection to use connection pooling and remove debug p…
josephmancuso Oct 27, 2024
1ad5ad7
Refactor MySQLConnection to use connection pooling and update connect…
josephmancuso Oct 27, 2024
ba7372f
Refactor MySQLConnection to use connection pooling and update connect…
josephmancuso Oct 27, 2024
cf9bc84
Refactor MySQLConnection to use connection pooling and update connect…
josephmancuso Oct 27, 2024
3010894
Refactor MySQLConnection to use connection pooling and update connect…
josephmancuso Oct 27, 2024
db112ca
format
josephmancuso Oct 27, 2024
8291bc7
Refactor PostgresConnection to use connection pooling and update conn…
josephmancuso Oct 27, 2024
4cbd0e4
Refactor PostgresConnection to remove unused variable
josephmancuso Oct 27, 2024
a4656b9
Refactor PostgresConnection to enable connection pooling with a maxim…
josephmancuso Oct 27, 2024
6a237fa
Refactor database configuration to update connection pool minimum size
josephmancuso Oct 27, 2024
6c4ff02
Refactor SQLiteConnection to use a separate method for creating the c…
josephmancuso Oct 27, 2024
d14c826
Refactor SQLiteConnection to use a separate method for creating the c…
josephmancuso Oct 27, 2024
76590f8
linted
josephmancuso Oct 27, 2024
d28435b
Refactor PostgresConnection to handle closed connections during query…
josephmancuso Oct 27, 2024
9475b9e
Refactor PostgresConnection to handle closed connections during query…
josephmancuso Oct 27, 2024
09d082b
Refactor MySQLConnection to handle closed connections during query ex…
josephmancuso Oct 27, 2024
e466282
Refactor MySQLConnection to handle closed connections during query ex…
josephmancuso Oct 27, 2024
94b1347
Refactor MySQLConnection to handle closed connections during query ex…
josephmancuso Oct 27, 2024
fd6785f
linted
josephmancuso Oct 27, 2024
0468c45
Refactor MySQLConnection to handle closed connections during query ex…
josephmancuso Oct 27, 2024
d7a8895
Merge branch '2.0' into fix/query_true_should_return_query_builder
josephmancuso Oct 28, 2024
15894aa
Merge pull request #892 from circulon/fix/query_true_should_return_qu…
josephmancuso Oct 28, 2024
7a6e7a8
linted
josephmancuso Oct 28, 2024
9cb1d47
fixed HasManyThrough eager loading
circulon Oct 29, 2024
bd10fce
fixed HasManyThrough related model load
circulon Oct 29, 2024
928bbb7
cleaned up and fixed where clauses for HasManyThrough
circulon Oct 29, 2024
c13750e
separated HasOneThrough and HasManyThrough tests
circulon Oct 29, 2024
a3e775b
fixed queriy tests
circulon Oct 29, 2024
ab9308a
make sure related attribute always contains a Collection
circulon Oct 29, 2024
f0c2359
Added ability so specify default select criteria for Models
circulon Oct 30, 2024
3451fd6
Merge pull request #904 from circulon/feature/902
josephmancuso Oct 30, 2024
ce25c0a
Merge pull request #900 from MasoniteFramework/feature/483
josephmancuso Oct 30, 2024
bd6e473
Refactor PostgresConnection to support SSL options
josephmancuso Oct 30, 2024
2e4c2fe
Merge pull request #905 from MasoniteFramework/feature/875-1
josephmancuso Oct 30, 2024
7e86c33
use passed in parameters
circulon Oct 30, 2024
97eaa57
fixed parameter name
circulon Oct 30, 2024
58edcde
renamed table variables
circulon Oct 30, 2024
93c7a38
Add Radon analysis workflow for cyclomatic complexity checks
josephmancuso Nov 20, 2024
54f561c
Enhance Radon analysis workflow to capture and output cyclomatic comp…
josephmancuso Nov 20, 2024
72e3347
Update Radon analysis workflow to save cyclomatic complexity output t…
josephmancuso Nov 20, 2024
29551f8
test
josephmancuso Nov 20, 2024
efc9567
Update Radon analysis workflow to set output using GitHub environment…
josephmancuso Nov 20, 2024
162fced
Update Radon analysis workflow to use set-output for environment vari…
josephmancuso Nov 20, 2024
e364693
Refactor Radon analysis workflow to streamline output handling and re…
josephmancuso Nov 20, 2024
fe5a784
Update Radon analysis workflow to set output using GitHub environment…
josephmancuso Nov 20, 2024
0d34132
Update Radon analysis workflow to enhance reporting and streamline co…
josephmancuso Nov 20, 2024
84b168e
Update Radon comment action to use version 0.1
josephmancuso Nov 20, 2024
a0534d8
Fix version tag for Radon comment action in workflow
josephmancuso Nov 20, 2024
c50c9dc
Add installation step for Radon in analysis workflow
josephmancuso Nov 20, 2024
49a2427
Update Radon analysis workflow to report on changed files only
josephmancuso Nov 20, 2024
12a2132
Update Radon analysis workflow to use the latest commit for reporting
josephmancuso Nov 20, 2024
c3e3ce7
Update Radon analysis workflow to use the correct base branch for rep…
josephmancuso Nov 20, 2024
6e716cd
Add test comment in __setitem__ method of Collection class
josephmancuso Nov 20, 2024
d4bd425
Fix Radon analysis workflow to use the correct branch reference for r…
josephmancuso Nov 20, 2024
a01f769
Update Radon analysis workflow to use the correct range for changed f…
josephmancuso Nov 20, 2024
86daadf
Handle empty file lists in Radon analysis workflow to prevent errors
josephmancuso Nov 20, 2024
f62592e
Refactor Radon analysis workflow to support both push and pull_reques…
josephmancuso Nov 20, 2024
07b3a0b
Simplify git fetch command in Radon analysis workflow to ensure full …
josephmancuso Nov 20, 2024
1f82378
Update Radon analysis workflow to use the correct base branch for cha…
josephmancuso Nov 21, 2024
af80dd2
Refactor Radon analysis workflow to trigger on pull requests and stre…
josephmancuso Nov 21, 2024
b28e152
Update Radon analysis workflow to trigger on pull requests for the 2.…
josephmancuso Nov 21, 2024
583a32f
Add Radon installation step to analysis workflow
josephmancuso Nov 21, 2024
97a853e
Add printing of Radon reports in analysis workflow
josephmancuso Nov 21, 2024
1742970
Enhance Radon analysis workflow to trigger on Python file changes and…
josephmancuso Nov 21, 2024
dc4a53d
Enhance Radon analysis workflow to fetch full git history and debug c…
josephmancuso Nov 21, 2024
3a97cb3
Refine Radon analysis workflow to improve environment variable handli…
josephmancuso Nov 21, 2024
59fd976
Add granular Radon analysis workflow for method-level change detection
josephmancuso Nov 21, 2024
85b0643
Refine Radon analysis workflow to accurately match methods with chang…
josephmancuso Nov 21, 2024
7657fa4
Refine Radon analysis workflow to capture raw output and improve meth…
josephmancuso Nov 21, 2024
a820a13
Remove granular Radon analysis workflow configuration
josephmancuso Nov 21, 2024
be07de7
wip
josephmancuso Nov 21, 2024
bb2317b
test
josephmancuso Nov 21, 2024
0fd0744
Remove commented test line and clean up migration command help text f…
josephmancuso Nov 21, 2024
c9055e9
Merge pull request #908 from MasoniteFramework/feature/radon
josephmancuso Nov 21, 2024
a844ce6
Merge branch 'fix/has_many_through_not_working' of https://github.com…
josephmancuso Nov 21, 2024
5da7c38
Merge pull request #903 from circulon/fix/has_many_through_not_working
josephmancuso Nov 21, 2024
7088421
setup relations
josephmancuso Nov 24, 2024
266f696
woorking
josephmancuso Nov 24, 2024
f23adbd
moved relation classes
josephmancuso Nov 24, 2024
de1df45
wip
josephmancuso Nov 24, 2024
cfff660
db commit
josephmancuso Nov 24, 2024
ec362b3
added eager loading non nested relationships
josephmancuso Nov 24, 2024
df2d78e
single eager load
josephmancuso Nov 24, 2024
70d7bfb
added nested eager
josephmancuso Nov 24, 2024
be5903c
removed test code
josephmancuso Nov 24, 2024
ef77552
added limit
josephmancuso Nov 24, 2024
f60b13f
added has many nested
josephmancuso Nov 25, 2024
6c9e9fe
db commit
josephmancuso Nov 25, 2024
1375285
passed tests
josephmancuso Nov 25, 2024
145e77d
removed print
josephmancuso Nov 25, 2024
0eb7659
added get_related method to Collection class
josephmancuso Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use asdf
layout python
8 changes: 4 additions & 4 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

services:
postgres:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -58,12 +58,12 @@ jobs:
python orm migrate --connection mysql
make test
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Lint
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
- name: Install Flake8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

services:
postgres:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/radon-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Radon Analysis

on:
pull_request:
paths:
- '**/*.py' # Only trigger for Python files

jobs:
radon_analysis:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure full history is fetched for git diff to work properly

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Radon
run: pip install radon

- name: Get list of changed files
id: get_changed_files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '.py$' || true)
echo "Changed files: $CHANGED_FILES"
echo "CHANGED_FILES<<EOF" >> $GITHUB_ENV
echo "$CHANGED_FILES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Debug changed files
run: |
echo "Changed files from env: ${{ env.CHANGED_FILES }}"
shell: bash

- name: Run Radon analysis
id: radon_analysis
run: |
if [ -z "${{ env.CHANGED_FILES }}" ]; then
echo "No Python files changed."
echo "RESULTS=None" >> $GITHUB_ENV
else
RESULTS=$(echo "${{ env.CHANGED_FILES }}" | xargs radon cc -s -n A || true)
echo "RESULTS<<EOF" >> $GITHUB_ENV
echo "$RESULTS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi

- name: Comment on PR
if: env.RESULTS != 'None'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Radon Complexity Analysis
message: |
**Radon Analysis Results:**
```
${{ env.RESULTS }}
```

- name: Log if no Python files found
if: env.RESULTS == 'None'
run: echo "No Python files changed in this PR."
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
venv
.direnv
.python-version
.vscode
.pytest_*
Expand All @@ -15,4 +16,6 @@ htmlcov/*
coverage.xml
.coverage
*.log
build
build
/orm.sqlite3
/.bootstrapped-pip
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.8.10
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you are interested in the project then it would be a great idea to read the "

## 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 dicussion with the maintainers of the project.
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.

Expand Down
7 changes: 5 additions & 2 deletions cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
# print(builder.where("id", 1).or_where(lambda q: q.where('id', 2).or_where('id', 3)).get())

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

@has_many("id", "user_id")
def articles(self):
Expand All @@ -28,7 +29,9 @@ class Article(Model):

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

# print(user.serialize())
# print(User.first())
35 changes: 35 additions & 0 deletions config/test-database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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)
29 changes: 16 additions & 13 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
init:
init: .env .bootstrapped-pip

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

.env:
cp .env-example .env
pip install -r requirements.txt
pip install .
# Create MySQL Database
# Create Postgres Database
test:

# Create MySQL Database
# Create Postgres Database
test: init
python -m pytest tests
ci:
make test
check: format sort lint
lint:
python -m flake8 src/masoniteorm/ --ignore=E501,F401,E203,E128,E402,E731,F821,E712,W503,F811
format:
black src/masoniteorm
black tests/
make lint
sort:
isort tests
isort 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
Expand Down
2 changes: 2 additions & 0 deletions orm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ from src.masoniteorm.commands import (
MigrateCommand,
MigrateRollbackCommand,
MigrateRefreshCommand,
MigrateFreshCommand,
MakeMigrationCommand,
MakeObserverCommand,
MakeModelCommand,
Expand All @@ -25,6 +26,7 @@ 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())
Expand Down
Binary file modified orm.sqlite3
Binary file not shown.
36 changes: 36 additions & 0 deletions playground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from src.masoniteorm.models import Model

class User(Model):
__table__ = "tbl_users"
__primary_key__ = "user_id"

@property
def company(self):
return self.has_one(Company, "company_id", "company_id")

class CreditCard(Model):
__table__ = "company_credit_cards"
__primary_key__ = "credit_card_id"

@property
def company(self):
return self.has_one(Company, "company_id", "company_id")

class Company(Model):
__table__ = "tbl_companies"
__primary_key__ = "company_id"


@property
def cards(self):
return self.has_many(CreditCard, "company_id", "company_id")

# Usage has one
user = User.find(667)

# fetches record on related company record
for card in user.company.cards:
print(card.company.company_name)

# user.company() part returns a query builder so we can fetch related queries on the fly
print(user.company().limit(1).to_sql()) # Output: select * from tbl_companies where tbl_companies.company_id = 373849
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
env =
D:DB_CONFIG_PATH=config/test-database
8 changes: 8 additions & 0 deletions requirements.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flake8==3.7.9
black
faker
pytest
pytest-cov
pytest-env
pymysql
isort
13 changes: 3 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
flake8==3.7.9
black==19.3b0
faker
pytest
pytest-cov
pymysql
isort
inflection==0.3.1
psycopg2-binary
python-dotenv==0.14.0
pyodbc
pendulum>=2.1,<2.2
cleo>=0.8.0,<0.9
pendulum>=2.1,<3.1
cleo>=0.8.0,<0.9
python-dotenv==0.14.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 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.18.1",
version="2.23.1",
package_dir={"": "src"},
description="The Official Masonite ORM",
long_description=long_description,
Expand All @@ -30,7 +30,7 @@
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
"inflection>=0.3,<0.6",
"pendulum>=2.1,<2.2",
"pendulum>=2.1,<3.1",
"faker>=4.1.0,<14.0",
"cleo>=0.8.0,<0.9",
],
Expand Down
Loading
Loading