fix unique key for auth

This commit is contained in:
yggverse 2024-11-20 09:54:01 +02:00
parent 59e9739142
commit cadefe3f1d
4 changed files with 4 additions and 8 deletions

View File

@ -34,7 +34,7 @@ impl Gemini {
// Init components
let auth = match Auth::new(connection.clone()) {
Ok(auth) => Rc::new(auth),
Err(reason) => return Err(Error::AuthInit(reason)), // @TODO
Err(reason) => return Err(Error::AuthInit(reason)),
};
let database = Rc::new(Database::new(connection, profile_identity_id.clone()));
let memory = Rc::new(Memory::new());

View File

@ -89,7 +89,7 @@ impl Auth {
.memory
.add(record.url, record.profile_identity_gemini_id)
{
return Err(Error::Memory(reason));
return Err(Error::MemoryIndex(reason));
}
}
}

View File

@ -78,11 +78,7 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
`url` VARCHAR(1024) NOT NULL,
FOREIGN KEY (`profile_identity_gemini_id`) REFERENCES `profile_identity_gemini`(`id`),
UNIQUE (
`profile_identity_gemini_id`,
`url`
)
UNIQUE (`url`)
)",
[],
)

View File

@ -4,5 +4,5 @@ pub enum Error {
DatabaseRecordCreate(i64, String),
DatabaseRecordDelete(i64),
DatabaseRecordsRead(String),
Memory(super::memory::Error),
MemoryIndex(super::memory::Error),
}