summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-07-16 16:50:06 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-17 14:02:22 +0200
commit2d8ebfd2e90411155df1bd834c44ba6c48206f94 (patch)
treef7a79340d9c58c4bdec973fab9f01c29a716c6a2
parenta79d89ad7a6d51ba36a79a74f969c5076862e338 (diff)
downloadserial-barcode-scanner-2d8ebfd2e90411155df1bd834c44ba6c48206f94.tar.bz2
README: replace sqlite3 usage with DBus calls to database service
-rw-r--r--README.md22
1 files changed, 15 insertions, 7 deletions
diff --git a/README.md b/README.md
index fa67d0b..b50f40b 100644
--- a/README.md
+++ b/README.md
@@ -70,14 +70,22 @@ but you need to modify a few things.
=== Database ===
- * Create user
- `sqlite3 shop.db "INSERT INTO users (id, email, firstname, lastname) VALUES (1, 'test@tester', 'Firstname', 'Lastname');"`
- * Setup user password
- `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database SetUserPassword id 1 "password"`
- `sqlite3 shop.db "UPDATE authentication set superuser = 1, auth_users = 1, auth_products = 1, auth_cashbox = 1 where user = 1";`
+ * Create initial account with super user permissions
+ `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database UserReplace "(issssssssxbbsas)" "<userid>" "<firstname>" "<lastname>" "<email>" "<gender>" "<street>" "<postcode>" "<city>" "" 0 0 0 "" 0`
+ `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database SetUserPassword "is" "<userid>" "<password>"`
+ `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database SetUserAuth "(ibbbb)" "<userid>" 1 1 1 1`
* Demo Data
- `sqlite3 shop.db "INSERT INTO categories (name) VALUES ('Getränke')";`
- `sqlite3 shop.db "INSERT INTO supplier (name,city,postal_code,street,phone,website) VALUES ('Demo Lieferant','Musterstadt','12345','Musterstraße 5','+49 1234 56789','https://www.ktt.de');"`
+ `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database AddCategory "s" "Getränke"`
+ `busctl --system call io.mainframe.shopsystem.Database /io/mainframe/shopsystem/database io.mainframe.shopsystem.Database AddSupplier "ssssss" "Demo Lieferant" "12345" "Musterstadt" "Musterstr. 5" "+49 1234 56789" "https://www.example.org"`
+
+It's also possible to directly access the database. While there are
+some triggers to keep the database in a sensible state, please be
+careful with direct database transactions. For accessing the database
+in write mode, you need to kill the shopsystem database process first.
+It will be restarted by any process, that needs the database DBus API.
+
+ * `pkill -15 shop-database`
+ * `sqlite3 /path/to/shopsystem.db`
=== Display on / off via MQTT ===