243 lines
5.9 KiB
JavaScript
243 lines
5.9 KiB
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
migrate((db) => {
|
|
const snapshot = [
|
|
{
|
|
"id": "_pb_users_auth_",
|
|
"created": "2024-05-31 09:37:38.729Z",
|
|
"updated": "2024-05-31 10:04:14.257Z",
|
|
"name": "users",
|
|
"type": "auth",
|
|
"system": false,
|
|
"schema": [
|
|
{
|
|
"system": false,
|
|
"id": "users_name",
|
|
"name": "name",
|
|
"type": "text",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": null,
|
|
"max": null,
|
|
"pattern": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "users_avatar",
|
|
"name": "avatar",
|
|
"type": "file",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"mimeTypes": [
|
|
"image/jpeg",
|
|
"image/png",
|
|
"image/svg+xml",
|
|
"image/gif",
|
|
"image/webp"
|
|
],
|
|
"thumbs": null,
|
|
"maxSelect": 1,
|
|
"maxSize": 5242880,
|
|
"protected": false
|
|
}
|
|
}
|
|
],
|
|
"indexes": [],
|
|
"listRule": "id = @request.auth.id",
|
|
"viewRule": "id = @request.auth.id",
|
|
"createRule": "",
|
|
"updateRule": "id = @request.auth.id",
|
|
"deleteRule": "id = @request.auth.id",
|
|
"options": {
|
|
"allowEmailAuth": true,
|
|
"allowOAuth2Auth": true,
|
|
"allowUsernameAuth": true,
|
|
"exceptEmailDomains": null,
|
|
"manageRule": null,
|
|
"minPasswordLength": 8,
|
|
"onlyEmailDomains": null,
|
|
"onlyVerified": false,
|
|
"requireEmail": false
|
|
}
|
|
},
|
|
{
|
|
"id": "l6lqbzxyn649nhg",
|
|
"created": "2024-05-31 09:52:29.101Z",
|
|
"updated": "2024-05-31 10:06:22.566Z",
|
|
"name": "organisations",
|
|
"type": "base",
|
|
"system": false,
|
|
"schema": [
|
|
{
|
|
"system": false,
|
|
"id": "9atm8h79",
|
|
"name": "name",
|
|
"type": "text",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": null,
|
|
"max": null,
|
|
"pattern": ""
|
|
}
|
|
}
|
|
],
|
|
"indexes": [
|
|
"CREATE UNIQUE INDEX `idx_a1tmCfg` ON `organisations` (`name`)"
|
|
],
|
|
"listRule": null,
|
|
"viewRule": null,
|
|
"createRule": null,
|
|
"updateRule": null,
|
|
"deleteRule": null,
|
|
"options": {}
|
|
},
|
|
{
|
|
"id": "q9qzdnsjjr1nunt",
|
|
"created": "2024-05-31 09:55:15.056Z",
|
|
"updated": "2024-06-01 17:48:03.663Z",
|
|
"name": "entries",
|
|
"type": "base",
|
|
"system": false,
|
|
"schema": [
|
|
{
|
|
"system": false,
|
|
"id": "pl8atfjg",
|
|
"name": "project",
|
|
"type": "relation",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"collectionId": "adklaxw6khc2g8l",
|
|
"cascadeDelete": true,
|
|
"minSelect": null,
|
|
"maxSelect": 1,
|
|
"displayFields": null
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "3spm6k8s",
|
|
"name": "start",
|
|
"type": "date",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": "",
|
|
"max": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "a14hucc5",
|
|
"name": "end",
|
|
"type": "date",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": "",
|
|
"max": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bfe7t7yl",
|
|
"name": "description",
|
|
"type": "text",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": null,
|
|
"max": null,
|
|
"pattern": ""
|
|
}
|
|
}
|
|
],
|
|
"indexes": [],
|
|
"listRule": null,
|
|
"viewRule": null,
|
|
"createRule": null,
|
|
"updateRule": null,
|
|
"deleteRule": null,
|
|
"options": {}
|
|
},
|
|
{
|
|
"id": "adklaxw6khc2g8l",
|
|
"created": "2024-05-31 09:56:17.758Z",
|
|
"updated": "2024-05-31 10:12:46.707Z",
|
|
"name": "projects",
|
|
"type": "base",
|
|
"system": false,
|
|
"schema": [
|
|
{
|
|
"system": false,
|
|
"id": "ivql3fwp",
|
|
"name": "organisation",
|
|
"type": "relation",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"collectionId": "l6lqbzxyn649nhg",
|
|
"cascadeDelete": true,
|
|
"minSelect": null,
|
|
"maxSelect": 1,
|
|
"displayFields": null
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "oazzl2ia",
|
|
"name": "name",
|
|
"type": "text",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": null,
|
|
"max": null,
|
|
"pattern": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "gbspap7b",
|
|
"name": "identifier",
|
|
"type": "text",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": null,
|
|
"max": null,
|
|
"pattern": ""
|
|
}
|
|
}
|
|
],
|
|
"indexes": [
|
|
"CREATE UNIQUE INDEX `idx_IAGT9Ow` ON `projects` (`name`)"
|
|
],
|
|
"listRule": null,
|
|
"viewRule": null,
|
|
"createRule": null,
|
|
"updateRule": null,
|
|
"deleteRule": null,
|
|
"options": {}
|
|
}
|
|
];
|
|
|
|
const collections = snapshot.map((item) => new Collection(item));
|
|
|
|
return Dao(db).importCollections(collections, true, null);
|
|
}, (db) => {
|
|
return null;
|
|
})
|