From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by gnuweeb.org (Postfix) with ESMTPSA id D5C677FA04 for ; Tue, 28 Jun 2022 07:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1656401530; bh=0gWfWjxR/KAEOyenqFEPWI7buxaZGjvW2ErUR4lluXg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c6YMxTngbpj/deIz5mSwuOCV969EBove+1bMLoopEZsfjw43jMJxESEroSnikdLvw iRwoB8+Rb/s0tJUd409AVYJQJFkxCBPLnSloAtqHvvyXAN4ClJBXFYwZefmEj5JUwU mulEBs3lev/iee+CDjqO1YDYQKlwptxvBcB4ieg4oR4GTnrW1gMfj+JIAszUZkMttl vZec1AnnfnllHL2CuPC98zriFCLBr5naV25FBk+qlP2JPmDd0CXoU2Kz78yzs4e40L mSRU/4FOiD+elpuOT5cpDFeEMR+C0gJolIdTU66qZosJtBN3azxIhblpOB7ZnMjFQ+ YFYPSIaNUGB0w== Received: by mail-lf1-f48.google.com with SMTP id a2so20752138lfg.5 for ; Tue, 28 Jun 2022 00:32:10 -0700 (PDT) X-Gm-Message-State: AJIora9he6kuWrm5NmqTX3cR9YpyBqgf9bywCXsH54b66DyX+/gp0hbK h/ih4j3NE7RuFXtjeT0eo4E0N/nUwodL43G26AI= X-Google-Smtp-Source: AGRyM1viO6QAU6uoubA2/IPf//ViNp3O+AdS5Mz3X+Aagho3nhTPvzHkXjzPF/N48dgM7QAV6extpX+emZmFYhj6TQE= X-Received: by 2002:a05:6512:31e:b0:47f:6193:2262 with SMTP id t30-20020a056512031e00b0047f61932262mr10395505lfp.502.1656401529022; Tue, 28 Jun 2022 00:32:09 -0700 (PDT) MIME-Version: 1.0 References: <20220628062139.262361-1-alviro.iskandar@gnuweeb.org> <20220628062139.262361-2-alviro.iskandar@gnuweeb.org> <197e0152-a743-840d-11bc-3dcf1a72acdb@gnuweeb.org> In-Reply-To: <197e0152-a743-840d-11bc-3dcf1a72acdb@gnuweeb.org> From: Alviro Iskandar Setiawan Date: Tue, 28 Jun 2022 14:31:57 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v1 1/1] db: Create starting DDL for saving transaction To: Ammar Faizi Cc: "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" List-Id: On Tue, Jun 28, 2022 at 2:27 PM Ammar Faizi wrote: > 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? That should never change, if it ever gets changed, something has gone very wrong. > > + `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? Sup. tq -- Viro