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

Remove unused last_used column from access_tokens table #8972

Closed
clokep opened this issue Dec 18, 2020 · 9 comments
Closed

Remove unused last_used column from access_tokens table #8972

clokep opened this issue Dec 18, 2020 · 9 comments
Labels
Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)

Comments

@clokep
Copy link
Member

clokep commented Dec 18, 2020

The last_used column on access_tokens is unused, we should remove it.

See #8970 (comment)_

@clokep clokep added Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution maintenance z-p3 (Deprecated Label) labels Dec 18, 2020
@clokep
Copy link
Member Author

clokep commented Dec 18, 2020

This is a bit more of a faff than expected since sqlite cannot drop columns directly, e.g. check out synapse/storage/databases/main/schema/delta/46/user_dir_null_room_ids.sql

@jerinjtitus
Copy link
Contributor

jerinjtitus commented Dec 31, 2020

So, it should be dropped from the sql files, right? And is it just required to be removed for sqlite or also for postgres.

@clokep
Copy link
Member Author

clokep commented Jan 4, 2021

So, it should be dropped from the sql files, right?

A new migration file needs to be added that drops the column.

And is it just required to be removed for sqlite or also for postgres.

It should be done for both.

@jerinjtitus
Copy link
Contributor

jerinjtitus commented Jan 4, 2021

A new migration file needs to be added that drops the column.

I was going through those files; I guess I have to create like a buffer table in the new migration file and copy the values from the previous one and then drop it. Then rename the new table. Am I right so far?

@clokep
Copy link
Member Author

clokep commented Jan 4, 2021

That's pretty much what is done in synapse/storage/databases/main/schema/delta/46/user_dir_null_room_ids.sql, so I think it is right.

@jerinjtitus
Copy link
Contributor

image

Can you help me with understanding how exactly this classification works? And are all the migrations automatically made if directly added to the appropriate directory?

@richvdh
Copy link
Member

richvdh commented Jan 5, 2021

Just add a new migration to the most recent delta directory, with a new number.

There is a bit of documentation about the system at https://github.com/matrix-org/synapse/blob/develop/synapse/storage/prepare_database.py#L288, but it needs an update to be honest.

@jerinjtitus
Copy link
Contributor

Just add a new migration to the most recent delta directory, with a new number.

There is a bit of documentation about the system at https://github.com/matrix-org/synapse/blob/develop/synapse/storage/prepare_database.py#L288, but it needs an update to be honest.

Thanks

@clokep
Copy link
Member Author

clokep commented Jan 11, 2021

Fixed in #9025.

@clokep clokep closed this as completed Jan 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

3 participants