Permalink
Browse files

Comment out referential integrity in holdings symbol (weird issue); f…

…ormatting changes
  • Loading branch information...
1 parent fba1aa7 commit f913b0d96e03993e330cac61011a1adc3086bda9 @ajablonski committed Nov 15, 2012
Showing with 15 additions and 7 deletions.
  1. +10 −6 create_tables.sql
  2. +4 −0 drop_tables.sql
  3. +1 −1 home.pl
View
@@ -12,11 +12,10 @@ CREATE TABLE portfolios (
UNIQUE (owner, name),
CONSTRAINT no_negative_cash_balance CHECK (cashAccount >= 0)
);
-
-- individual stock holdings for a specific portfolio
CREATE TABLE holdings (
portfolioID int REFERENCES portfolios(id) ON DELETE CASCADE,
- stock char(16) NOT NULL REFERENCES cs339.stockssymbols(symbol),
+ stock char(16) NOT NULL, --REFERENCES cs339.stockssymbols(symbol),
numShares int NOT NULL CHECK (numShares > 0),
UNIQUE(portfolioID, stock)
);
@@ -28,10 +27,15 @@ CREATE OR REPLACE TRIGGER initializePortfolio
FOR EACH ROW
BEGIN
:new.id := portfolioID.NEXTVAL;
- IF :old.cashAccount IS NULL THEN
- :new.cashAccount := 0;
- END IF;
END;
/
-
+CREATE TABLE newstocksdaily (
+ symbol CHAR(16) NOT NULL,
+ timestamp number NOT NULL,
+ open number NOT NULL,
+ high number NOT NULL,
+ low number NOT NULL,
+ close number NOT NULL,
+ volume number NOT NULL
+);
View
@@ -3,3 +3,7 @@ DROP TABLE holdings;
DROP TABLE portfolios;
DROP TABLE users;
+
+DROP TABLE newstocksdaily;
+
+DROP SEQUENCE portfolioID;
View
@@ -34,7 +34,7 @@
} elsif ($action eq 'newPort') {
my $name = param('name');
eval {
- ExecSQL($dbuser, $dbpasswd, "INSERT INTO $netID.portfolios (name, owner) VALUES (?, ?) ", undef, $name, $currentUser);
+ ExecSQL($dbuser, $dbpasswd, "INSERT INTO $netID.portfolios (name, owner, cashAccount) VALUES (?, ?, 0) ", undef, $name, $currentUser);
};
$error = $@;

0 comments on commit f913b0d

Please sign in to comment.