Skip to content

Commit

Permalink
one statement per migration for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Feb 14, 2024
1 parent a4a02cc commit 4e632a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
16 changes: 1 addition & 15 deletions tools/walletextension/storage/database/sqlite/001_init.sql
Original file line number Diff line number Diff line change
@@ -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
);
PRAGMA foreign_keys = ON;
5 changes: 5 additions & 0 deletions tools/walletextension/storage/database/sqlite/002_users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Create users table
CREATE TABLE IF NOT EXISTS users (
user_id binary(20) PRIMARY KEY,
private_key binary(32)
);
Original file line number Diff line number Diff line change
@@ -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
);

0 comments on commit 4e632a9

Please sign in to comment.