//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format. //Copyright (C) 2024 HTWKalender support@htwkalender.de //This program is free software: you can redistribute it and/or modify //it under the terms of the GNU Affero General Public License as published by //the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU Affero General Public License for more details. //You should have received a copy of the GNU Affero General Public License //along with this program. If not, see . package migrations import ( "encoding/json" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/daos" m "github.com/pocketbase/pocketbase/migrations" "github.com/pocketbase/pocketbase/models" ) func init() { m.Register(func(db dbx.Builder) error { jsonData := `[ { "id": "cfq9mqlmd97v8z5", "created": "2023-09-19 17:31:15.957Z", "updated": "2023-09-19 17:31:15.957Z", "name": "groups", "type": "base", "system": false, "schema": [ { "system": false, "id": "85msl21p", "name": "university", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "2sii4dtp", "name": "shortcut", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "uiwgo28f", "name": "groupId", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "y0l1lrzs", "name": "course", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "kr62mhbz", "name": "faculty", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "ya6znpez", "name": "facultyId", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } } ], "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_rcaN2Oq` + "`" + ` ON ` + "`" + `groups` + "`" + ` (` + "`" + `course` + "`" + `)" ], "listRule": null, "viewRule": null, "createRule": null, "updateRule": null, "deleteRule": null, "options": {} }, { "id": "d65h4wh7zk13gxp", "created": "2023-09-19 17:31:15.957Z", "updated": "2023-10-17 08:37:17.943Z", "name": "feeds", "type": "base", "system": false, "schema": [ { "system": false, "id": "cowxjfmc", "name": "modules", "type": "json", "required": true, "unique": false, "options": {} } ], "indexes": [], "listRule": null, "viewRule": "", "createRule": null, "updateRule": null, "deleteRule": null, "options": {} }, { "id": "7her4515qsmrxe8", "created": "2023-09-19 17:31:15.958Z", "updated": "2023-09-19 17:31:15.958Z", "name": "events", "type": "base", "system": false, "schema": [ { "system": false, "id": "m8ne8e3m", "name": "Day", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "xnsxqp7j", "name": "Week", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "7vsr9h6p", "name": "Start", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "wwpokofe", "name": "End", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "aeuskrjo", "name": "Name", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "klrzqyw0", "name": "EventType", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "5zltexoy", "name": "Prof", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "gy3nvfmx", "name": "Rooms", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "hn7b8dfy", "name": "Notes", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "axskpwm8", "name": "BookedAt", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "vyyefxp7", "name": "course", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "vlbpm9fz", "name": "semester", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } } ], "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_orp1NWL` + "`" + ` ON ` + "`" + `events` + "`" + ` (\n ` + "`" + `Day` + "`" + `,\n ` + "`" + `Week` + "`" + `,\n ` + "`" + `Start` + "`" + `,\n ` + "`" + `End` + "`" + `,\n ` + "`" + `Name` + "`" + `,\n ` + "`" + `course` + "`" + `,\n ` + "`" + `Prof` + "`" + `,\n ` + "`" + `Rooms` + "`" + `,\n ` + "`" + `EventType` + "`" + `\n)" ], "listRule": null, "viewRule": null, "createRule": null, "updateRule": null, "deleteRule": null, "options": {} }, { "id": "_pb_users_auth_", "created": "2023-10-08 16:32:34.131Z", "updated": "2023-10-08 16:32:34.315Z", "name": "users", "type": "auth", "system": false, "schema": [ { "system": false, "id": "users_name", "name": "name", "type": "text", "required": false, "unique": false, "options": { "min": null, "max": null, "pattern": "" } }, { "system": false, "id": "users_avatar", "name": "avatar", "type": "file", "required": false, "unique": false, "options": { "maxSelect": 1, "maxSize": 5242880, "mimeTypes": [ "image/jpeg", "image/png", "image/svg+xml", "image/gif", "image/webp" ], "thumbs": null, "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, "requireEmail": false } } ]` collections := []*models.Collection{} if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { return err } return daos.New(db).ImportCollections(collections, true, nil) }, func(db dbx.Builder) error { return nil }) }