Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: py-package/masonite-multitenancy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.1
Choose a base ref
...
head repository: py-package/masonite-multitenancy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.0.2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 8, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0a6a380 View commit details
  2. Updated Docs

    yubarajshrestha committed Jul 8, 2022
    Copy the full SHA
    f5e6a7d View commit details
  3. Updated Docs

    yubarajshrestha committed Jul 8, 2022
    Copy the full SHA
    d7141fd View commit details
Showing with 52 additions and 12 deletions.
  1. +51 −11 README.md
  2. +1 −1 setup.py
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# multitenancy

<p align="center">
<img src="https://banners.beyondco.de/Masonite%20Multitenancy.png?theme=light&packageManager=pip+install&packageName=masonite-multitenancy&pattern=charlieBrown&style=style_2&description=Multitenancy+package+for+masonite.&md=1&showWatermark=1&fontSize=100px&images=adjustments&widths=50&heights=50">
</p>
@@ -8,16 +6,16 @@
<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,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA6gAwAEAAAAA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ytJAryGtkLc2PcBM5byyUWYkMQpMioYcDcchC6xN220Iv36Ot8pV0454RHLEwmmD7UWfIdX0zq3GjMPG5NKBtv5qiPEPekK2U51j1451BZoc3i+1ohSQ/UzzG5uYFFn2mwVUnO4O3JblXA91T51l3pB3QweDl7sNXMyEjbguSjrPcQNmwDkNc8CbCvDd0+xCC7RFi9wFulD3mJeXqxQevB4prrqgc0TmQ85NG/K43e2UwnMVAJIEBNfWRYR3HfnvivrIzMyo4Hgy+hfscvLo53jItAAAAABJRU5ErkJggg==">
</a>
<img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/yubarajshrestha/multitenancy/Test%20Application">
<img src="https://codecov.io/gh/yubarajshrestha/multitenancy/branch/main/graph/badge.svg?token="/>
<img alt="PyPI" src="https://img.shields.io/pypi/v/multitenancy">
<img alt="GitHub Workflow Status (branch)" src="https://github.com/yubarajshrestha/masonite-multitenancy/actions/workflows/pythonapp.yml/badge.svg">
<img src="https://codecov.io/gh/yubarajshrestha/masonite-multitenancy/branch/main/graph/badge.svg?token="/>
<img alt="PyPI" src="https://img.shields.io/pypi/v/masonite-multitenancy">
<img src="https://img.shields.io/badge/python-3.6+-blue.svg" alt="Python Version">
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/yubarajshrestha/multitenancy?include_prereleases">
<img alt="License" src="https://img.shields.io/github/license/yubarajshrestha/multitenancy">
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/yubarajshrestha/masonite-multitenancy?include_prereleases">
<img alt="License" src="https://img.shields.io/github/license/yubarajshrestha/masonite-multitenancy">
<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>

## Introduction
# Masonite Multitenancy (WIP)

Multitenancy package for Masonite!

@@ -71,6 +69,48 @@ This will prompt few questions just provider answers and that's it.
python craft tenancy:create
```

> Note: After creating a new tenant, you will need to setup related database configuration in `config/multitenancy.py`.
For example, if your tenant database name is `tenant1`, then you need to add the following to `config/multitenancy.py`:

```python
# config/multitenancy.py

TENANTS = {
"tenant1": {
"driver": "sqlite",
"database": env("SQLITE_DB_DATABASE", "tenant1.sqlite3"),
"prefix": "",
"log_queries": env("DB_LOG"),
},
}
```

You can use any database driver that Masonite supports. For example, if you want to use MySQL, then you can use the following:

```python
# config/multitenancy.py

TENANTS = {
"tenant1": {
"driver": "mysql",
"host": env("DB_HOST"),
"user": env("DB_USERNAME"),
"password": env("DB_PASSWORD"),
"database": env("DB_DATABASE"),
"port": env("DB_PORT"),
"prefix": "",
"grammar": "mysql",
"options": {
"charset": "utf8mb4",
},
"log_queries": env("DB_LOG"),
},
}
```

> Note: Make sure you have set the `multitenancy` configuration before running any tenant related commands.
**List all tenants**

```bash
@@ -138,15 +178,15 @@ Route.get("/tenant-aware-routes", "WelcomeController@show").middleware("multiten
In above example, `/tenant-aware-routes` will be tenant aware. It means that if you have tenant setup and you are trying to access `/tenant-aware-routes` then you will get tenant specific items from the database.


## Contributing
### Contributing

Please read the [Contributing Documentation](CONTRIBUTING.md) here.

## Maintainers
### Maintainers

- [x] [Yubaraj Shrestha](https://www.github.com/yubarajshrestha)

## License
### License


multitenancy is open-sourced software licensed under the [MIT license](LICENSE).
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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="0.0.1",
version="0.0.2",
packages=[
"multitenancy",
"multitenancy.commands",