Update FactBilling model to reflect current database state

The FactBilling model and the ft_billing database table have diverged
slightly - this makes some minor changes to the model columns so that
the model matches the table (which appears to be the correct version).

The ft_billing table is currently like this:

       Column       |            Type             | Modifiers | Storage  | Stats target | Description
--------------------+-----------------------------+-----------+----------+--------------+-------------
 bst_date           | date                        | not null  | plain    |              |
 template_id        | uuid                        | not null  | plain    |              |
 service_id         | uuid                        | not null  | plain    |              |
 notification_type  | text                        | not null  | extended |              |
 provider           | text                        | not null  | extended |              |
 rate_multiplier    | integer                     | not null  | plain    |              |
 international      | boolean                     | not null  | plain    |              |
 rate               | numeric                     | not null  | main     |              |
 billable_units     | integer                     |           | plain    |              |
 notifications_sent | integer                     |           | plain    |              |
 updated_at         | timestamp without time zone |           | plain    |              |
 created_at         | timestamp without time zone | not null  | plain    |              |
Indexes:
    "ft_billing_pkey" PRIMARY KEY, btree (bst_date, template_id, service_id, rate_multiplier, provider, notification_type, international, rate)
    "ix_ft_billing_bst_date" btree (bst_date)
    "ix_ft_billing_service_id" btree (service_id)
    "ix_ft_billing_template_id" btree (template_id)
This commit is contained in:
Katie Smith
2018-09-24 14:20:39 +01:00
parent 82f07de200
commit 335aeb386f

View File

@@ -1805,12 +1805,12 @@ class FactBilling(db.Model):
bst_date = db.Column(db.Date, nullable=False, primary_key=True, index=True) bst_date = db.Column(db.Date, nullable=False, primary_key=True, index=True)
template_id = db.Column(UUID(as_uuid=True), nullable=False, primary_key=True, index=True) template_id = db.Column(UUID(as_uuid=True), nullable=False, primary_key=True, index=True)
service_id = db.Column(UUID(as_uuid=True), nullable=False, index=True) service_id = db.Column(UUID(as_uuid=True), nullable=False, primary_key=True, index=True)
notification_type = db.Column(db.Text, nullable=False, primary_key=True) notification_type = db.Column(db.Text, nullable=False, primary_key=True)
provider = db.Column(db.Text, nullable=True, primary_key=True) provider = db.Column(db.Text, nullable=False, primary_key=True)
rate_multiplier = db.Column(db.Integer(), nullable=True, primary_key=True) rate_multiplier = db.Column(db.Integer(), nullable=False, primary_key=True)
international = db.Column(db.Boolean, nullable=False, primary_key=False) international = db.Column(db.Boolean, nullable=False, primary_key=True)
rate = db.Column(db.Numeric(), nullable=False) rate = db.Column(db.Numeric(), nullable=False, primary_key=True)
billable_units = db.Column(db.Integer(), nullable=True) billable_units = db.Column(db.Integer(), nullable=True)
notifications_sent = db.Column(db.Integer(), nullable=True) notifications_sent = db.Column(db.Integer(), nullable=True)
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)