1
0
forked from BRT/arc
arc/migrations.sql
trnsmkot 4f5229da0a Add description field to accounts table and related logic
Added a new `description` column to the `accounts` table in the database schema. Updated the model, DAO methods, and queries to handle the `description` field for both inserting and retrieving account data. This change ensures that account entries can now include descriptive information.
2025-04-22 10:18:42 +07:00

38 lines
1.0 KiB
SQL

CREATE TABLE IF NOT EXISTS devices
(
id TEXT PRIMARY KEY,
status TEXT,
name TEXT,
android TEXT,
screen_width INTEGER,
screen_height INTEGER,
battery INTEGER,
update_time DATETIME,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
image BLOB
);
CREATE TABLE IF NOT EXISTS accounts
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
device_id TEXT,
app_name TEXT,
card_name TEXT,
description TEXT,
amount REAL,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP,
status TEXT,
FOREIGN KEY (device_id) REFERENCES devices (id) ON DELETE CASCADE,
UNIQUE (device_id, app_name, card_name)
);
CREATE TABLE IF NOT EXISTS transactions
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
account_id INTEGER,
amount REAL,
description TEXT,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (account_id) REFERENCES accounts (id) ON DELETE CASCADE,
UNIQUE (amount, timestamp)
);