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
368f428e
Commit
368f428e
authored
1 year ago
by
Sarthak Shrivastava
Browse files
Options
Downloads
Patches
Plain Diff
changed category Greek Life to GreekLife to get the enum to work
parent
7b2724f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
phase 1.sql
+3
-3
3 additions, 3 deletions
phase 1.sql
src/main/java/com/example/accessingdatamysql/Organization.java
+13
-11
13 additions, 11 deletions
...ain/java/com/example/accessingdatamysql/Organization.java
with
16 additions
and
14 deletions
phase 1.sql
+
3
−
3
View file @
368f428e
...
@@ -18,14 +18,14 @@ INSERT INTO USER (email, lname, fname, password, phone_number) VALUES
...
@@ -18,14 +18,14 @@ INSERT INTO USER (email, lname, fname, password, phone_number) VALUES
SELECT
*
FROM
USER
;
SELECT
*
FROM
USER
;
-- DELETE FROM USER;
-- DELETE FROM USER;
DROP
TABLE
ORGANIZATION
;
CREATE
TABLE
IF
NOT
EXISTS
ORGANIZATION
(
CREATE
TABLE
IF
NOT
EXISTS
ORGANIZATION
(
organization_id
INT
AUTO_INCREMENT
,
organization_id
INT
AUTO_INCREMENT
,
name
VARCHAR
(
256
)
NOT
NULL
,
name
VARCHAR
(
256
)
NOT
NULL
,
email
VARCHAR
(
128
)
NOT
NULL
,
email
VARCHAR
(
128
)
NOT
NULL
,
description
VARCHAR
(
1024
),
description
VARCHAR
(
1024
),
owner_email
VARCHAR
(
128
)
NOT
NULL
,
owner_email
VARCHAR
(
128
)
NOT
NULL
,
category
ENUM
(
'ACADEMIC'
,
'RECREATION'
,
'TECHNOLOGY'
,
'POLITICS'
,
'GREEK
LIFE'
),
category
ENUM
(
'ACADEMIC'
,
'RECREATION'
,
'TECHNOLOGY'
,
'POLITICS'
,
'GREEKLIFE'
),
member_count
INT
DEFAULT
1
,
member_count
INT
DEFAULT
1
,
PRIMARY
KEY
(
organization_id
),
PRIMARY
KEY
(
organization_id
),
CONSTRAINT
fk_user_organization
FOREIGN
KEY
(
owner_email
)
REFERENCES
USER
(
email
)
CONSTRAINT
fk_user_organization
FOREIGN
KEY
(
owner_email
)
REFERENCES
USER
(
email
)
...
@@ -36,7 +36,7 @@ INSERT INTO ORGANIZATION (name, email, description, owner_email, category, membe
...
@@ -36,7 +36,7 @@ INSERT INTO ORGANIZATION (name, email, description, owner_email, category, membe
(
'Chess Society'
,
'chesssociety@example.com'
,
'Organization for chess lovers'
,
'alicedoe@example.com'
,
'RECREATION'
,
20
),
(
'Chess Society'
,
'chesssociety@example.com'
,
'Organization for chess lovers'
,
'alicedoe@example.com'
,
'RECREATION'
,
20
),
(
'Science Association'
,
'science@example.com'
,
'Encouraging scientific exploration'
,
'johnsmith@example.com'
,
'ACADEMIC'
,
30
),
(
'Science Association'
,
'science@example.com'
,
'Encouraging scientific exploration'
,
'johnsmith@example.com'
,
'ACADEMIC'
,
30
),
(
'Political Discussion Group'
,
'politics@example.com'
,
'Discussions on current political affairs'
,
'alicedoe@example.com'
,
'POLITICS'
,
25
),
(
'Political Discussion Group'
,
'politics@example.com'
,
'Discussions on current political affairs'
,
'alicedoe@example.com'
,
'POLITICS'
,
25
),
(
'Greek Life Association'
,
'greeklife@example.com'
,
'Promoting Greek culture and traditions'
,
'emilyjohnson@example.com'
,
'GREEK
LIFE'
,
40
);
(
'Greek Life Association'
,
'greeklife@example.com'
,
'Promoting Greek culture and traditions'
,
'emilyjohnson@example.com'
,
'GREEKLIFE'
,
40
);
CREATE
TABLE
IF
NOT
EXISTS
ORGANIZATION_ROSTER
(
CREATE
TABLE
IF
NOT
EXISTS
ORGANIZATION_ROSTER
(
user_email
VARCHAR
(
128
)
NOT
NULL
,
user_email
VARCHAR
(
128
)
NOT
NULL
,
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/example/accessingdatamysql/Organization.java
+
13
−
11
View file @
368f428e
...
@@ -7,17 +7,19 @@ import jakarta.persistence.*;
...
@@ -7,17 +7,19 @@ import jakarta.persistence.*;
@Table
(
name
=
"ORGANIZATION"
)
@Table
(
name
=
"ORGANIZATION"
)
public
class
Organization
{
public
class
Organization
{
// enum Category {
enum
Category
{
// ACADEMIC,
ACADEMIC
,
// RECREATION,
RECREATION
,
// TECHNOLOGY,
TECHNOLOGY
,
// POLITICS,
POLITICS
,
// GREEKLIFE
// }
GREEKLIFE
}
// private Category category;
@Enumerated
(
EnumType
.
STRING
)
private
Category
category
;
private
String
category
;
//
private String category;
private
Integer
memberCount
;
private
Integer
memberCount
;
...
@@ -37,11 +39,11 @@ public class Organization {
...
@@ -37,11 +39,11 @@ public class Organization {
// this.category = category;
// this.category = category;
// }
// }
public
String
getCategory
()
{
public
Category
getCategory
()
{
return
category
;
return
category
;
}
}
public
void
setCategory
(
String
category
)
{
public
void
setCategory
(
Category
category
)
{
this
.
category
=
category
;
this
.
category
=
category
;
}
}
...
...
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