Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Add CampaignSpecs & ChangesetSpecs tables, type definitions and campaigns.Store support #11711

Merged
merged 3 commits into from
Jun 25, 2020

Conversation

mrnugget
Copy link
Contributor

Merge target of this PR is https://github.com/sourcegraph/sourcegraph/pull/11675, which will contain the new campaigns workflow and allows us to merge without breaking master.

This is the next step to build up the necessary CRUD pieces and adds:

  • a campaign_specs table, a CampaignSpec type definition and methods in campaigns.Store
  • same goes for ChangesetSpec

The schema is:

  • a campaign can have one campaign_spec
  • a campaign_spec can have many changeset_spec

Most notable is that changeset_specs.campaign_spec_id is nullable so that users can create ChangesetSpecs individually and then attach them to CampaignSpecs.

And both tables have a new rand_id column that contains a short, unguessable text ID that we can use as an external GraphQL node ID for both.


Other than that: this is just the usual boilerplate that we used before. Major difference is that I made the tests a bit cleaner and created separate files (!) which I think we should do for the other tables too. It's far easier to work with.

@mrnugget mrnugget added campaigns batch-changes Issues related to Batch Changes RFC-157 Tickets related to RFC 157 - Campaigns authorization model labels Jun 25, 2020
@mrnugget mrnugget added this to the 3.18 milestone Jun 25, 2020
@mrnugget mrnugget requested review from a team and removed request for a team June 25, 2020 10:12
@mrnugget mrnugget mentioned this pull request Jun 25, 2020
28 tasks
Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to review the base PR of this one now, afterwards fine to merge

internal/campaigns/types.go Outdated Show resolved Hide resolved
internal/campaigns/types.go Show resolved Hide resolved
mrnugget added 2 commits June 25, 2020 15:22
The schema is:

- a `campaign` can have one `campaign_spec`
- a `campaign_spec` can have many `changeset_spec`

Most notable is that `changeset_specs.campaign_spec_id` is nullable so
that users can create `ChangesetSpecs` individually and then attach them
to `CampaignSpecs`.

And both tables have a new `rand_id` column that contains a short,
unguessable text ID that we can use as an external GraphQL node ID for
both.
@mrnugget mrnugget merged commit 3171287 into campaign-spec-api-v1 Jun 25, 2020
@mrnugget mrnugget deleted the campaign-spec-api-v1-new-tables branch June 25, 2020 13:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
batch-changes Issues related to Batch Changes RFC-157 Tickets related to RFC 157 - Campaigns authorization model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants