Skip to content

Commit

Permalink
Fix minor error in database schema preventing creation of new instances
Browse files Browse the repository at this point in the history
  • Loading branch information
rukmal committed Nov 30, 2022
1 parent c63a46b commit b15a115
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion db/schema/7-evaluation.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
USE avinya_db;

-- Evaluation
CREATE TABLE IF NOT EXISTS evaluation (
Expand Down Expand Up @@ -71,4 +72,4 @@ CREATE TABLE IF NOT EXISTS work_experience_evaluation (
FOREIGN KEY (work_experience_id) REFERENCES work_experience(id),
FOREIGN KEY (evaluation_id) REFERENCES evaluation(id),
CONSTRAINT pk_education_experience_evaluation PRIMARY KEY (work_experience_id, evaluation_id)
);
);
12 changes: 8 additions & 4 deletions db/schema/8-asset.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
USE avinya_db;

-- Assets
CREATE TABLE IF NOT EXISTS asset (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand All @@ -22,7 +24,7 @@ CREATE TABLE IF NOT EXISTS asset_property (
value VARCHAR(256) DEFAULT NULL,
FOREIGN KEY (asset_id) REFERENCES asset(id)
);

-- Asset Allocation
CREATE TABLE IF NOT EXISTS asset_allocation (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down Expand Up @@ -55,6 +57,7 @@ CREATE TABLE IF NOT EXISTS product (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(256) NOT NULL,
description TEXT DEFAULT NULL,
avinya_type_id INT NOT NULL,
manufacturer VARCHAR(256) DEFAULT NULL,
model VARCHAR(256) DEFAULT NULL,
serial_number VARCHAR(256) DEFAULT NULL,
Expand All @@ -77,7 +80,7 @@ CREATE TABLE IF NOT EXISTS product_supplier (
product_id INT NOT NULL,
supplier_id INT DEFAULT NULL,
person_id INT DEFAULT NULL,
order_date DATE NOT NULL DEFAULT CURRENT_DATE,
order_date DATE NOT NULL DEFAULT (CURRENT_DATE),
delivery_date DATE DEFAULT NULL,
order_id VARCHAR(256) DEFAULT NULL,
order_amount INT DEFAULT 0,
Expand Down Expand Up @@ -125,6 +128,7 @@ CREATE TABLE IF NOT EXISTS service (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(256) NOT NULL,
description TEXT DEFAULT NULL,
avinya_type_id INT NOT NULL,
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (avinya_type_id) REFERENCES avinya_type(id)
Expand All @@ -144,7 +148,7 @@ CREATE TABLE IF NOT EXISTS service_supplier (
service_id INT NOT NULL,
supplier_id INT DEFAULT NULL,
person_id INT DEFAULT NULL,
order_date DATE NOT NULL DEFAULT CURRENT_DATE,
order_date DATE NOT NULL DEFAULT (CURRENT_DATE),
delivery_date DATE DEFAULT NULL,
order_id VARCHAR(256) DEFAULT NULL,
order_amount INT DEFAULT 0,
Expand Down Expand Up @@ -185,4 +189,4 @@ CREATE TABLE IF NOT EXISTS service_inventory (
FOREIGN KEY (service_id) REFERENCES service(id),
FOREIGN KEY (organization_id) REFERENCES organization(id),
FOREIGN KEY (person_id) REFERENCES person(id)
);
);

0 comments on commit b15a115

Please sign in to comment.