Added new types and changed SQL since apperently sqlite does use autoincrement
This commit is contained in:
parent
ec46d29423
commit
c90d495636
4 changed files with 16 additions and 16 deletions
|
@ -3,7 +3,7 @@
|
||||||
-- username is what is used for login
|
-- username is what is used for login
|
||||||
-- password is the hashed password
|
-- password is the hashed password
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
userId TEXT DEFAULT (HEX(RANDOMBLOB(4))) NOT NULL UNIQUE,
|
userId TEXT DEFAULT (HEX(RANDOMBLOB(4))) NOT NULL UNIQUE,
|
||||||
username VARCHAR(255) NOT NULL UNIQUE,
|
username VARCHAR(255) NOT NULL UNIQUE,
|
||||||
password VARCHAR(255) NOT NULL
|
password VARCHAR(255) NOT NULL
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE IF NOT EXISTS projects (
|
CREATE TABLE IF NOT EXISTS projects (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name VARCHAR(255) NOT NULL UNIQUE,
|
name VARCHAR(255) NOT NULL UNIQUE,
|
||||||
description TEXT NOT NULL,
|
description TEXT NOT NULL,
|
||||||
owner_user_id INTEGER NOT NULL,
|
owner_user_id INTEGER NOT NULL,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
CREATE TABLE weekly_reports (
|
CREATE TABLE weekly_reports (
|
||||||
user_id INTEGER,
|
report_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
project_id INTEGER,
|
user_id INTEGER NOT NULL,
|
||||||
week INTEGER,
|
project_id INTEGER NOT NULL,
|
||||||
|
week INTEGER NOT NULL,
|
||||||
development_time INTEGER,
|
development_time INTEGER,
|
||||||
meeting_time INTEGER,
|
meeting_time INTEGER,
|
||||||
admin_time INTEGER,
|
admin_time INTEGER,
|
||||||
|
@ -11,6 +12,5 @@ CREATE TABLE weekly_reports (
|
||||||
signed_by INTEGER,
|
signed_by INTEGER,
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||||||
FOREIGN KEY (signed_by) REFERENCES users(id),
|
FOREIGN KEY (signed_by) REFERENCES users(id)
|
||||||
PRIMARY KEY (user_id, project_id, week)
|
);
|
||||||
)
|
|
|
@ -26,19 +26,19 @@ type WeeklyReport struct {
|
||||||
// The user id of the user who submitted the report
|
// The user id of the user who submitted the report
|
||||||
UserId int `json:"userId" db:"user_id"`
|
UserId int `json:"userId" db:"user_id"`
|
||||||
// The name of the project, as it appears in the database
|
// The name of the project, as it appears in the database
|
||||||
ProjectName string `json:"projectName"`
|
ProjectId string `json:"projectId" db:"project_id"`
|
||||||
// The week number
|
// The week number
|
||||||
Week int `json:"week"`
|
Week int `json:"week" db:"week"`
|
||||||
// Total time spent on development
|
// Total time spent on development
|
||||||
DevelopmentTime int `json:"developmentTime"`
|
DevelopmentTime int `json:"developmentTime" db:"development_time"`
|
||||||
// Total time spent in meetings
|
// Total time spent in meetings
|
||||||
MeetingTime int `json:"meetingTime"`
|
MeetingTime int `json:"meetingTime" db:"meeting_time"`
|
||||||
// Total time spent on administrative tasks
|
// Total time spent on administrative tasks
|
||||||
AdminTime int `json:"adminTime"`
|
AdminTime int `json:"adminTime" db:"admin_time"`
|
||||||
// Total time spent on personal projects
|
// Total time spent on personal projects
|
||||||
OwnWorkTime int `json:"ownWorkTime"`
|
OwnWorkTime int `json:"ownWorkTime" db:"own_work_time"`
|
||||||
// Total time spent on studying
|
// Total time spent on studying
|
||||||
StudyTime int `json:"studyTime"`
|
StudyTime int `json:"studyTime" db:"study_time"`
|
||||||
// Total time spent on testing
|
// Total time spent on testing
|
||||||
TestingTime int `json:"testingTime"`
|
TestingTime int `json:"testingTime" db:"testing_time"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue