Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corps-directory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
fhurtado14
corps-directory
Commits
ac38ef7f
Commit
ac38ef7f
authored
4 months ago
by
Federico Hurtado
Browse files
Options
Downloads
Patches
Plain Diff
Update schema for activity tables.
parent
43c81e09
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Feature/activity logger
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/config/database/schema.sql
+15
-6
15 additions, 6 deletions
backend/config/database/schema.sql
with
15 additions
and
6 deletions
backend/config/database/schema.sql
+
15
−
6
View file @
ac38ef7f
...
@@ -13,12 +13,11 @@ CREATE TABLE IF NOT EXISTS users (
...
@@ -13,12 +13,11 @@ CREATE TABLE IF NOT EXISTS users (
FOREIGN
KEY
(
roleID
)
REFERENCES
rolesPermissions
(
roleID
)
FOREIGN
KEY
(
roleID
)
REFERENCES
rolesPermissions
(
roleID
)
);
);
-- Table to log login
/logout
information
-- Table to log login information
CREATE
TABLE
IF
NOT
EXISTS
userLogin
Logout
(
CREATE
TABLE
IF
NOT
EXISTS
userLogin
(
eventId
INT
AUTO_INCREMENT
PRIMARY
KEY
,
eventId
INT
AUTO_INCREMENT
PRIMARY
KEY
,
eventTimestamp
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
eventTimestamp
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
userID
INT
NOT
NULL
,
userID
INT
NOT
NULL
,
eventType
VARCHAR
(
255
)
NOT
NULL
,
-- successfulLogin, unsuccessfulLogin, logout
FOREIGN
KEY
(
userID
)
REFERENCES
users
(
userID
)
FOREIGN
KEY
(
userID
)
REFERENCES
users
(
userID
)
);
);
...
@@ -120,8 +119,18 @@ CREATE TABLE IF NOT EXISTS peopleXInvolvement (
...
@@ -120,8 +119,18 @@ CREATE TABLE IF NOT EXISTS peopleXInvolvement (
FOREIGN
KEY
(
involvementId
)
REFERENCES
involvementLookup
(
involvementId
)
FOREIGN
KEY
(
involvementId
)
REFERENCES
involvementLookup
(
involvementId
)
);
);
CREATE
TABLE
IF
NOT
EXISTS
changeLog
(
logId
INT
PRIMARY
KEY
AUTO_INCREMENT
,
changedTable
VARCHAR
(
255
)
NOT
NULL
,
-- e.g., "people" to specify the table updated
recordId
INT
NOT
NULL
,
-- ID of the record that was updated
userId
INT
NOT
NULL
,
-- User who made the change (foreign key to `users` table)
changeTimestamp
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
changeType
ENUM
(
'INSERT'
,
'UPDATE'
,
'DELETE'
)
NOT
NULL
,
changedColumns
TEXT
NOT
NULL
,
-- Names of columns that were changed
oldValues
TEXT
,
-- JSON format for previous values
newValues
TEXT
,
-- JSON format for new values
FOREIGN
KEY
(
userId
)
REFERENCES
users
(
userID
)
);
INSERT
INTO
countryLookup
(
countryId
,
name
)
INSERT
INTO
countryLookup
(
countryId
,
name
)
VALUES
(
1
,
'United States'
);
VALUES
(
1
,
'United States'
);
-- I think there is already a people table that exists in our DB and
-- has data that does not include peopoleID
\ No newline at end of file
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