-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from folio-org/ERM-209-1to1
Erm 209
- Loading branch information
Showing
7 changed files
with
81 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
service/grails-app/domain/org/olf/general/SingleFileAttachment.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.olf.general | ||
|
||
import grails.gorm.MultiTenant | ||
import grails.gorm.multitenancy.Tenants | ||
|
||
class SingleFileAttachment implements MultiTenant<SingleFileAttachment> { | ||
|
||
// Add transient peroperty for flagging file removal. Transients are ignored by the persistence | ||
// layer. | ||
|
||
String id | ||
FileUpload fileUpload | ||
static hasOne = [fileUpload: FileUpload] | ||
static mappedBy = [fileUpload: 'owner'] | ||
|
||
static mapping = { | ||
tablePerHierarchy false | ||
id generator: 'uuid2', length:36 | ||
fileUpload cascade: 'all' | ||
} | ||
|
||
static constraints = { | ||
fileUpload nullable: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,59 @@ | ||
databaseChangeLog = { | ||
changeSet(author: "Kurt Nordstrom", id: "2019-05-14-0001") { | ||
addColumn(tableName: "document_attachment") { | ||
column(name: "da_file_upload", type: "VARCHAR(36)") | ||
} | ||
|
||
} | ||
|
||
changeSet(author: "Kurt Nordstrom", id: "2019-05-14-0002") { | ||
createTable(tableName: "file_upload") { | ||
column(name: "fu_id", type: "VARCHAR(36)") { | ||
constraints(nullable: "false") | ||
} | ||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-1") { | ||
createTable(tableName: "file_upload") { | ||
column(name: "fu_id", type: "VARCHAR(36)") { | ||
constraints(nullable: "false") | ||
} | ||
|
||
column(name: "version", type: "BIGINT") { | ||
constraints(nullable: "false") | ||
} | ||
column(name: "version", type: "BIGINT") { | ||
constraints(nullable: "false") | ||
} | ||
|
||
column(name: "fu_filesize", type: "BIGINT") { | ||
constraints(nullable: "false") | ||
} | ||
column(name: "fu_filesize", type: "BIGINT") { | ||
constraints(nullable: "false") | ||
} | ||
|
||
column(name: "fu_last_mod", type: "timestamp") | ||
column(name: "fu_last_mod", type: "TIMESTAMP WITHOUT TIME ZONE") | ||
|
||
column(name: "file_content_type", type: "VARCHAR(255)") | ||
column(name: "file_content_type", type: "VARCHAR(255)") | ||
|
||
column(name: "fu_filename", type: "VARCHAR(255)") { | ||
constraints(nullable: "false") | ||
} | ||
column(name: "fu_owner", type: "VARCHAR(36)") | ||
|
||
column(name: "fu_bytes", type: "bytea") | ||
} | ||
column(name: "fu_filename", type: "VARCHAR(255)") { | ||
constraints(nullable: "false") | ||
} | ||
|
||
column(name: "fu_bytes", type: "BYTEA") | ||
} | ||
} | ||
|
||
changeSet(author: "kurt (generated)", id: "2019-05-14-0004") { | ||
addPrimaryKey(columnNames: "fu_id", constraintName: "file_uploadPK", tableName: "file_upload") | ||
|
||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-2") { | ||
createTable(tableName: "single_file_attachment") { | ||
column(name: "id", type: "VARCHAR(36)") { | ||
constraints(nullable: "false") | ||
} | ||
|
||
column(name: "version", type: "BIGINT") { | ||
constraints(nullable: "false") | ||
} | ||
} | ||
} | ||
|
||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-3") { | ||
addPrimaryKey(columnNames: "fu_id", constraintName: "file_uploadPK", tableName: "file_upload") | ||
} | ||
|
||
changeSet(author: "kurt (generated)", id: "2019-05-14-0005") { | ||
addForeignKeyConstraint(baseColumnNames: "da_file_upload", baseTableName: "document_attachment", constraintName: "FKsn3g0f85naqw4heh0rlqgo8x8", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "fu_id", referencedTableName: "file_upload") | ||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-4") { | ||
addPrimaryKey(columnNames: "id", constraintName: "single_file_attachmentPK", tableName: "single_file_attachment") | ||
} | ||
|
||
} | ||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-5") { | ||
addForeignKeyConstraint(baseColumnNames: "fu_owner", baseTableName: "file_upload", constraintName: "FK2kjo91mrq9mt35oo8a94c0p5o", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "id", referencedTableName: "single_file_attachment") | ||
} | ||
|
||
changeSet(author: "sosguthorpe (generated)", id: "1560252507752-6") { | ||
dropColumn(columnName: "da_version", tableName: "document_attachment") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters