2012/02/20

Spring Soical Auth MySQL Table Issue

The suggested Spring Social JdbcUsersConnectionRepository SQL didn't work with MySQL. Based off a Jira ticket of the issue I've changed the userId, providerId and providerUserId to LATIN-1 which allows the unique index to be created.



create table UserConnection (userId varchar(255) not null CHARACTER SET LATIN-1,
providerId varchar(255) not null CHARACTER SET LATIN-1,
providerUserId varchar(255),
rank int not null,
displayName varchar(255),
profileUrl varchar(512),
imageUrl varchar(512),
accessToken varchar(256) not null,
secret varchar(255),
refreshToken varchar(255),
expireTime bigint,
primary key (userId, providerId, providerUserId));
create unique index UserConnectionRank on UserConnection(userId, providerId, rank);