BREAKING CHANGE: migrations are deployed separately
This commit is contained in:
parent
9bf29b20dc
commit
45674db0b5
1 changed files with 0 additions and 28 deletions
|
@ -1,28 +0,0 @@
|
|||
// https://pocketbase.io/docs/js-migrations/#creating-new-admin
|
||||
const email = "pocketbase@sutty.nl";
|
||||
migrate(
|
||||
(db) => {
|
||||
const dao = new Dao(db);
|
||||
|
||||
const adminPwEnv = $os.getenv("ADMIN_PASSWORD");
|
||||
if (adminPwEnv) {
|
||||
const admin = new Admin();
|
||||
admin.email = email;
|
||||
admin.setPassword(adminPwEnv);
|
||||
|
||||
dao.saveAdmin(admin);
|
||||
}
|
||||
},
|
||||
(db) => {
|
||||
// optional revert
|
||||
const dao = new Dao(db);
|
||||
|
||||
try {
|
||||
const admin = dao.findAdminByEmail(email);
|
||||
|
||||
dao.deleteAdmin(admin);
|
||||
} catch (_) {
|
||||
/* most likely already deleted */
|
||||
}
|
||||
},
|
||||
);
|
Loading…
Reference in a new issue