markitosgv/JWTRefreshTokenBundle

Update from v1.1.1 to v1.1.3 leads to wrong sequence names

Closed this issue · 2 comments

Hey,

I've just upgraded the package from version 1.1.1 to version 1.1.3, but I am now getting the following error when I try to log in:

An exception occurred while executing 'SELECT NEXTVAL('refresh_tokens_id_seq')':

SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "refresh_tokens_id_seq" does not exist
LINE 1: SELECT NEXTVAL('refresh_tokens_id_seq')

I think this is because the table of the RefreshToken has a specific name:

#[ORM\Entity]
#[ORM\Table(name: 'user_refresh_tokens')]
class RefreshToken extends BaseRefreshToken
{ }

However, there is an actual workaround, as it is what the bin/console d:s:u --dump-sql suggests: Dropping the old sequence called user_refresh_tokens_id_seq and create the new like

CREATE SEQUENCE refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;

This works, but makes it necessary to make some kind of migration for production environments because we're already running a sequence on user_refresh_tokens_id_seq.


Is there a way to avoid that, because the old sequence was made by the package in its previous version. So it seems like it is missing some kind of backwards compatibility.

Was it only this bundle that was updated, or were other packages updated at the same time? This sounds an awful lot like doctrine/orm#10927.

Note that there isn't anything in this bundle controlling that aspect of the database schema, that's all on the ORM.

Yeah, it wasn't the only package. I am with you, sounds like the Doctrine issue. Can be closed then. Thank you for your quick response!