Changes between Version 1 and Version 2 of ddlScriptVer1.sql


Ignore:
Timestamp:
12/02/24 03:00:39 (3 days ago)
Author:
211101
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ddlScriptVer1.sql

    v1 v2  
    11
    22{{{#!sql
     3-- Delete tables if they exist
     4DROP TABLE IF EXISTS TRANSACTION_BREAKDOWN CASCADE;
     5DROP TABLE IF EXISTS TRANSACTION CASCADE;
     6DROP TABLE IF EXISTS TRANSACTION_ACCOUNT CASCADE;
     7DROP TABLE IF EXISTS TAG CASCADE;
     8DROP TABLE IF EXISTS USER CASCADE;
     9
    310-- Create USER table
    411CREATE TABLE USER (
     
    2330    amount DECIMAL(10, 2) NOT NULL,
    2431    net_amount DECIMAL(10, 2),
    25     day_id INT REFERENCES DAY(day_id),
     32    date TIMESTAMPZ,
    2633    tag_id INT REFERENCES TAG(tag_id)
    2734);
     
    3643);
    3744
    38 -- Create YEAR table
    39 CREATE TABLE YEAR (
    40     year_id SERIAL PRIMARY KEY,
    41     year_name INT NOT NULL
    42 );
    43 
    44 -- Create MONTH table
    45 CREATE TABLE MONTH (
    46     month_id SERIAL PRIMARY KEY,
    47     year_id INT REFERENCES YEAR(year_id),
    48     month_name VARCHAR(20) NOT NULL
    49 );
    50 
    51 -- Create DAY table
    52 CREATE TABLE DAY (
    53     day_id SERIAL PRIMARY KEY,
    54     month_id INT REFERENCES MONTH(month_id),
    55     day_number INT,
    56     day_name VARCHAR(20)
    57 );
    58 
    5945-- Create TAG table
    6046CREATE TABLE TAG (
     
    6248    tag_name VARCHAR(50) NOT NULL
    6349);
    64 
    65 -- Delete tables if they exist
    66 DROP TABLE IF EXISTS TRANSACTION_BREAKDOWN CASCADE;
    67 DROP TABLE IF EXISTS TRANSACTION CASCADE;
    68 DROP TABLE IF EXISTS TRANSACTION_ACCOUNT CASCADE;
    69 DROP TABLE IF EXISTS DAY CASCADE;
    70 DROP TABLE IF EXISTS MONTH CASCADE;
    71 DROP TABLE IF EXISTS YEAR CASCADE;
    72 DROP TABLE IF EXISTS TAG CASCADE;
    73 DROP TABLE IF EXISTS USER CASCADE;
    7450}}}