add primary key annotation to models

This commit is contained in:
Wenkai Yin 2016-06-14 11:59:44 +08:00
parent fa0898f98c
commit df4766b43e
4 changed files with 5 additions and 5 deletions

View File

@ -37,8 +37,8 @@ before_install:
install:
- sudo apt-get update && sudo apt-get install -y libldap2-dev
- sudo apt-get remove -y mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
- sudo apt-get autoremove
- sudo apt-get install libaio1
- sudo apt-get autoremove -y
- sudo apt-get install -y libaio1
- wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
- sudo dpkg -i mysql-5.6.14.deb
- sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server

View File

@ -21,7 +21,7 @@ import (
// AccessLog holds information about logs which are used to record the actions that user take to the resourses.
type AccessLog struct {
LogID int `orm:"column(log_id)" json:"log_id"`
LogID int `orm:"pk;column(log_id)" json:"log_id"`
UserID int `orm:"column(user_id)" json:"user_id"`
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
RepoName string `orm:"column(repo_name)" json:"repo_name"`

View File

@ -21,7 +21,7 @@ import (
// Project holds the details of a project.
type Project struct {
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
ProjectID int64 `orm:"pk;column(project_id)" json:"project_id"`
OwnerID int `orm:"column(owner_id)" json:"owner_id"`
Name string `orm:"column(name)" json:"name"`
CreationTime time.Time `orm:"column(creation_time)" json:"creation_time"`

View File

@ -21,7 +21,7 @@ import (
// User holds the details of a user.
type User struct {
UserID int `orm:"column(user_id)" json:"user_id"`
UserID int `orm:"pk;column(user_id)" json:"user_id"`
Username string `orm:"column(username)" json:"username"`
Email string `orm:"column(email)" json:"email"`
Password string `orm:"column(password)" json:"password"`