We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f90f99 commit 2f9a34eCopy full SHA for 2f9a34e
src/bin/migrate.rs
@@ -751,6 +751,19 @@ fn migrations() -> Vec<Migration> {
751
DROP NOT NULL", &[]));
752
Ok(())
753
}),
754
+ Migration::new(20160812094502, |tx| {
755
+ // Enusre that gh_id is always unique (sure hope it is), but
756
+ // only where the id is > 0. Historically we didn't track id, and we
757
+ // had to fill it in at one point after-the-fact. User rows that
758
+ // couldn't be resolved either have a github id of 0 or -1 so they
759
+ // can't ever be logged into again.
760
+ try!(tx.execute("CREATE UNIQUE INDEX users_gh_id \
761
+ ON users (gh_id) WHERE gh_id > 0", &[]));
762
+ Ok(())
763
+ }, |tx| {
764
+ try!(tx.execute("DROP INDEX users_gh_id", &[]));
765
766
+ }),
767
];
768
// NOTE: Generate a new id via `date +"%Y%m%d%H%M%S"`
769
0 commit comments