create table channel ( id text not null primary key, name text not null unique ); create table channel_member ( channel text not null references channel, login text not null references login, primary key (channel, login) ); create index channel_member_login on channel_member (login);