Files
intrasys/migrations/20250704000000_init.sql
Walter Oggioni 1217e92301
All checks were successful
CI / build (push) Successful in 3m5s
initial commit
2025-07-04 20:12:28 +08:00

17 lines
593 B
SQL

-- Create accounts table
CREATE TABLE accounts (
account_id BIGINT PRIMARY KEY,
balance DECIMAL(20, 2) NOT NULL
);
-- Create transactions table for audit purposes
CREATE TABLE transactions (
transaction_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
source_account_id BIGINT NOT NULL,
destination_account_id BIGINT NOT NULL,
amount DECIMAL(20, 2) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
FOREIGN KEY (source_account_id) REFERENCES accounts (account_id),
FOREIGN KEY (destination_account_id) REFERENCES accounts (account_id)
);