-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #667 from naymspace/feature/adapter-bang
standardize and improve resource and adapter modules
- Loading branch information
Showing
19 changed files
with
249 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Upgrading to v0.10 | ||
|
||
## Bump Your Deps | ||
|
||
Update Backpex to the latest version: | ||
|
||
```elixir | ||
defp deps do | ||
[ | ||
{:backpex, "~> 0.10.0"} | ||
] | ||
end | ||
``` | ||
|
||
## LiveView 1.0 | ||
|
||
See [phoenix_live_view changelog](https://github.com/phoenixframework/phoenix_live_view/blob/main/CHANGELOG.md) for info on how to upgrade to `1.0`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Upgrading to v0.11 | ||
|
||
## Bump Your Deps | ||
|
||
Update Backpex to the latest version: | ||
|
||
```elixir | ||
defp deps do | ||
[ | ||
{:backpex, "~> 0.11.0"} | ||
] | ||
end | ||
``` | ||
|
||
## Parameter changes in core modules | ||
|
||
In case you are using `Backpex.Resource` or one of the `Backpex.Adapter` modules (`Backpex.Adapters.Ecto` or | ||
`Backpex.Adapters.Ash`) directly check out the updated function definitions. This will also apply in case you built your | ||
own adapter. | ||
|
||
## Make sure to cover all cases with the `item_query/3` function | ||
|
||
We have removed code that ensures that a fallback item query function is always added to your LiveResource. | ||
|
||
Make sure to always cover all possible cases or add a fallback `item_query/3` function that just returns the query. | ||
|
||
For example: | ||
|
||
```elixir | ||
# in your resource configuration file (live resource) | ||
use Backpex.LiveResource, | ||
# ...other options | ||
adapter_config: [ | ||
# ...other adapter options | ||
item_query: &__MODULE__.item_query/3 | ||
] | ||
|
||
def item_query(query, :index, _assigns) do | ||
query | ||
|> where([post], post.published) | ||
end | ||
|
||
# make sure to add this fallback function | ||
def item_query(query, _live_action, _assigns) do | ||
query | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
# Upgrading to v0.6 | ||
|
||
# Change `Backpex.Fields.ManyToMany` to `Backpex.Fields.HasMany` | ||
## Bump Your Deps | ||
|
||
Update Backpex to the latest version: | ||
|
||
```elixir | ||
defp deps do | ||
[ | ||
{:backpex, "~> 0.6.0"} | ||
] | ||
end | ||
``` | ||
|
||
## Change `Backpex.Fields.ManyToMany` to `Backpex.Fields.HasMany` | ||
|
||
With version 0.6, we have combined the `Backpex.Fields.ManyToMany` and `Backpex.Fields.HasMany` field. The functionality of the fields is now combined in the `Backpex.Fields.HasMany` field. The API of the field has not changed, so you can simply replace `Backpex.Fields.ManyToMany` with `Backpex.Fields.HasMany` in your resource configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.