public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Alviro Iskandar Setiawan <[email protected]>
Cc: GNU/Weeb Mailing List <[email protected]>
Subject: Re: [RFC PATCH v1 1/1] db: Create starting DDL for saving transaction
Date: Tue, 28 Jun 2022 14:27:18 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Hi Al,

On 6/28/22 1:21 PM, Alviro Iskandar Setiawan wrote:
> +CREATE TABLE `transactions` (
> +  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
> +  `trx_id` binary(20) NOT NULL,
> +  `parent_trx_id` binary(20) NOT NULL,

My worry on this is: you reference a parent transaction ID with the
sha1 hash, there is no backup if that gets changed. What about using
the sequence ID to reference it?

> +  `committer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
> +  `amount` bigint unsigned NOT NULL,
> +  `notes` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
> +  `created_at` datetime NOT NULL,
> +  PRIMARY KEY (`id`),
> +  KEY `committer` (`committer`),
> +  KEY `amount` (`amount`),
> +  KEY `created_at` (`created_at`),
> +  KEY `trx_id` (`trx_id`),
> +  KEY `parent_trx_id` (`parent_trx_id`),

As per my comment above, this can be a foreign key to the same
table, to the PK id. Yes? No? Comment?

-- 
Ammar Faizi

  reply	other threads:[~2022-06-28  7:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28  6:21 [RFC PATCH v1 0/1] GNU/Weeb Financial Transaction Record Design Alviro Iskandar Setiawan
2022-06-28  6:21 ` [RFC PATCH v1 1/1] db: Create starting DDL for saving transaction Alviro Iskandar Setiawan
2022-06-28  7:27   ` Ammar Faizi [this message]
2022-06-28  7:31     ` Alviro Iskandar Setiawan
2022-06-28  7:47       ` Ammar Faizi
2022-06-28  7:49         ` Ammar Faizi
2022-06-28  8:03         ` Alviro Iskandar Setiawan
2022-06-28  8:07           ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox