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
Merge requests
!8
Feature/activity logger
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/activity logger
feature/activity-logger
into
main
Overview
0
Commits
9
Pipelines
0
Changes
1
Merged
fhurtado14
requested to merge
feature/activity-logger
into
main
5 months ago
Overview
0
Commits
9
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
ac38ef7f
Prev
Next
Show latest version
1 file
+
15
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
ac38ef7f
Update schema for activity tables.
· ac38ef7f
Federico Hurtado
authored
5 months ago
backend/config/database/schema.sql
+
15
−
6
Options
@@ -13,12 +13,11 @@ CREATE TABLE IF NOT EXISTS users (
FOREIGN
KEY
(
roleID
)
REFERENCES
rolesPermissions
(
roleID
)
);
-- Table to log login
/logout
information
CREATE
TABLE
IF
NOT
EXISTS
userLogin
Logout
(
-- Table to log login information
CREATE
TABLE
IF
NOT
EXISTS
userLogin
(
eventId
INT
AUTO_INCREMENT
PRIMARY
KEY
,
eventTimestamp
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
userID
INT
NOT
NULL
,
eventType
VARCHAR
(
255
)
NOT
NULL
,
-- successfulLogin, unsuccessfulLogin, logout
FOREIGN
KEY
(
userID
)
REFERENCES
users
(
userID
)
);
@@ -120,8 +119,18 @@ CREATE TABLE IF NOT EXISTS peopleXInvolvement (
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
)
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
Loading