-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Squash migrations
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
create table bodies | ||
( | ||
id integer not null | ||
constraint bodies_pk | ||
primary key autoincrement, | ||
query1 TEXT, | ||
body_type TEXT not null, | ||
scroll_adjustment REAL, | ||
navigation_type TEXT not null, | ||
query2 TEXT | ||
); | ||
|
||
create table collections | ||
( | ||
id integer not null | ||
constraint collections_pk | ||
primary key autoincrement, | ||
path TEXT not null, | ||
modified sqlite_uint64 | ||
); | ||
|
||
create unique index collections_path_uindex | ||
on collections (path); | ||
|
||
create table songs | ||
( | ||
id integer not null | ||
constraint songs_pk | ||
primary key autoincrement, | ||
path TEXT not null, | ||
collection_id integer not null | ||
constraint songs_collections_id_fk | ||
references collections | ||
on update cascade on delete cascade, | ||
title TEXT, | ||
artist TEXT, | ||
album TEXT, | ||
datetime sqlite_uint64, | ||
genre TEXT, | ||
track_number integer, | ||
album_artist TEXT, | ||
duration sqlite_uint64 not null | ||
); | ||
|
||
create table config | ||
( | ||
current_song_position sqlite_uint64 not null | ||
constraint config_pk | ||
primary key, | ||
current_song_id integer | ||
constraint config_songs_id_fk | ||
references songs | ||
on update cascade on delete set null, | ||
window_width integer default 0 not null, | ||
window_height integer default 0 not null, | ||
maximized integer default 0 not null, | ||
now_playing_body_realized integer default 0 not null | ||
); | ||
|
||
insert into config(current_song_position) | ||
VALUES (0); | ||
|
||
create index songs_artist_index | ||
on songs (artist); | ||
|
||
create index songs_collection_id_index | ||
on songs (collection_id); | ||
|
||
create unique index songs_path_uindex | ||
on songs (path); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
use diesel::prelude::*; | ||
use diesel::update; | ||
use crate::db::get_connection; | ||
use crate::schema::config::dsl::config; | ||
use crate::schema::config::now_playing_body_realized; | ||
|
||
#[derive(Queryable, Selectable, Debug)] | ||
#[diesel(table_name = crate::schema::config)] | ||
#[diesel(check_for_backend(diesel::sqlite::Sqlite))] | ||
pub struct Config { | ||
pub current_song_position: i64, | ||
pub current_song_id: Option<i32>, | ||
pub window_width: i32, | ||
pub window_height: i32, | ||
pub maximized: i32, | ||
pub current_song_position: i64, | ||
pub now_playing_body_realized: i32, | ||
} | ||
|
||
pub fn update_now_playing_body_realized(realized: bool) { | ||
update(config).set(now_playing_body_realized.eq(if realized { 1 } else { 0 })).execute(&mut get_connection()) | ||
.unwrap(); | ||
} |