diff --git a/migrations/sqlite/0004_library.sql b/migrations/sqlite/0004_library.sql index 8400913..66b6c89 100644 --- a/migrations/sqlite/0004_library.sql +++ b/migrations/sqlite/0004_library.sql @@ -1,6 +1,6 @@ -- @up -create table books ( +create table library_books ( id integer primary key autoincrement, isbn integer default 0 not null, -- ISBN-10 check digit. If it is the maximum allowable value in the base-11 format (i.e. the ISBN-10 ends with "X") this will be "1". @@ -17,8 +17,8 @@ create table library ( chatid integer, available boolean default true not null, - foreign key bookid references books(id) -) + foreign key (bookid) references library_books(id) +); create unique index bookid_chatid_library_idx on library(bookid, chatid); create table library_checkout ( @@ -46,7 +46,6 @@ create table library_queue ( foreign key (bookid) references library_books(id), foreign key (userid) references users(id) - ); create index library_queue_bookid_idx on library_queue (bookid); @@ -68,7 +67,7 @@ create table ol_cache ( requested datetime default current_timestamp not null, -- We cache the full response for later debugging, if needed. - json_response text default '' not null, + json_response text default '' not null ); create unique index ol_cache_isbn_idx on ol_cache(isbn);