From 97b4c2124c7ed3d78a84137509d6fccec683584d Mon Sep 17 00:00:00 2001 From: abdo Date: Sat, 9 Jan 2021 17:38:16 +0300 Subject: [PATCH] sql formatting --- rslib/src/storage/tag/add.sql | 7 +++--- rslib/src/storage/tag/alloc_id.sql | 23 ++++++++----------- .../src/storage/upgrades/schema17_upgrade.sql | 12 +++++----- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/rslib/src/storage/tag/add.sql b/rslib/src/storage/tag/add.sql index 16ee33d85..57db3bb0d 100644 --- a/rslib/src/storage/tag/add.sql +++ b/rslib/src/storage/tag/add.sql @@ -1,4 +1,3 @@ -insert - or replace into tags (id, name, usn, config) -values - (?, ?, ?, ?) +INSERT + OR REPLACE INTO tags (id, name, usn, config) +VALUES (?, ?, ?, ?) \ No newline at end of file diff --git a/rslib/src/storage/tag/alloc_id.sql b/rslib/src/storage/tag/alloc_id.sql index 989c43749..9a5c80562 100644 --- a/rslib/src/storage/tag/alloc_id.sql +++ b/rslib/src/storage/tag/alloc_id.sql @@ -1,13 +1,10 @@ -select - case - when ?1 in ( - select - id - from tags - ) then ( - select - max(id) + 1 - from tags - ) - else ?1 - end; \ No newline at end of file +SELECT CASE + WHEN ?1 IN ( + SELECT id + FROM tags + ) THEN ( + SELECT max(id) + 1 + FROM tags + ) + ELSE ?1 + END; \ No newline at end of file diff --git a/rslib/src/storage/upgrades/schema17_upgrade.sql b/rslib/src/storage/upgrades/schema17_upgrade.sql index a324181f9..288a14a07 100644 --- a/rslib/src/storage/upgrades/schema17_upgrade.sql +++ b/rslib/src/storage/upgrades/schema17_upgrade.sql @@ -1,7 +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 +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 ); \ No newline at end of file