Commit cc29d1f
authored
feat: Database forward compatibility: make
# Description
Old version is not able to write in databases which are `1.0` compatible
because the new `owner` field is mandatory. This change makes the
`owner` field `optional` to maintain forward compatibility.
## Tested
### Before change (owner field mandatory)
I created a database with tables `tasks` and `push_notification_configs`
using `1.0` spec. I then tested it against `0.3` spec by trying to
**write** in it. It failed returning an error: `NOT NULL constraint
failed: tasks.owner`.
Also, I created a database with `0.3` spec `Task` and
`PushNotificationConfigs` entries but then made it `1.0` compatible via
migration CLI command `uv run a2a-db`. **Reading** such data using `0.3`
spec worked, but **writing** failed for the same reason as before.
### After change (owner field optional)
I repeated the testing from before. Now writing in `1.0` compatible
databases worked.
## Notes
Writing in database which was created using `1.0` spec without running
the migration `a2a-db` CLI command, created entries which have
`owner=NULL` values, contrary to databases that underwent the migration
using `a2a-db` which have `owner` field populated with the default
value. In my case with `legacy_v03_no_user_info` since I didn't use the
`--add_columns_owner_last_updated-default-owner` flag to pass my own
custom default value.
## Contributing Guide
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass (Run `bash scripts/format.sh`
from the repository root to format)
- [x] Appropriate docs were updated (if necessary)
Fixes #811 🦕owner field optional (#812)1 parent b033e23 commit cc29d1f
3 files changed
Lines changed: 5 additions & 5 deletions
File tree
- src/a2a
- migrations/versions
- server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
0 commit comments