Page MenuHomePhabricator

Add timestamps to ce_organizers table [V1]
Closed, ResolvedPublic5 Estimated Story Points

Description

As a member of the Campaigns team, I want to add timestamps to the ce_organizers table, so that we have logging for organizer actions/activities later.

Acceptance Criteria:

  • Add timestamps for the ce_organizers table, like:
    • created_at
    • deleted_at

We'll do this for V1, even if we don't need that information, so that it's still available for past events. No need for backwards-compatibility and the beta DB can be backfilled with random dates.

Rough plan
  • Write the patch that creates the columns in the code, with logic to populate them. Review it, but DO NOT MERGE IT. Only give it a +1, explicitly writing in a comment that the +1 means you are approving the change (and not that you have a working mouse).
  • Create the columns on beta with a default random value
  • Merge the patch and wait for it to reach beta
  • Drop defaults on beta
NOTE: Since we're not doing this in a backwards-compatible way, you will have to alter the tables manually on your local once the patch is merged

Event Timeline

ifried updated the task description. (Show Details)
ldelench_wmf set the point value for this task to 5.

I'm working on this, but I'm wondering if we need the "updated_at" field. What was its purpose? Also, this is a field that we could add in the future if need be, and it could be backfilled with the value of created_at. @cmelo @MHorsey-WMF @ifried @vyuen any thoughts?

@Daimona I seem to recall I had the same question when we all discussed it! πŸ˜†

@Daimona I seem to recall I had the same question when we all discussed it! πŸ˜†

You definitely did, I remember that! And I also remember me answering that question, just to realize that the use case I had in mind was actually wrong. Then I think I came up with some possible alternative use case, but it didn't convince me. All in all, I think we don't need this field, as it would only make the queries more complex.

I'm working on this, but I'm wondering if we need the "updated_at" field. What was its purpose? Also, this is a field that we could add in the future if need be, and it could be backfilled with the value of created_at. @cmelo @MHorsey-WMF @ifried @vyuen any thoughts?

I think we really don’t need the "updated_at" it will not make any difference, also in the future we will create logs of user actions (probably), so this is really not needed.
I think you can go ahead and create only the other columns, thanks @Daimona !

β€’ vyuen changed the task status from Open to Stalled.Aug 30 2022, 12:17 PM
Daimona changed the task status from Stalled to Open.Aug 30 2022, 12:31 PM
Daimona updated the task description. (Show Details)

Change 828027 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Add creation and deletion timestamp to ce_organizers table

https://gerrit.wikimedia.org/r/828027

β€’ vyuen changed the task status from Open to In Progress.Aug 30 2022, 3:13 PM

Change 828027 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add creation and deletion timestamp to ce_organizers table

https://gerrit.wikimedia.org/r/828027

Change 827580 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Add creation and deletion timestamp to ce_organizers table

https://gerrit.wikimedia.org/r/827580

These are the commands that I will run on beta:

ALTER TABLE ce_organizers ADD COLUMN ceo_created_at BINARY(14) NOT NULL DEFAULT '20220718130000';
ALTER TABLE ce_organizers ADD COLUMN ceo_deleted_at BINARY(14) DEFAULT NULL;

Then, after the patch is merged:

ALTER TABLE ce_organizers ALTER ceo_created_at DROP DEFAULT

Mentioned in SAL (#wikimedia-releng) [2022-08-31T16:21:18Z] <Daimona> Applying schema change to the wikishared DB on beta for the CampaignEvents extension (1/2) # T312870

Change 827580 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add creation and deletion timestamp to ce_organizers table

https://gerrit.wikimedia.org/r/827580

Mentioned in SAL (#wikimedia-releng) [2022-08-31T16:37:04Z] <Daimona> Applying schema change to the wikishared DB on beta for the CampaignEvents extension (2/2) # T312870

Patch merged, and beta DB updated. This is now ready for QA.

@vaughnwalters To see the schema: SSH to deploy03 and connect to the DB with sql wikishared.

Then you want to check that table definitions (column types, indexes etc.) and make sure that they match the code definition.

To see a table definition: DESCRIBE my_table_name;. To see the indexes on a table: SHOW INDEX FROM my_table_name;

SHOW INDEX FROM ce_organizers;

Screen Shot 2022-09-09 at 11.57.49 AM.png (392Γ—2 px, 334 KB)


DESCRIBE ce_organizers;

Screen Shot 2022-09-09 at 11.59.48 AM.png (478Γ—1 px, 243 KB)


From the code definitions

Screen Shot 2022-09-09 at 12.00.35 PM.png (600Γ—878 px, 93 KB)


AC passes. ce_organizers table now has fields ceo_created_at_and ceo_deleted_at. Marking this as done.