Initial commit
All checks were successful
Docker Build and Publish / build-and-push (push) Successful in 2m17s
All checks were successful
Docker Build and Publish / build-and-push (push) Successful in 2m17s
This commit is contained in:
45
backend/pb_migrations/1736616000_update_time_entries.js
Normal file
45
backend/pb_migrations/1736616000_update_time_entries.js
Normal file
@@ -0,0 +1,45 @@
|
||||
migrate((db) => {
|
||||
const dao = new Dao(db);
|
||||
const collection = dao.findCollectionByNameOrId("time_entries");
|
||||
|
||||
// Add is_banked field
|
||||
collection.schema.addField(new SchemaField({
|
||||
name: "is_banked",
|
||||
type: "bool",
|
||||
required: false, // Default true handled in app logic or ignored for now
|
||||
options: {}
|
||||
}));
|
||||
|
||||
// Add manual_override field
|
||||
collection.schema.addField(new SchemaField({
|
||||
name: "manual_override",
|
||||
type: "bool",
|
||||
required: false,
|
||||
options: {}
|
||||
}));
|
||||
|
||||
// Add calculated_hours field
|
||||
collection.schema.addField(new SchemaField({
|
||||
name: "calculated_hours",
|
||||
type: "number",
|
||||
required: false,
|
||||
options: {
|
||||
min: null,
|
||||
max: null,
|
||||
noDecimal: false
|
||||
}
|
||||
}));
|
||||
|
||||
return dao.saveCollection(collection);
|
||||
}, (db) => {
|
||||
const dao = new Dao(db);
|
||||
const collection = dao.findCollectionByNameOrId("time_entries");
|
||||
|
||||
// logic to remove fields if needed, usually tricky in PB migrations securely without losing data
|
||||
// For now we just return null or attempt simple removal
|
||||
collection.schema.removeField("is_banked");
|
||||
collection.schema.removeField("manual_override");
|
||||
collection.schema.removeField("calculated_hours");
|
||||
|
||||
return dao.saveCollection(collection);
|
||||
})
|
||||
Reference in New Issue
Block a user