Skip to content
This repository has been archived by the owner on Nov 7, 2021. It is now read-only.

Frame meta #46

Open
matt-allan opened this issue Jul 27, 2020 · 1 comment
Open

Frame meta #46

matt-allan opened this issue Jul 27, 2020 · 1 comment

Comments

@matt-allan
Copy link
Owner

matt-allan commented Jul 27, 2020

This issue builds on #41. You should be able to add custom metadata to frames. You can then use the metadata in reports.

# add custom meta fields
hours meta:add sprint
hours meta:add estimate --interval
hours meta:add velocity --computed 'estimate / elapsed'
hours meta:add points --number

# Track time with meta fields
hours start --tag migrations --notes 'adding emails table' --sprint 'bulbasaur' --estimate '20 minutes' --points 2

# Use meta in reports
hours report --sprint='bulbasaur'

Metadata can be defined as one of the following types:

  • string (default)
  • boolean
  • number
  • interval
  • datetime
  • timestamp
  • computed (will clarify in a separate issue)

Any field can optionally be variadic, which corresponds to passing multiple flags (i.e. how tags work now).

The field type is used to determine how it's (de)serialized for storage and how it's parsed from the CLI input.

Challenges:

Adding the meta option flags at runtime will be challenging, and will require additional database queries every time you run a command that supports meta. If we use the meta field name as the option name (and don't namespace them) adding any options in the future will technically be a breaking change.

Ideally we could store the meta as a JSON column, but to query JSON (i.e. for reports) requires the JSON1 extension for SQLite. Some PHP installations don't load this extension. We might be able to compile and distribute the shared library? It does work with Laravel, so it's a viable option.

I really don't want to have to do an EAV table for this, but that's an option too. Since SQLite doesn't have real date/time types every value would either be integer, real, or text.

@matt-allan
Copy link
Owner Author

More info about how common the JSON1 extension is:

According to Django, most linux distros enable it by default.

It's enabled by Homebrew for Mac.

Can't find any info re: Windows.

Since JSON support will only be necessary for querying meta columns in reports and won't be used unless you use it explicitly it's probably OK if it doesn't work on certain platforms by default.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant