weaveworks / service

☁️ Images for Weave Cloud (R) (TM) (C) ☁️
https://cloud.weave.works
2 stars 2 forks source link

Add sticky custom-billing flag so externally billed users can create instances #1867

Closed aaron7 closed 6 years ago

aaron7 commented 6 years ago

To prevent https://github.com/weaveworks/service-conf/issues/2021, we would like to have a flag on the user or team to disable billing for new instances where there is a special case in terms of billing.

e.g. IBM are a customer but are not in the standard billing setup. We would like to allow them to create instances which do no expire.

rade commented 6 years ago

This is a way to solve #1437 for specially billed users.

rade commented 6 years ago

We could also put the flag on the team.

marccarre commented 6 years ago

More background on this issue:

no-billing feature flag

There is a no-billing feature flag set on some instances (not users, not teams, as this issue suggests). This feature flag is just to work around the fact we cannot filter instances without the billing flag, in the admin UI, i.e. run the equivalent of SELECT * FROM organizations WHERE 'billing' != ALL(feature_flags) AND deleted_at IS NULL;

Therefore:

billing feature flag

We historically didn't enable billing for instances. Then gradually increased the probability to enable it for a new instance. Then increased that probability to 100%. And then manually set all instances to be enabled.

Being a tautology, the billing flag is therefore now mostly useless at the moment, and could be removed, with careful refactoring.

Enable/disable access

Important logic to enable/disable access to instances is mainly based:

See also:

marccarre commented 6 years ago

Ideally we'd have the concept of a "billing account", and have the ability to:

However, given:

A. We'd probably need both:

  1. a billed_externally [0] flag on users,
  2. a billed_externally [0] flag on teams.

[0] Suggestions for a better name welcome!

B. We will also need an admin UI to browse teams, something we don't have at the moment, in order to search teams with that flag set to true/false.

rade commented 6 years ago

We only need the flag on the team.

We don't care about old instances - we can deal with them by setting no-billing on the instance.

For the small number of no-billing customers with users that aren't in a team, we can ask them to form a team (or do it for them).

marccarre commented 6 years ago

Several possible approaches to grant full, unlimited access to users:

  1. Should we automatically create a billed_externally team per no-billing instance, we would grant unlimited access to Weave Cloud to all users in these teams, regardless of whether they are actually paying us. This may or may not be a problem, but some instances seem to bring together people from various organisations, collaborating together, e.g. @skyscanner.com and @jetstack.com people, or @ibm.com and @atb.com people.

  2. Alternatively, we may want to create billed_externally teams only for users in a certain domain? e.g. @.*ibm.com, @qordoba.com, etc.

  3. Alternatively, we may want key users to create these teams for us, and we would then set the billed_externally flag on them.

@Futurile, which approach would you rather take? Do we know exactly who we want and don't want to give full, unlimited access to Weave Cloud?

Also note that this may be abusing the concept of team, which imho, should just be a way to organise users and access rights to one or more instances. Here, the new team is purely created for the purpose of billing, i.e. we use it as a "billing account". Who pays for an instance and who has access to it are orthogonal.

Non-@weave.works, no-billing instances with a team

 team_external_id | team_name |  id  |      external_id  |          name        |     emails
------------------+-----------+------+-------------------+----------------------+---------------------------
 winter-forest-89 | Devops    | 8624 | modern-feather-39 | wdc07-atb-preprod    | {ahsan.qaiser@ibm.com,
                  |           |      |                   |                      |  andrew.tanner@ca.ibm.com,
                  |           |      |                   |                      |  george.fleifel@ibm.com,
                  |           |      |                   |                      |  gravichandran@atb.com,
                  |           |      |                   |                      |  harmeek.jhutty@ibm.com,
                  |           |      |                   |                      |  jibran.shaukat@ibm.com,
                  |           |      |                   |                      |  oaderibigbe@atb.com,
                  |           |      |                   |                      |  ssanaga@atb.com,
                  |           |      |                   |                      |  vhsi@atb.com}
                  |           |      |                   |                      |  
 winter-forest-89 | Devops    | 8626 | hidden-sunset-51  | wdc07-atb-production | {ahsan.qaiser@ibm.com,
                  |           |      |                   |                      |  andrew.tanner@ca.ibm.com,
                  |           |      |                   |                      |  george.fleifel@ibm.com,
                  |           |      |                   |                      |  gravichandran@atb.com,
                  |           |      |                   |                      |  harmeek.jhutty@ibm.com,
                  |           |      |                   |                      |  jibran.shaukat@ibm.com,
                  |           |      |                   |                      |  oaderibigbe@atb.com,
                  |           |      |                   |                      |  ssanaga@atb.com,
                  |           |      |                   |                      |  vhsi@atb.com}

Non-@weave.works, no-billing instances without a team

  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 1902 | fearless-sound-75     | SohoHouse - Production | {albert.asawaroengchai@sohohouse.com,
      |                       |                        |  dan2552@gmail.com,
      |                       |                        |  danfernandezv@gmail.com,
      |                       |                        |  dryginlogic@gmail.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen@serpieters.be,
      |                       |                        |  samtgarson@gmail.com,
      |                       |                        |  yacopal@gmail.com}
      |                       |                        |
 2519 | rough-lake-72         | Dev                    | {kni@lunarway.com}
      |                       |                        |
 2655 | loud-moon-81          | mrcooperin             | {archana.chaluvadi@nationstarmail.com,
      |                       |                        |  elm.lippoldt@nationstarmail.com,
      |                       |                        |  james.bolton@nationstarmail.com,
      |                       |                        |  jonathan.bucio@nationstarmail.com,
      |                       |                        |  keith.hart@nationstarmail.com,
      |                       |                        |  larry.flynt@nationstarmail.com,
      |                       |                        |  leo.chibvongodze@nationstarmail.com,
      |                       |                        |  matthew.clark@nationstarmail.com,
      |                       |                        |  nikhil.vyas@nationstarmail.com,
      |                       |                        |  rengarajan.g@nationstarmail.com,
      |                       |                        |  robert.howerton@nationstarmail.com,
      |                       |                        |  tony.okorodudu@nationstarmail.com,
      |                       |                        |  william.white@nationstarmail.com}
      |                       |                        |
 2979 | lingering-darkness-54 | Katacoda               | {sunny.bhogal@mporium.com}
      |                       |                        |
 3033 | bold-shape-01         | Qordoba-staging        | {waseem@qordoba.com}
      |                       |                        |
 3489 | patient-bird-43       | Skyscanner - nonprod   | {charlie.gildawie@skyscanner.net,
      |                       |                        |  christian.simon@jetstack.io,
      |                       |                        |  matt.turner@skyscanner.net}
      |                       |                        |
 3938 | fearless-resonance-73 | Untitled Cluster       | {mf@seldon.io}
      |                       |                        |
 4195 | dazzling-night-53     | SohoHouse - Staging    | {albert.asawaroengchai@sohohouse.com,
      |                       |                        |  dan2552@gmail.com,
      |                       |                        |  danfernandezv@gmail.com,
      |                       |                        |  dryginlogic@gmail.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen@serpieters.be,
      |                       |                        |  samtgarson@gmail.com,
      |                       |                        |  software-devs@sohohouse.com,
      |                       |                        |  yacopal@gmail.com}
      |                       |                        |
 4744 | restless-paper-03     | nervana gke dev        | {dan.bode@intel.com,
      |                       |                        |  elson.o.rodriguez@intel.com,
      |                       |                        |  gale.pedowitz@intel.com,
      |                       |                        |  jose.g.aguirre@intel.com,
      |                       |                        |  nan.liu@intel.com}
      |                       |                        |
 5005 | rough-wind-53         | ATB-DigitalLab-QA      | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com}
      |                       |                        |
 5501 | pale-sunset-50        | dev-3                  | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  ethan@qordoba.com,
      |                       |                        |  franzi@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  kirill@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  radim@qordoba.com,
      |                       |                        |  sashank@qordoba.com,
      |                       |                        |  tony@qordoba.om,
      |                       |                        |  waseem@qordoba.com}
      |                       |                        |
 5570 | new-rock-62           | prod-3                 | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  maiko@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  waseem@qordoba.com}
      |                       |                        |
 5827 | charming-rain-42      | test-3                 | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  kirill@qordoba.com,
      |                       |                        |  manhal@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  radim@qordoba.com}
      |                       |                        |
 6288 | courageous-sky-09     | ATB-DigitalLab-OPS2    | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  harmeek.jhutty@ibm.com}
      |                       |                        |
 6393 | eager-fog-53          | atb-innovation-prod    | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com}
      |                       |                        |
 6403 | nameless-forest-99    | kops-aws-kubernetes    | {melina@sanshypedesign.com}
      |                       |                        |
 6624 | giant-river-09        | Untitled Cluster       | {luke.marsden@gmail.com}
      |                       |                        |
 6763 | loud-blossom-11       | Uncon                  | {craig@wright.name}
      |                       |                        |
 6780 | long-rain-57          | Untitled Cluster       | {sergey.zyrin@xoomworks.com}
      |                       |                        |
 6829 | dazzling-thunder-66   | Untitled Cluster       | {paul.khodchenkov@xoomworks.com}
      |                       |                        |
 6853 | small-rock-09         | Untitled Cluster       | {eugene.kozlov@xoomworks.com}
      |                       |                        |
 7116 | brisk-sound-42        | Multi-Cloud Cluster    | {thalita.vergilio@yahoo.co.uk}
      |                       |                        |
 7335 | rough-moon-67         | wdc07-atb-dev          | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com,
      |                       |                        |  qhuang@atb.com}
      |                       |                        |
 7345 | ancient-wildflower-03 | DAL10-DEV              | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com}
      |                       |                        |
 7371 | black-cloud-16        | wdc07-atb-qa           | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com,
      |                       |                        |  oaderibigbe@atb.com,
      |                       |                        |  qhuang@atb.com}
      |                       |                        |
 758  | peaceful-grass-94     | Staging                | {adam.carlile@sohohouse.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen.serpieters@sohohouse.com,
      |                       |                        |  kips@sohohouse.com}
      |                       |                        |
 8055 | brisk-bird-42         | am-kube-gke            | {alex@automotivemastermind.com,
      |                       |                        |  brandon@automotivemastermind.com,
      |                       |                        |  bsambrone@automotivemastermind.com,
      |                       |                        |  deavon@automotivemastermind.com,
      |                       |                        |  jmoran@automotivemastermind.com,
      |                       |                        |  mroccuzzo@automotivemastermind.com,
      |                       |                        |  raj@automotivemastermind.com,
      |                       |                        |  scott@automotivemastermind.com,
      |                       |                        |  thomas@automotivemastermind.com,
      |                       |                        |  tim@automotivemastermind.com,
      |                       |                        |  twang@automotivemastermind.com}
      |                       |                        |
 830  | wispy-moon-56         | ImpactDev              | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}
      |                       |                        |
 915  | white-hill-63         | ImpactTest             | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}
      |                       |                        |
 932  | holy-pulsar-68        | ImpactProd             | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}
marccarre commented 6 years ago

Also, rather than polluting the team object, I'm thinking of introducing a new billing_accounts table, with just and id and that billed_externally flag for now. We could then join these with teams (and any other construct of our choice). And this could serve as the base of the MVP Enterprise Billing work.

leth commented 6 years ago

I think creating a minimal billing_accounts table sounds like a good idea, it's not too much work, and should be future-proof.

Since there aren't that many affected instances & teams right now, there's not too much toil - I'd keep the automation to a minimum, just create some buttons in the admin UI, or event a playbook entry with a DB query.

marccarre commented 6 years ago

Note that the "users" and "billing" domains are leaking into each others quite a lot at the moment, e.g.:

This is probably something we should clean up over time, in order to have well defined responsibilities.

As this happens, the billing_externally flag, should probably become a billing_provider with value external. While Zuora and GCP could be other providers with their own tables, and associated logic.

marccarre commented 6 years ago

Both an instance and an user can be linked to a team. Which relationship(s) should matter here?

  1. If an user belongs to a billed_externally team, but creates a "private" instance (i.e. attached to another team, say with just him in it, for simplicity), should this instance reject data upload/access? I'd naively say "no", and that the user should be able to access it, but then it means:

    1. on instance creation, we'd need to look at all the teams that user is in, and if one is billed_externally, then grant access, else refuse data access & upload.
    2. what if the user is in more than one billed_externally team? Which one should pay for that instance?
  2. We could simplify this for now, by saying that only the instance's team matters. That way, if the user creating the instance is not the one actually paying, then hopefully, this latter one would notice a new instance they do not want to pay for, and take action / delete it. However that means:

    1. all the users in this team would have access to the instance. Is that an issue? (Probably not too much for a first iteration?)
    2. it potentially creates noise for the other users. Is that an issue? (Probably not too much for a first iteration?)

If we want to provide both flexibility and control, we really seem to need to introduce the concept of a "billing account".

leth commented 6 years ago

It feels like we have a larger problem with "How should trial periods work", I don't think our trial logic is perfect right now, but I think it's probably out of scope for this issue?

As a separate piece of work, someone probably needs to take a step back and consider the UX of the trial system: what are we trying to enable, what we're trying to prevent and the importance and impact of each thing. e.g. it make sense to prevent people from freeloading by creating new instances, but do many people actually do that, since they'd lose history each time? Would the UX be better if we limited the number of instances they can create in trial mode, so if they are just invited an existing team they'll still have the option of creating a trial instance?

Can we just keep it as it is now? So the trial date is based on the user signup time, and if the user decides to pick an externally billed team for an instance, then they won't lose access if the trial period is over. If we just link the billing account to the team for now, there's no ambiguity, and we can move the relationship later if we need to. Actually this sounds like option 2 in your comment!

marccarre commented 6 years ago

out of scope for this issue

Indeed, just sharing my findings and thinking, so that we don't have to do that learning again in the future.

UX

+1

freeloading by creating new instances

One cannot freeload on us anymore, as we create all instances with TrialExpiresAt set to user.CreatedAt + 30 days.

https://github.com/weaveworks/service/blob/master/users/api/org.go#L108 https://github.com/weaveworks/service/blob/master/users/user.go#L58-L61 https://github.com/weaveworks/service/blob/master/users/user.go#L10-L12

And if you're in a billed_externally team, you could freeload whoever pays for it, if we go for option 1, but my plan for this first iteration is to go for option 2 anyway -- and Steve just approved it IRL.

marccarre commented 6 years ago

Remaining tasks:

marccarre commented 6 years ago

ATM/IBM's team is now marked as billed externally:

users_vpc=> SELECT team_id, external_id, name FROM organizations WHERE id IN ('8624', '8626');
 team_id |    external_id    |         name
---------+-------------------+----------------------
 107     | modern-feather-39 | wdc07-atb-preprod
 107     | hidden-sunset-51  | wdc07-atb-production
(2 rows)

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  2
INSERT 0 1

billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('2', '107');
INSERT 0 1

billing=> SELECT * FROM billing_accounts;
 id |          created_at           | deleted_at | billed_externally 
----+-------------------------------+------------+-------------------
  2 | 2018-04-19 12:19:24.662889+00 |            | t

billing=> SELECT * FROM billing_accounts_teams;
 id |          created_at           | deleted_at | billing_account_id | team_id 
----+-------------------------------+------------+--------------------+---------
  2 | 2018-04-19 12:20:15.310997+00 |            |                  2 | 107
marccarre commented 6 years ago

All above instances w/o teams now have a team, and that team is associated to a billing account with billed_externally set to true.

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 1902 | fearless-sound-75     | SohoHouse - Production | {albert.asawaroengchai@sohohouse.com,
      |                       |                        |  dan2552@gmail.com,
      |                       |                        |  danfernandezv@gmail.com,
      |                       |                        |  dryginlogic@gmail.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen@serpieters.be,
      |                       |                        |  samtgarson@gmail.com,
      |                       |                        |  yacopal@gmail.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team SohoHouse - Production', 'unlimited-cloud-01', now())
users_vpc-> RETURNING id;
 id
-----
 680

users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '680' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '1902'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL
users_vpc-> AND u.email NOT LIKE '%@weave.works';
INSERT 0 8

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  3
(1 row)

INSERT 0 1

billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('3', '680');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 2519 | rough-lake-72         | Dev                    | {kni@lunarway.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Dev', 'unlimited-cloud-02', now())
users_vpc-> RETURNING id;
 id
-----
 681
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '681' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '2519'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL
users_vpc-> AND u.email NOT LIKE '%@weave.works';
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  4
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('4', '681');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 2655 | loud-moon-81          | mrcooperin             | {archana.chaluvadi@nationstarmail.com,
      |                       |                        |  elm.lippoldt@nationstarmail.com,
      |                       |                        |  james.bolton@nationstarmail.com,
      |                       |                        |  jonathan.bucio@nationstarmail.com,
      |                       |                        |  keith.hart@nationstarmail.com,
      |                       |                        |  larry.flynt@nationstarmail.com,
      |                       |                        |  leo.chibvongodze@nationstarmail.com,
      |                       |                        |  matthew.clark@nationstarmail.com,
      |                       |                        |  nikhil.vyas@nationstarmail.com,
      |                       |                        |  rengarajan.g@nationstarmail.com,
      |                       |                        |  robert.howerton@nationstarmail.com,
      |                       |                        |  tony.okorodudu@nationstarmail.com,
      |                       |                        |  william.white@nationstarmail.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team mrcooperin', 'unlimited-cloud-03', now())
users_vpc-> RETURNING id;
 id
-----
 682
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '682' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '2655'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL
users_vpc-> AND u.email NOT LIKE '%@weave.works';
INSERT 0 13

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  5
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('5', '682');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 2979 | lingering-darkness-54 | Katacoda               | {sunny.bhogal@mporium.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Katacoda', 'unlimited-cloud-04', now())
users_vpc-> RETURNING id;
 id
-----
 683
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '683' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '2979'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  6
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('6', '683');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 3033 | bold-shape-01         | Qordoba-staging        | {waseem@qordoba.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Qordoba-staging', 'unlimited-cloud-05', now())
users_vpc-> RETURNING id;
 id
-----
 684
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '684' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '3033'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  7
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('7', '684');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 3489 | patient-bird-43       | Skyscanner - nonprod   | {charlie.gildawie@skyscanner.net,
      |                       |                        |  christian.simon@jetstack.io,
      |                       |                        |  matt.turner@skyscanner.net}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Skyscanner - nonprod', 'unlimited-cloud-06', now())
users_vpc-> RETURNING id;
 id
-----
 685
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '685' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '3489'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 3

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  8
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('8', '685');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 3938 | fearless-resonance-73 | Untitled Cluster       | {mf@seldon.io}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Untitled Cluster', 'unlimited-cloud-07', now())
users_vpc-> RETURNING id;
 id
-----
 686
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '686' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '3938'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
  9
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('9', '686');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 4195 | dazzling-night-53     | SohoHouse - Staging    | {albert.asawaroengchai@sohohouse.com,
      |                       |                        |  dan2552@gmail.com,
      |                       |                        |  danfernandezv@gmail.com,
      |                       |                        |  dryginlogic@gmail.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen@serpieters.be,
      |                       |                        |  samtgarson@gmail.com,
      |                       |                        |  software-devs@sohohouse.com,
      |                       |                        |  yacopal@gmail.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team SohoHouse - Staging', 'unlimited-cloud-08', now())
users_vpc-> RETURNING id;
 id
-----
 687
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '687' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '4195'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 11

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 10
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('10', '687');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 4744 | restless-paper-03     | nervana gke dev        | {dan.bode@intel.com,
      |                       |                        |  elson.o.rodriguez@intel.com,
      |                       |                        |  gale.pedowitz@intel.com,
      |                       |                        |  jose.g.aguirre@intel.com,
      |                       |                        |  nan.liu@intel.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team nervana gke dev', 'unlimited-cloud-09', now())
users_vpc-> RETURNING id;
 id
-----
 688
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '688' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '4744'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 5

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 11
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('11', '688');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 5005 | rough-wind-53         | ATB-DigitalLab-QA      | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team ATB-DigitalLab-QA', 'unlimited-cloud-10', now())
users_vpc-> RETURNING id;
 id
-----
 689
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '689' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '5005'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 5

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 12
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('12', '689');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 5501 | pale-sunset-50        | dev-3                  | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  ethan@qordoba.com,
      |                       |                        |  franzi@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  kirill@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  radim@qordoba.com,
      |                       |                        |  sashank@qordoba.com,
      |                       |                        |  tony@qordoba.om,
      |                       |                        |  waseem@qordoba.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team dev-3', 'unlimited-cloud-11', now())
users_vpc-> RETURNING id;
 id
-----
 691
(1 row)

INSERT 0 1

users_vpc=> SELECT * FROM teams WHERE id = '690';
 id | name | external_id | zuora_account_number | zuora_account_created_at | trial_expires_at | trial_pendin
g_expiry_notified_at | trial_expired_notified_at | created_at
----+------+-------------+----------------------+--------------------------+------------------+-------------
---------------------+---------------------------+------------
(0 rows)

users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '691' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '5501'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 13

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 13
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('13', '691');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 5570 | new-rock-62           | prod-3                 | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  maiko@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  waseem@qordoba.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team prod-3', 'unlimited-cloud-12', now())
users_vpc-> RETURNING id;
 id
-----
 692
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '692' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '5570'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 8

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 14
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('14', '692');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 5827 | charming-rain-42      | test-3                 | {ami@qordoba.com,
      |                       |                        |  brent@qordoba.com,
      |                       |                        |  hussam@qordoba.com,
      |                       |                        |  jr@qordoba.com,
      |                       |                        |  kirill@qordoba.com,
      |                       |                        |  manhal@qordoba.com,
      |                       |                        |  marek@qordoba.com,
      |                       |                        |  moayad@qordoba.com,
      |                       |                        |  radim@qordoba.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team test-3', 'unlimited-cloud-13', now())
users_vpc-> RETURNING id;
 id
-----
 693
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '693' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '5827'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 9

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 15
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('15', '693');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6288 | courageous-sky-09     | ATB-DigitalLab-OPS2    | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  harmeek.jhutty@ibm.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team ATB-DigitalLab-OPS2', 'unlimited-cloud-14', now())
users_vpc-> RETURNING id;
 id
-----
 694
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '694' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6288'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 4

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 16
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('16', '694');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6393 | eager-fog-53          | atb-innovation-prod    | {andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team atb-innovation-prod', 'unlimited-cloud-15', now())
users_vpc-> RETURNING id;
 id
-----
 695
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '695' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6393'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 5

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 17
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('17', '695');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6403 | nameless-forest-99    | kops-aws-kubernetes    | {melina@sanshypedesign.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team kops-aws-kubernetes', 'unlimited-cloud-16', now())
users_vpc-> RETURNING id;
 id
-----
 696
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '696' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6403'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 2

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 18
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('18', '696');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6624 | giant-river-09        | Untitled Cluster       | {luke.marsden@gmail.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Untitled Cluster', 'unlimited-cloud-17', now())
users_vpc-> RETURNING id;
 id
-----
 697
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '697' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6624'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 19
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('19', '697');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6763 | loud-blossom-11       | Uncon                  | {craig@wright.name}

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 20
(1 row)

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Uncon', 'unlimited-cloud-18', now())
users_vpc-> RETURNING id;
 id
-----
 698
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '698' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6763'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 20
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('20', '698');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6780 | long-rain-57          | Untitled Cluster       | {sergey.zyrin@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Untitled Cluster', 'unlimited-cloud-20', now())
users_vpc-> RETURNING id;
 id
-----
 699
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '699' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6780'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 21
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('21', '699');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6829 | dazzling-thunder-66   | Untitled Cluster       | {paul.khodchenkov@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Untitled Cluster', 'unlimited-cloud-21', now())
users_vpc-> RETURNING id;
 id
-----
 700
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '700' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6829'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 22
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('22', '700');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 6853 | small-rock-09         | Untitled Cluster       | {eugene.kozlov@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Untitled Cluster', 'unlimited-cloud-22', now())
users_vpc-> RETURNING id;
 id
-----
 701
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '701' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '6853'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 23
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('23', '701');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 7116 | brisk-sound-42        | Multi-Cloud Cluster    | {thalita.vergilio@yahoo.co.uk}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Multi-Cloud Cluster', 'unlimited-cloud-23', now())
users_vpc-> RETURNING id;
 id
-----
 702
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '702' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '7116'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 1

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 24
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('24', '702');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 7335 | rough-moon-67         | wdc07-atb-dev          | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com,
      |                       |                        |  qhuang@atb.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team wdc07-atb-dev', 'unlimited-cloud-24', now())
users_vpc-> RETURNING id;
 id
-----
 703
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '703' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '7335'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 8

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 25
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('25', '703');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 7345 | ancient-wildflower-03 | DAL10-DEV              | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team DAL10-DEV', 'unlimited-cloud-25', now())
users_vpc-> RETURNING id;
 id
-----
 704
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '704' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '7345'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 7

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 26
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('26', '704');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 7371 | black-cloud-16        | wdc07-atb-qa           | {ahsan.qaisar@ibm.com,
      |                       |                        |  andrew.tanner@ca.ibm.com,
      |                       |                        |  bernie@ca.ibm.com,
      |                       |                        |  george.fleifel@ibm.com,
      |                       |                        |  gravichandran@atb.com,
      |                       |                        |  harmeek.jhutty@ibm.com,
      |                       |                        |  jibran.shaukat@ibm.com,
      |                       |                        |  oaderibigbe@atb.com,
      |                       |                        |  qhuang@atb.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team wdc07-atb-qa', 'unlimited-cloud-26', now())
users_vpc-> RETURNING id;
 id
-----
 705
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '705' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '7371'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 9

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 27
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('27', '705');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 758  | peaceful-grass-94     | Staging                | {adam.carlile@sohohouse.com,
      |                       |                        |  ipedrazas@gmail.com,
      |                       |                        |  jeroen.serpieters@sohohouse.com,
      |                       |                        |  kips@sohohouse.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team Staging', 'unlimited-cloud-27', now())
users_vpc-> RETURNING id;
 id
-----
 706
(1 row)

INSERT 0 1

users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '706' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '758'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 5

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 28
(1 row)

INSERT 0 1

billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('28', '706');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 8055 | brisk-bird-42         | am-kube-gke            | {alex@automotivemastermind.com,
      |                       |                        |  brandon@automotivemastermind.com,
      |                       |                        |  bsambrone@automotivemastermind.com,
      |                       |                        |  deavon@automotivemastermind.com,
      |                       |                        |  jmoran@automotivemastermind.com,
      |                       |                        |  mroccuzzo@automotivemastermind.com,
      |                       |                        |  raj@automotivemastermind.com,
      |                       |                        |  scott@automotivemastermind.com,
      |                       |                        |  thomas@automotivemastermind.com,
      |                       |                        |  tim@automotivemastermind.com,
      |                       |                        |  twang@automotivemastermind.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team am-kube-gke', 'unlimited-cloud-28', now())
users_vpc-> RETURNING id;
 id
-----
 707
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '707' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '8055'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 11

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 29
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('29', '707');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 830  | wispy-moon-56         | ImpactDev              | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team ImpactDev', 'unlimited-cloud-29', now())
users_vpc-> RETURNING id;
 id
-----
 708
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '708' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '830'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 14

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 30
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('30', '708');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 915  | white-hill-63         | ImpactTest             | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team ImpactTest', 'unlimited-cloud-30', now())
users_vpc-> RETURNING id;
 id
-----
 709
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '709' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '915'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 13

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 31
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('31', '709');
INSERT 0 1

------+-----------------------+------------------------+------------------------------------------
  id  |      external_id      |          name          |     emails
------+-----------------------+------------------------+------------------------------------------
 932  | holy-pulsar-68        | ImpactProd             | {anna.betskova@xoomworks.com,
      |                       |                        |  anthony.milbourne@mporium.com,
      |                       |                        |  chris.hackett@mporium.com,
      |                       |                        |  elena.dubrovina@xoomworks.com,
      |                       |                        |  ivan.golovin@xoomworks.com,
      |                       |                        |  mamta.sharma@mporium.com,
      |                       |                        |  paul.khodchenkov@xoomworks.com,
      |                       |                        |  pavel.viktorovich@xoomworks.com,
      |                       |                        |  peter.maciocia@mporium.com,
      |                       |                        |  richard.martinus@mporium.com,
      |                       |                        |  steve.doggett@mporium.com,
      |                       |                        |  sunny.bhogal@mporium.com,
      |                       |                        |  svetlana.lopato@xoomworks.com}

users_vpc=> INSERT INTO teams(name, external_id, trial_expires_at)
users_vpc-> VALUES('Team ImpactProd', 'unlimited-cloud-31', now())
users_vpc-> RETURNING id;
 id
-----
 710
(1 row)

INSERT 0 1
users_vpc=> INSERT INTO team_memberships(user_id, team_id)
users_vpc-> SELECT m.user_id AS user_id, '710' AS team_id
users_vpc-> FROM memberships AS m, users AS u
users_vpc-> WHERE m.organization_id = '932'
users_vpc-> AND m.user_id = u.id
users_vpc-> AND m.deleted_at IS NULL
users_vpc-> AND u.deleted_at IS NULL;
INSERT 0 13

billing=> INSERT INTO billing_accounts(billed_externally) VALUES(true) RETURNING id;
 id
----
 32
(1 row)

INSERT 0 1
billing=> INSERT INTO billing_accounts_teams(billing_account_id, team_id) VALUES('32', '710');
INSERT 0 1