admin user able to create test txs
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/// PocketBase migration: `is_manual` on transactions (admin test rows).
|
||||
///
|
||||
/// Apply on the server:
|
||||
///
|
||||
/// sudo cp this_file /opt/pocketbase/pb_migrations/
|
||||
/// sudo chown pocketbase:pocketbase /opt/pocketbase/pb_migrations/*.js
|
||||
/// sudo -u pocketbase /opt/pocketbase/pocketbase migrate up
|
||||
/// sudo systemctl restart pocketbase
|
||||
migrate((app) => {
|
||||
const transactions = app.findCollectionByNameOrId("transactions");
|
||||
if (transactions.fields.getByName("is_manual")) return;
|
||||
|
||||
transactions.fields.add(new Field({
|
||||
type: "bool",
|
||||
name: "is_manual",
|
||||
required: false,
|
||||
}));
|
||||
app.save(transactions);
|
||||
}, (app) => {
|
||||
try {
|
||||
const transactions = app.findCollectionByNameOrId("transactions");
|
||||
const field = transactions.fields.getByName("is_manual");
|
||||
if (field) {
|
||||
transactions.fields.removeById(field.id);
|
||||
app.save(transactions);
|
||||
}
|
||||
} catch (_) {}
|
||||
});
|
||||
Reference in New Issue
Block a user