From 4e632a91ff58fa2a5ce78c4952aa0a3f8b43debc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Wed, 14 Feb 2024 09:08:36 +0100 Subject: [PATCH] one statement per migration for sqlite --- .../storage/database/sqlite/001_init.sql | 16 +--------------- .../storage/database/sqlite/002_users.sql | 5 +++++ .../storage/database/sqlite/003_accounts.sql | 7 +++++++ 3 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 tools/walletextension/storage/database/sqlite/002_users.sql create mode 100644 tools/walletextension/storage/database/sqlite/003_accounts.sql diff --git a/tools/walletextension/storage/database/sqlite/001_init.sql b/tools/walletextension/storage/database/sqlite/001_init.sql index eb2bcbcbc9..a0456ea7f5 100644 --- a/tools/walletextension/storage/database/sqlite/001_init.sql +++ b/tools/walletextension/storage/database/sqlite/001_init.sql @@ -1,16 +1,2 @@ -- Enable foreign keys in SQLite -PRAGMA foreign_keys = ON; - --- Create users table -CREATE TABLE IF NOT EXISTS users ( - user_id binary(20) PRIMARY KEY, - private_key binary(32) - ); - --- Create accounts table -CREATE TABLE IF NOT EXISTS accounts ( - user_id binary(20), - account_address binary(20), - signature binary(65), - FOREIGN KEY(user_id) REFERENCES users(user_id) ON DELETE CASCADE - ); \ No newline at end of file +PRAGMA foreign_keys = ON; \ No newline at end of file diff --git a/tools/walletextension/storage/database/sqlite/002_users.sql b/tools/walletextension/storage/database/sqlite/002_users.sql new file mode 100644 index 0000000000..7155d722f0 --- /dev/null +++ b/tools/walletextension/storage/database/sqlite/002_users.sql @@ -0,0 +1,5 @@ +-- Create users table +CREATE TABLE IF NOT EXISTS users ( + user_id binary(20) PRIMARY KEY, + private_key binary(32) +); \ No newline at end of file diff --git a/tools/walletextension/storage/database/sqlite/003_accounts.sql b/tools/walletextension/storage/database/sqlite/003_accounts.sql new file mode 100644 index 0000000000..6099ad5017 --- /dev/null +++ b/tools/walletextension/storage/database/sqlite/003_accounts.sql @@ -0,0 +1,7 @@ +-- Create accounts table +CREATE TABLE IF NOT EXISTS accounts ( + user_id binary(20), + account_address binary(20), + signature binary(65), + FOREIGN KEY(user_id) REFERENCES users(user_id) ON DELETE CASCADE +); \ No newline at end of file