Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DBMS inventory manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shrey Patel
DBMS inventory manager
Commits
33c8211e
Commit
33c8211e
authored
1 year ago
by
Sarthak Shrivastava
Browse files
Options
Downloads
Patches
Plain Diff
changed schemas to support user and org deletion.
parent
debbccd6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
phase 1.sql
+6
-6
6 additions, 6 deletions
phase 1.sql
with
6 additions
and
6 deletions
phase 1.sql
+
6
−
6
View file @
33c8211e
...
...
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS ORGANIZATION_ROSTER (
type
ENUM
(
'MEMBER'
,
'MANAGER'
,
'OWNER'
)
NOT
NULL
,
PRIMARY
KEY
(
roster_id
),
CONSTRAINT
fk_user_manager
FOREIGN
KEY
(
user_email
)
REFERENCES
USER
(
email
),
CONSTRAINT
fk_organization_manager
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
CONSTRAINT
fk_organization_manager
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
);
INSERT
INTO
ORGANIZATION_ROSTER
(
user_email
,
organization_id
,
type
)
...
...
@@ -90,8 +90,8 @@ CREATE TABLE IF NOT EXISTS REQUEST (
description
VARCHAR
(
256
),
type
ENUM
(
'JOIN'
,
'ITEM'
)
NOT
NULL
,
PRIMARY
KEY
(
request_id
),
CONSTRAINT
fk_user_request
FOREIGN
KEY
(
user_email
)
REFERENCES
USER
(
email
),
CONSTRAINT
fk_organization_request
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
CONSTRAINT
fk_user_request
FOREIGN
KEY
(
user_email
)
REFERENCES
USER
(
email
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_organization_request
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
ON
DELETE
CASCADE
);
CREATE
TABLE
IF
NOT
EXISTS
LOCATION
(
...
...
@@ -99,7 +99,7 @@ CREATE TABLE IF NOT EXISTS LOCATION (
location
VARCHAR
(
256
),
organization_id
INT
NOT
NULL
,
PRIMARY
KEY
(
location_id
),
CONSTRAINT
fk_organization_location
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
CONSTRAINT
fk_organization_location
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
ON
DELETE
CASCADE
);
CREATE
TABLE
IF
NOT
EXISTS
ITEM
(
...
...
@@ -114,7 +114,7 @@ CREATE TABLE IF NOT EXISTS ITEM (
organization_id
INT
NOT
NULL
,
PRIMARY
KEY
(
item_id
),
CONSTRAINT
fk_location_item
FOREIGN
KEY
(
location_id
)
REFERENCES
LOCATION
(
location_id
),
CONSTRAINT
fk_organiztion_item
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
CONSTRAINT
fk_organiztion_item
FOREIGN
KEY
(
organization_id
)
REFERENCES
ORGANIZATION
(
organization_id
)
ON
DELETE
CASCADE
);
CREATE
TABLE
IF
NOT
EXISTS
LISTING
(
...
...
@@ -124,7 +124,7 @@ CREATE TABLE IF NOT EXISTS LISTING (
status
ENUM
(
'AVAILABLE'
,
'SOLD'
)
NOT
NULL
,
date_listed
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
NOT
NULL
,
PRIMARY
KEY
(
listing_id
),
CONSTRAINT
fk_item_listing
FOREIGN
KEY
(
item_id
)
REFERENCES
ITEM
(
item_id
)
CONSTRAINT
fk_item_listing
FOREIGN
KEY
(
item_id
)
REFERENCES
ITEM
(
item_id
)
ON
DELETE
CASCADE
);
CREATE
TABLE
IF
NOT
EXISTS
FAVORITE
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment