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

New model definitions for version 2 API #64

Merged
merged 30 commits into from
Jul 13, 2021
Merged

Commits on Jun 26, 2021

  1. Configuration menu
    Copy the full SHA
    d070f9c View commit details
    Browse the repository at this point in the history
  2. Add Organization model

    The organizations table is the basis of a multi-tenant installation.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    263e7c4 View commit details
    Browse the repository at this point in the history
  3. Add Tag and ProductTags models

    These models allow us to create tags that have a many-to-many
    relationship with Products (via the ProductTags association).
    
    Tags are sequestered within an organization.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    7c37101 View commit details
    Browse the repository at this point in the history
  4. Fix use of datetime.now default

    It should be the function rather than a constructed instance of datetime
    which would effectively be the time when the app started up.
    
    In practice, this default was overriden by the POST or PATCH handlers.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    51549f1 View commit details
    Browse the repository at this point in the history
  5. Add DashboardTemplate model

    This model stores references to dashboard templates. These templates are
    owned by an organization.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    5f61bde View commit details
    Browse the repository at this point in the history
  6. Add relationship from Product to Organization

    This relationship is currently nullable during the migration, but can be
    changed to non-nullable later.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    58e91bf View commit details
    Browse the repository at this point in the history
  7. Add Build.git_ref column

    This column will replace Build.git_refs, where in practice we never use
    the multiple ref feature.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    c2d9774 View commit details
    Browse the repository at this point in the history
  8. Add Build.uploaded_by relationship

    This allows us to identify who uploaded a build.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    06b9dc6 View commit details
    Browse the repository at this point in the history
  9. Add Edition.kind column

    This enumeration column allows us to classify the edition's kind, which
    is useful information for edition dashboards.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    90e465b View commit details
    Browse the repository at this point in the history
  10. Use UniqueConstraint from flask-sqlalchemy

    Use the version from flask-sqlalchemy rather than the one directly from
    sqlalchemy for consistency.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    21184b8 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    01f068a View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    2e1c39a View commit details
    Browse the repository at this point in the history
  13. Simplify DashboardTemplate Organization relation

    This removes the ForeignKeyConstraint in the most complex version of
    https://docs.sqlalchemy.org/en/13/orm/relationship_persistence.html#rows-that-point-to-themselves-mutually-dependent-rows
    which was causing us trouble.
    jonathansick committed Jun 26, 2021
    Configuration menu
    Copy the full SHA
    c8a490e View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2021

  1. Change Tag unique constraints to __table_args__

    This seems to be a better way to handle compound unique constraints?
    jonathansick committed Jul 5, 2021
    Configuration menu
    Copy the full SHA
    4da2cc7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f736f8f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ef54fa5 View commit details
    Browse the repository at this point in the history
  4. Use IntEnum to store enums as ints in DB

    This is based on https://michaelcho.me/article/using-python-enums-in-sqlalchemy-models
    The idea is that the native enum support will store the string value in
    the database. It's easier in fact to just store the integer to the DB
    and handle the enum at the Python level.
    jonathansick committed Jul 5, 2021
    Configuration menu
    Copy the full SHA
    94cddb3 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2021

  1. Configuration menu
    Copy the full SHA
    2648dbb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4860a17 View commit details
    Browse the repository at this point in the history
  3. Make Edition.kind nullable

    This is necessary for the initial database migration, but can be reset
    to be non-nullable once the content can be update.
    jonathansick committed Jul 6, 2021
    Configuration menu
    Copy the full SHA
    9d4830b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8f323c5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    98ce3a8 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    14d99c3 View commit details
    Browse the repository at this point in the history
  7. Run postgres in tox on port 3309

    This lets us run the dev server at the same time as running tox.
    jonathansick committed Jul 6, 2021
    Configuration menu
    Copy the full SHA
    71ecee5 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2021

  1. Make Edition.kind non-nullable

    In the migration, apply a default value then make the column
    non-nullable.
    jonathansick committed Jul 10, 2021
    Configuration menu
    Copy the full SHA
    d35057a View commit details
    Browse the repository at this point in the history
  2. Make Product.organization_id non-nullable

    We do this by creating a default organization during the migration and then
    updating all products to associate with that default organization.
    jonathansick committed Jul 10, 2021
    Configuration menu
    Copy the full SHA
    bea7d9c View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2021

  1. Make v1 API for POST /products/ use default org

    To fall back to the original LTD API, the new_product() handler gets teh
    first organization, which is the default organization created by the DB
    migration for the v2 tables.
    
    New installations of LTD, therefore, should use the v2 API in order to
    use the organizations feature.
    jonathansick committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    75dcd6d View commit details
    Browse the repository at this point in the history
  2. Create default org to tests of the v1 API

    This matches how the v2 table migration automatically associates a
    default organization with existing products, but otherwise the
    organization feature isn't exposed by the v1 API.
    jonathansick committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    6fd401d View commit details
    Browse the repository at this point in the history
  3. Include event string with error log messages

    Structlog requires text for the event now.
    jonathansick committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    96e7f83 View commit details
    Browse the repository at this point in the history
  4. Fix IntEnum binding

    This order of type checking is correct because InEnum is a subclass of
    int.
    jonathansick committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    b92770f View commit details
    Browse the repository at this point in the history