mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Move sql code for upgrading to schema 17 to a separate file
This commit is contained in:
parent
c6e3d55400
commit
1be789f25f
2 changed files with 9 additions and 11 deletions
|
@ -171,17 +171,8 @@ impl SqliteStorage {
|
||||||
})
|
})
|
||||||
})?
|
})?
|
||||||
.collect::<Result<Vec<Tag>>>()?;
|
.collect::<Result<Vec<Tag>>>()?;
|
||||||
self.db.execute_batch(
|
self.db
|
||||||
"
|
.execute_batch(include_str!["../upgrades/schema17_upgrade.sql"])?;
|
||||||
drop table tags;
|
|
||||||
create table tags (
|
|
||||||
id integer primary key not null,
|
|
||||||
name text not null collate unicase,
|
|
||||||
usn integer not null,
|
|
||||||
config blob not null
|
|
||||||
);
|
|
||||||
",
|
|
||||||
)?;
|
|
||||||
tags.into_iter().try_for_each(|mut tag| -> Result<()> {
|
tags.into_iter().try_for_each(|mut tag| -> Result<()> {
|
||||||
tag.name = human_tag_name_to_native(&tag.name);
|
tag.name = human_tag_name_to_native(&tag.name);
|
||||||
self.register_tag(&mut tag)
|
self.register_tag(&mut tag)
|
||||||
|
|
7
rslib/src/storage/upgrades/schema17_upgrade.sql
Normal file
7
rslib/src/storage/upgrades/schema17_upgrade.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
drop table tags;
|
||||||
|
create table tags (
|
||||||
|
id integer primary key not null,
|
||||||
|
name text not null collate unicase,
|
||||||
|
usn integer not null,
|
||||||
|
config blob not null
|
||||||
|
);
|
Loading…
Reference in a new issue