[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#32121] [PATCH 3/5] database: Add support for database upgrades.
From: |
Clément Lassieur |
Subject: |
[bug#32121] [PATCH 3/5] database: Add support for database upgrades. |
Date: |
Sat, 14 Jul 2018 17:32:15 +0200 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Clément Lassieur <address@hidden> writes:
> +(define (db-get-version db)
> + (if (pair? (sqlite-exec db "SELECT name FROM sqlite_master WHERE \
> +type='table' AND name='SchemaVersion';"))
> + (vector-ref
> + (car (sqlite-exec db "SELECT MAX(version) FROM SchemaVersion;")) 0)
> + 0))
> +
> +(define (db-set-version db version)
> + (sqlite-exec db "INSERT INTO SchemaVersion (version) VALUES (" version
> + ");"))
Actually, there is:
--8<---------------cut here---------------start------------->8---
PRAGMA schema.user_version;
PRAGMA schema.user_version = integer ;
The user_version pragma will to get or set the value of the user-version
integer at offset 60 in the database header. The user-version is an
integer that is available to applications to use however they
want. SQLite makes no use of the user-version itself.
--8<---------------cut here---------------end--------------->8---
Better use them than creating an ad-hoc table I guess, WDYT?
[bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/10
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Ludovic Courtès, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Ludovic Courtès, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/14
[bug#32121] [PATCH 5/5] Add support for multiple inputs., Clément Lassieur, 2018/07/10