dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

88.sql (1080B)


      1 -- +migrate Up
      2 CREATE TABLE IF NOT EXISTS products(
      3     id INTEGER NOT NULL PRIMARY KEY,
      4     name VARCHAR(255) UNIQUE NOT NULL,
      5     description TEXT NOT NULL,
      6     price INTEGER NOT NULL,
      7     created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP);
      8 
      9 CREATE TABLE IF NOT EXISTS xmr_invoices(
     10     id INTEGER NOT NULL PRIMARY KEY,
     11     user_id INTEGER NOT NULL,
     12     product_id INTEGER NOT NULL,
     13     address VARCHAR(255) NOT NULL,
     14     amount_requested INTEGER NOT NULL,
     15     amount_received INTEGER NULL,
     16     confirmations INTEGER NOT NULL,
     17     created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
     18     CONSTRAINT xmr_invoices_user_id_fk
     19         FOREIGN KEY (user_id)
     20             REFERENCES users (id)
     21             ON DELETE CASCADE
     22             ON UPDATE CASCADE,
     23     CONSTRAINT xmr_invoices_product_id_fk
     24         FOREIGN KEY (product_id)
     25             REFERENCES products (id)
     26             ON DELETE CASCADE
     27             ON UPDATE CASCADE);
     28 CREATE INDEX xmr_invoices_user_id_idx ON xmr_invoices (user_id);
     29 CREATE INDEX xmr_invoices_address_idx ON xmr_invoices (address);
     30 
     31 -- +migrate Down