Changes between Version 1 and Version 2 of ddlScriptVer1.sql
- Timestamp:
- 12/02/24 03:00:39 (3 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ddlScriptVer1.sql
v1 v2 1 1 2 2 {{{#!sql 3 -- Delete tables if they exist 4 DROP TABLE IF EXISTS TRANSACTION_BREAKDOWN CASCADE; 5 DROP TABLE IF EXISTS TRANSACTION CASCADE; 6 DROP TABLE IF EXISTS TRANSACTION_ACCOUNT CASCADE; 7 DROP TABLE IF EXISTS TAG CASCADE; 8 DROP TABLE IF EXISTS USER CASCADE; 9 3 10 -- Create USER table 4 11 CREATE TABLE USER ( … … 23 30 amount DECIMAL(10, 2) NOT NULL, 24 31 net_amount DECIMAL(10, 2), 25 da y_id INT REFERENCES DAY(day_id),32 date TIMESTAMPZ, 26 33 tag_id INT REFERENCES TAG(tag_id) 27 34 ); … … 36 43 ); 37 44 38 -- Create YEAR table39 CREATE TABLE YEAR (40 year_id SERIAL PRIMARY KEY,41 year_name INT NOT NULL42 );43 44 -- Create MONTH table45 CREATE TABLE MONTH (46 month_id SERIAL PRIMARY KEY,47 year_id INT REFERENCES YEAR(year_id),48 month_name VARCHAR(20) NOT NULL49 );50 51 -- Create DAY table52 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 59 45 -- Create TAG table 60 46 CREATE TABLE TAG ( … … 62 48 tag_name VARCHAR(50) NOT NULL 63 49 ); 64 65 -- Delete tables if they exist66 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;74 50 }}}