added display name and password for authentication, changed uuids to binary, changed database collation

This commit is contained in:
celso 2026-04-04 13:08:56 -03:00
parent c545a1032b
commit 0f81113d65
2 changed files with 17 additions and 13 deletions

View File

@ -1,4 +1,5 @@
CREATE DATABASE IF NOT EXISTS argent_registry; CREATE DATABASE IF NOT EXISTS argent_registry
CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
USE argent_registry; USE argent_registry;
CREATE TABLE shards ( CREATE TABLE shards (
@ -6,12 +7,14 @@ CREATE TABLE shards (
name VARCHAR(50) NOT NULL, name VARCHAR(50) NOT NULL,
db_name VARCHAR(50) NOT NULL, db_name VARCHAR(50) NOT NULL,
host_address VARCHAR(255) NOT NULL, host_address VARCHAR(255) NOT NULL,
port INT NOT NULL DEFAULT 53096, port INT NOT NULL DEFAULT 53096
); );
CREATE TABLE user_shard_map ( CREATE TABLE user_shard_map (
user_id CHAR(36) PRIMARY KEY, user_id BINARY(16) PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL, username VARCHAR(50) UNIQUE NOT NULL,
name VARCHAR(50) NOT NULL,
password_hash VARCHAR(255) NOT NULL,
shard_id INT NOT NULL, shard_id INT NOT NULL,
is_active TINYINT(1) NOT NULL DEFAULT 1, is_active TINYINT(1) NOT NULL DEFAULT 1,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
@ -24,9 +27,9 @@ CREATE TABLE cost_group_statuses (
); );
CREATE TABLE cost_groups ( CREATE TABLE cost_groups (
group_id CHAR(36) PRIMARY KEY, group_id BINARY(16) PRIMARY KEY,
name VARCHAR(100) NOT NULL, name VARCHAR(100) NOT NULL,
created_by CHAR(36), created_by BINARY(16),
status_id TINYINT NOT NULL DEFAULT '1', status_id TINYINT NOT NULL DEFAULT '1',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (created_by) REFERENCES user_shard_map(user_id), FOREIGN KEY (created_by) REFERENCES user_shard_map(user_id),
@ -39,8 +42,8 @@ CREATE TABLE group_roles (
); );
CREATE TABLE group_members ( CREATE TABLE group_members (
group_id CHAR(36), group_id BINARY(16),
user_id CHAR(36), user_id BINARY(16),
role_id TINYINT DEFAULT '3', role_id TINYINT DEFAULT '3',
joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (group_id, user_id), PRIMARY KEY (group_id, user_id),

View File

@ -1,4 +1,5 @@
CREATE DATABASE IF NOT EXISTS argent_shard_01; CREATE DATABASE IF NOT EXISTS argent_shard_01
CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
USE argent_shard_01; USE argent_shard_01;
CREATE TABLE ledger_statuses ( CREATE TABLE ledger_statuses (
@ -7,10 +8,10 @@ CREATE TABLE ledger_statuses (
); );
CREATE TABLE ledger ( CREATE TABLE ledger (
entry_id CHAR(36) NOT NULL, entry_id BINARY(16) NOT NULL,
batch_id CHAR(36) NOT NULL, batch_id BINARY(16) NOT NULL,
user_id CHAR(36) NOT NULL, user_id BINARY(16) NOT NULL,
group_id CHAR(36) DEFAULT NULL, group_id BINARY(16) DEFAULT NULL,
category_id INT, category_id INT,
amount DECIMAL(15, 2) NOT NULL, amount DECIMAL(15, 2) NOT NULL,
currency_code CHAR(3) NOT NULL, currency_code CHAR(3) NOT NULL,
@ -27,7 +28,7 @@ CREATE TABLE ledger (
); );
CREATE TABLE user_balances ( CREATE TABLE user_balances (
user_id CHAR(36) NOT NULL, user_id BINARY(16) NOT NULL,
currency_code CHAR(3) NOT NULL, currency_code CHAR(3) NOT NULL,
total_confirmed DECIMAL(15, 2) DEFAULT 0.00, total_confirmed DECIMAL(15, 2) DEFAULT 0.00,
total_pending DECIMAL(15, 2) DEFAULT 0.00, total_pending DECIMAL(15, 2) DEFAULT 0.00,