You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
Compare commits
2 Commits
v0.1.0
...
d10686e70f
| Author | SHA1 | Date | |
|---|---|---|---|
| d10686e70f | |||
| c335c834ba |
20
core/model/types/attachment.go
Normal file
20
core/model/types/attachment.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Attachment struct {
|
||||
Id string `json:"id"`
|
||||
TransactionId string `json:"transactionId"`
|
||||
OrgId string `json:"orgId"`
|
||||
UserId string `json:"userId"`
|
||||
FileName string `json:"fileName"`
|
||||
OriginalName string `json:"originalName"`
|
||||
ContentType string `json:"contentType"`
|
||||
FileSize int64 `json:"fileSize"`
|
||||
FilePath string `json:"filePath"`
|
||||
Description string `json:"description"`
|
||||
Uploaded time.Time `json:"uploaded"`
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
@@ -4,3 +4,7 @@ CREATE INDEX split_transactionId_index ON split (transactionId);
|
||||
CREATE INDEX split_date_index ON split (date);
|
||||
CREATE INDEX split_updated_index ON split (updated);
|
||||
CREATE INDEX budgetitem_orgId_index ON budgetitem (orgId);
|
||||
CREATE INDEX attachment_transactionId_index ON attachment (transactionId);
|
||||
CREATE INDEX attachment_orgId_index ON attachment (orgId);
|
||||
CREATE INDEX attachment_userId_index ON attachment (userId);
|
||||
CREATE INDEX attachment_uploaded_index ON attachment (uploaded);
|
||||
28
models/attachment.go
Normal file
28
models/attachment.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Attachment struct {
|
||||
ID []byte `gorm:"type:BINARY(16);primaryKey"`
|
||||
TransactionID []byte `gorm:"column:transactionId;type:BINARY(16);not null"`
|
||||
OrgID []byte `gorm:"column:orgId;type:BINARY(16);not null"`
|
||||
UserID []byte `gorm:"column:userId;type:BINARY(16);not null"`
|
||||
FileName string `gorm:"column:fileName;size:255;not null"`
|
||||
OriginalName string `gorm:"column:originalName;size:255;not null"`
|
||||
ContentType string `gorm:"column:contentType;size:100;not null"`
|
||||
FileSize int64 `gorm:"column:fileSize;not null"`
|
||||
FilePath string `gorm:"column:filePath;size:500;not null"`
|
||||
Description string `gorm:"column:description;size:500"`
|
||||
Uploaded time.Time `gorm:"column:uploaded;not null"`
|
||||
Deleted bool `gorm:"column:deleted;default:false"`
|
||||
|
||||
Transaction Transaction `gorm:"foreignKey:TransactionID"`
|
||||
Org Org `gorm:"foreignKey:OrgID"`
|
||||
User User `gorm:"foreignKey:UserID"`
|
||||
}
|
||||
|
||||
func (Attachment) TableName() string {
|
||||
return "attachment"
|
||||
}
|
||||
@@ -31,3 +31,5 @@ CREATE TABLE apikey (id BINARY(16) NOT NULL, inserted BIGINT UNSIGNED NOT NULL,
|
||||
CREATE TABLE invite (id VARCHAR(32) NOT NULL, orgId BINARY(16) NOT NULL, inserted BIGINT UNSIGNED NOT NULL, updated BIGINT UNSIGNED NOT NULL, email VARCHAR(100) NOT NULL, accepted BOOLEAN NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE budgetitem (id INT UNSIGNED NOT NULL AUTO_INCREMENT, orgId BINARY(16) NOT NULL, accountId BINARY(16) NOT NULL, inserted BIGINT UNSIGNED NOT NULL, amount BIGINT NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE attachment (id BINARY(16) NOT NULL, transactionId BINARY(16) NOT NULL, orgId BINARY(16) NOT NULL, userId BINARY(16) NOT NULL, fileName VARCHAR(255) NOT NULL, originalName VARCHAR(255) NOT NULL, contentType VARCHAR(100) NOT NULL, fileSize BIGINT NOT NULL, filePath VARCHAR(500) NOT NULL, description VARCHAR(500), uploaded BIGINT UNSIGNED NOT NULL, deleted BOOLEAN NOT NULL DEFAULT false, PRIMARY KEY(id)) ENGINE=InnoDB;
|
||||
Reference in New Issue
Block a user