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:
111
backend/pb_migrations/1736615000_create_time_entries.js
Normal file
111
backend/pb_migrations/1736615000_create_time_entries.js
Normal file
@@ -0,0 +1,111 @@
|
||||
migrate((db) => {
|
||||
const dao = new Dao(db);
|
||||
|
||||
const collection = new Collection({
|
||||
name: "time_entries",
|
||||
type: "base",
|
||||
schema: [
|
||||
{
|
||||
name: "user",
|
||||
type: "relation",
|
||||
required: true,
|
||||
options: {
|
||||
collectionId: "_pb_users_auth_",
|
||||
cascadeDelete: true,
|
||||
maxSelect: 1,
|
||||
displayFields: []
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "date",
|
||||
type: "date",
|
||||
required: true,
|
||||
options: {
|
||||
min: "",
|
||||
max: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "start_time",
|
||||
type: "date",
|
||||
required: false,
|
||||
options: {
|
||||
min: "",
|
||||
max: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "end_time",
|
||||
type: "date",
|
||||
required: false,
|
||||
options: {
|
||||
min: "",
|
||||
max: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "duration",
|
||||
type: "number",
|
||||
required: true,
|
||||
options: {
|
||||
min: 0,
|
||||
max: null,
|
||||
noDecimal: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
type: "select",
|
||||
required: true,
|
||||
options: {
|
||||
maxSelect: 1,
|
||||
values: ["regular", "overtime", "standby", "callback"]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "day_type",
|
||||
type: "select",
|
||||
required: true,
|
||||
options: {
|
||||
maxSelect: 1,
|
||||
values: ["workday", "rest_day_1", "rest_day_2", "holiday"]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "multiplier",
|
||||
type: "number",
|
||||
required: true,
|
||||
options: {
|
||||
min: 0,
|
||||
max: null,
|
||||
noDecimal: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "notes",
|
||||
type: "text",
|
||||
required: false,
|
||||
options: {
|
||||
min: null,
|
||||
max: null,
|
||||
pattern: ""
|
||||
}
|
||||
}
|
||||
],
|
||||
listRule: "@request.auth.id = user.id",
|
||||
viewRule: "@request.auth.id = user.id",
|
||||
createRule: "@request.auth.id = user.id",
|
||||
updateRule: "@request.auth.id = user.id",
|
||||
deleteRule: "@request.auth.id = user.id",
|
||||
});
|
||||
|
||||
return dao.saveCollection(collection);
|
||||
}, (db) => {
|
||||
const dao = new Dao(db);
|
||||
try {
|
||||
const collection = dao.findCollectionByNameOrId("time_entries");
|
||||
return dao.deleteCollection(collection);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user