FinanceFerret/v3: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
No edit summary
 
Line 33: Line 33:
     `ID` int(11) NOT NULL AUTO_INCREMENT,
     `ID` int(11) NOT NULL AUTO_INCREMENT,
     `ID_Account` int(11) NOT NULL,
     `ID_Account` int(11) NOT NULL,
     `ID_Tuple` int(11) DEFAULT NULL,
     `ID_Tuple`   int(11) DEFAULT NULL,
     `RmtAbbr` varchar(64) DEFAULT NULL,
     `RmtAbbr`   varchar(64) DEFAULT NULL,
     `Amount` decimal(6, 2) DEFAULT NULL,
     `Amount`     decimal(9,2) DEFAULT NULL,
     `When` timestamp NULL DEFAULT NULL,
    `Balance`    decimal(9,2),
     `Seq` decimal(6, 2) DEFAULT NULL,
     `When`       timestamp NULL DEFAULT NULL,
     `Tags` varchar(255) DEFAULT NULL,
     `Seq`       decimal(6,2) DEFAULT NULL,
     `What` varchar(127) DEFAULT NULL,
     `Tags`       varchar(255) DEFAULT NULL,
     `RmtConf` varchar(100) DEFAULT NULL,
     `What`       varchar(127) DEFAULT NULL,
     `RmtConf`   varchar(100) DEFAULT NULL,
     PRIMARY KEY (`ID`)
     PRIMARY KEY (`ID`)
   ) ENGINE = InnoDB
   ) ENGINE = InnoDB
Line 48: Line 49:
CREATE TABLE
CREATE TABLE
   `TrxStated` (
   `TrxStated` (
     `ID` int(11) NOT NULL AUTO_INCREMENT,
     `ID`         int(11) NOT NULL AUTO_INCREMENT,
     `ID_Account` int(11) NOT NULL,
     `ID_Account` int(11) NOT NULL,
     `ID_Tuple` int(11) DEFAULT NULL,
     `ID_Tuple`   int(11) DEFAULT NULL,
     `Amount` decimal(6, 2) DEFAULT NULL,
     `Amount`     decimal(9,2) DEFAULT NULL,
     `When` timestamp NULL DEFAULT NULL,
    `Balance`    decimal(9,2),
     `What` varchar(127) DEFAULT NULL,
     `When`       timestamp NULL DEFAULT NULL,
     `What`       varchar(127) DEFAULT NULL,
     PRIMARY KEY (`ID`)
     PRIMARY KEY (`ID`)
   ) ENGINE = InnoDB
   ) ENGINE = InnoDB
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 13:59, 30 July 2024

SQL

Accounts

CREATE TABLE
  `Account` (
    `ID`          int(11) NOT NULL AUTO_INCREMENT,
    `ID_Parent`   int(11) DEFAULT NULL,
    `ID_Owner`    int(11) DEFAULT NULL,
    `Name`        varchar(127) DEFAULT NULL,
    `isTxactable` tinyint(1) DEFAULT NULL,
    `Abbr`        varchar(63) DEFAULT NULL,
    PRIMARY KEY (`ID`)
  ) ENGINE = InnoDB

Owners

CREATE TABLE
  `Owner` (
    `ID` int(11) NOT NULL AUTO_INCREMENT,
    `ID_Parent` int(11) DEFAULT NULL,
    `Name` varchar(127) NOT NULL,
    `Abbr` varchar(15) DEFAULT NULL,
    PRIMARY KEY (`ID`)
  ) ENGINE = InnoDB

Transactions

Transactions are recorded in (so far) two parallel tables. "Actual" refers to the transactions as the user becomes aware of them, and "Stated" refers to the transactions as the other entity (most commonly a bank, but could be any business or individual) has recorded them. The dates and descriptions may differ. Amounts may be split differently, but the totals for any given Tuple should be the same.

Actual

(formerly "Trxact")

CREATE TABLE
  `TrxActual` (
    `ID` int(11) NOT NULL AUTO_INCREMENT,
    `ID_Account` int(11) NOT NULL,
    `ID_Tuple`   int(11) DEFAULT NULL,
    `RmtAbbr`    varchar(64) DEFAULT NULL,
    `Amount`     decimal(9,2) DEFAULT NULL,
    `Balance`    decimal(9,2),
    `When`       timestamp NULL DEFAULT NULL,
    `Seq`        decimal(6,2) DEFAULT NULL,
    `Tags`       varchar(255) DEFAULT NULL,
    `What`       varchar(127) DEFAULT NULL,
    `RmtConf`    varchar(100) DEFAULT NULL,
    PRIMARY KEY (`ID`)
  ) ENGINE = InnoDB

Stated

CREATE TABLE
  `TrxStated` (
    `ID`         int(11) NOT NULL AUTO_INCREMENT,
    `ID_Account` int(11) NOT NULL,
    `ID_Tuple`   int(11) DEFAULT NULL,
    `Amount`     decimal(9,2) DEFAULT NULL,
    `Balance`    decimal(9,2),
    `When`       timestamp NULL DEFAULT NULL,
    `What`       varchar(127) DEFAULT NULL,
    PRIMARY KEY (`ID`)
  ) ENGINE = InnoDB