@@ -0,0 +1,2 @@
|
||||
[chttpd_auth]
|
||||
timeout = 315362081
|
||||
@@ -0,0 +1 @@
|
||||
.migrate
|
||||
@@ -0,0 +1,5 @@
|
||||
import PouchDB from "pouchdb-core";
|
||||
import PouchDBAdapterHttp from "pouchdb-adapter-http";
|
||||
import PouchdbFind from "pouchdb-find";
|
||||
|
||||
export default PouchDB.plugin(PouchDBAdapterHttp).plugin(PouchdbFind);
|
||||
@@ -0,0 +1,40 @@
|
||||
import { fetch } from "pouchdb-fetch";
|
||||
|
||||
const dbsSecurity = {
|
||||
web_push_subscriptions: {
|
||||
admins: { roles: ["_admin"] },
|
||||
members: { roles: [] },
|
||||
},
|
||||
messages: {
|
||||
admins: { roles: ["_admin"] },
|
||||
members: { roles: [] },
|
||||
},
|
||||
server_settings: {
|
||||
admins: { roles: ["_admin"] },
|
||||
members: { roles: ["_admin"] },
|
||||
},
|
||||
// qr: {
|
||||
// admins: { roles: ["_admin"] },
|
||||
// members: { roles: [] },
|
||||
// },
|
||||
};
|
||||
|
||||
export const up = async () => {
|
||||
for (const [dbName, dbSecurity] of Object.entries(dbsSecurity)) {
|
||||
await fetch(`${process.env.API_URL}/${dbName}`, {
|
||||
method: "PUT",
|
||||
});
|
||||
await fetch(`${process.env.API_URL}/${dbName}/_security`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(dbSecurity),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const down = async () => {
|
||||
for (const dbName of Object.keys(dbsSecurity)) {
|
||||
await fetch(`${process.env.API_URL}/${dbName}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import PouchDB from "../PouchDB.js";
|
||||
|
||||
export const up = async () => {
|
||||
await new PouchDB(`${process.env.API_URL}/`, { skip_setup: true });
|
||||
};
|
||||
|
||||
export const down = async () => {
|
||||
await new PouchDB(`${process.env.API_URL}/`, { skip_setup: true });
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@hereconnect/db-migrations",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"license": "@hereconnect",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=v20.10.0",
|
||||
"pnpm": ">=8.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"migrate": "^2.1.0",
|
||||
"pouchdb-adapter-http": "^9.0.0",
|
||||
"pouchdb-core": "^9.0.0",
|
||||
"pouchdb-fetch": "^9.0.0",
|
||||
"pouchdb-find": "^9.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user