It looks like you're right about mysql accepting null values in unique keys
(
http://stackoverflow.com/questions/3712222/does-mysql-ignore-null-values-on-unique-constraints).
 I feel a little nervous relying on that detail but trust your judgment.


On Tue, Jun 3, 2014 at 5:30 PM, Laurel <notifications@github.com> wrote:

> In lib/tasks/seed.rake:
>
> > @@ -14,6 +14,20 @@ namespace :seed do
> >      end
> >    end
> >
> > +  task import_stanford_hints: :environment do
> > +    LevelSourceHint.transaction do
> > +      CSV.read('config/stanford-hint-ids.tsv', { col_sep: "\t" }).each do |row|
> > +        LevelSourceHint.create!(level_source_id: row[0], hint_id: row[1])
>
> but [level_source_id, hint_id] is guaranteed to be unique if hint_id is
> not null? (I think mysql is cool with that being a unique index in that
> case)
> … <#14664492a577dcca_>
> On Tue, Jun 3, 2014 at 5:11 PM, Ellen Spertus <notifications@github.com>
> wrote: In lib/tasks/seed.rake: > @@ -14,6 +14,20 @@ namespace :seed do >
> end > end > > + task import_stanford_hints: :environment do > +
> LevelSourceHint.transaction do > + CSV.read('config/stanford-hint-ids.tsv',
> { col_sep: "\t" }).each do |row| > +
> LevelSourceHint.create!(level_source_id: row[0], hint_id: row[1]) It's
> expected that there will be LevelSourceHints with the same stanford
> hint_id; [level_source_id, hint_id] is not guaranteed to be unique unless
> hint_id is not null. — Reply to this email directly or view it on GitHub <
> https://github.com/code-dot-org/dashboard/pull/771/files#r13366269>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/code-dot-org/dashboard/pull/771/files#r13366784>.
>