Add additionalData field to ColumnDef
This commit is contained in:
@@ -15,10 +15,24 @@ class ColumnDef extends Model {
|
||||
DatabaseId: String,
|
||||
UUID: { type: String, default: () => uuid() },
|
||||
Type: { type: String, default: 'text' }, // text, number for now
|
||||
additionalData: { type: String, default: '{}' }
|
||||
}
|
||||
}
|
||||
|
||||
// Static and instance methods can go here
|
||||
data_get(key) {
|
||||
return JSON.parse(this.additionalData ? this.additionalData : '{}')[key]
|
||||
}
|
||||
|
||||
data_set(key, value) {
|
||||
const json = JSON.parse(this.additionalData ? this.additionalData : '{}')
|
||||
json[key] = value
|
||||
this.additionalData = JSON.stringify(json)
|
||||
}
|
||||
|
||||
data() {
|
||||
return JSON.parse(this.additionalData ? this.additionalData : '{}')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = ColumnDef
|
||||
|
||||
Reference in New Issue
Block a user