CREATE TABLE redirectauth_mappings ( local_id int NOT NULL UNIQUE, external_id varchar(255) NOT NULL UNIQUE, PRIMARY KEY (local_id, external_id) ); -- We don't define a foreign key from local_id to the user table because doing so -- is difficult in a manner that works with both MySQL and PostgreSQL, so we'd -- have to maintain this schema in multiple dialects, which just isn't worth it.