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

Adding timestamp to feature use model #66

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rboston628
Copy link

This PR will add a timestamp to the feature use model.

The goal is to be able to separate out feature usages by time.

Because feature use seems to be an aggregate, I'm unsure of exactly how this will work.

This is a work in progress, and requires more experimentation to ensure correct behavior.

@rboston628
Copy link
Author

This needs the migration file. According to @mpatrou this is set up automatically during the build, but I wasn't sure how to initialize it

@sf1919
Copy link
Contributor

sf1919 commented Oct 18, 2023

@robertapplin and @MialLewis can you help with Staging Server?

@robertapplin
Copy link
Contributor

We might need to add the new column to the admin.py file so we can see it on the admin database page

class UsageAdmin(admin.ModelAdmin):

@robertapplin robertapplin self-assigned this Oct 23, 2023
@robertapplin
Copy link
Contributor

robertapplin commented Oct 23, 2023

@rboston628 what do we want to use as the default timestamp? When testing the migration locally with

docker-compose exec web python manage.py makemigrations
docker-compose exec web python manage.py migrate

I get the following message:

You are trying to add the field 'timestamp' with 'auto_now_add=True' to featureusage without a default; the database needs something to populate existing rows.

 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py

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

Successfully merging this pull request may close these issues.

3 participants