mirror of
				https://github.com/Theodor-Springmann-Stiftung/musenalm.git
				synced 2025-10-29 09:15:33 +00:00 
			
		
		
		
	deleted bad migfration structure
This commit is contained in:
		
							
								
								
									
										55
									
								
								migrations/1739446703_insert_data_reihen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								migrations/1739446703_insert_data_reihen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| package migrations | ||||
|  | ||||
| import ( | ||||
| 	"github.com/Theodor-Springmann-Stiftung/musenalm/pagemodels" | ||||
| 	"github.com/pocketbase/pocketbase/core" | ||||
| 	m "github.com/pocketbase/pocketbase/migrations" | ||||
| 	"github.com/pocketbase/pocketbase/tools/filesystem" | ||||
| ) | ||||
|  | ||||
| const INDEX_NAME = "Musenalm" | ||||
|  | ||||
| const INDEX_BESCHREIBUNG = "Musenalm: Verzeichnis deutschsprachiger Almanache des 18. und 19. Jahrhunderts. Reihenverzeichnis." | ||||
|  | ||||
| const INDEX_TEXT = "<p>Ziel der Musenalm ist die bibliographische Erfassung eines Jahrhunderts deutscher Almanache und Taschenbücher;<strong> </strong>das Projekt ist im Aufbau und wird kontinuierlich weitergeführt.</p><p>Verzeichnet werden:</p><ul><li><strong>Reihen </strong>und<strong> Bände</strong> bekannter Almanache und einzelne Druckauflagen mit ausführlichen bibliographischen Angaben und kurzer systematisierter <strong>Darstellung ihres strukturellen Aufbaus </strong> (Paginierung, Anordnung der Druckteile, Graphiken und Beilagen),<strong><br></strong></li><li><strong>Beiträge literarisch oder musisch ausgerichteter Almanache </strong>einzeln, nach Autor, Überschrift und Incipit,<strong> </strong>inklusive<strong> Digitalisate </strong>graphischer und musischer Beiträge,</li><li>Beiträge vorwiegend <strong>nicht literarischer Almanache</strong> in der Regel durch Wiedergabe des <strong>Inhaltsverzeichnisses.</strong></li></ul><p>Die Bibliographie ist zugänglich mit umfangreichen Suchfunktionen über:</p><ul><li><strong>Reihentitel der Almanache,</strong></li><li><strong>Abbildungen (Graphiken und Musikbeilagen),</strong></li><li>Personennamen von Herausgebern und Beiträgern einerseits über normierte<strong> Realnamen </strong>und andererseits über die im Druck erscheinenden Schreibweisen der Personen (auch Pseudonyme)<strong> </strong>als<strong> Autornamen,</strong></li><li><strong>Einzeltitel und Incipit </strong>(wörtliche Textanfänge) von Beiträgen.</li></ul><p>Die Musenalm ist ein Projekt der Theodor Springmann Stiftung in Heidelberg.</p>" | ||||
|  | ||||
| const START_BILD = "./import/Static-Bilder/musen.png" | ||||
|  | ||||
| func init() { | ||||
| 	m.Register(func(app core.App) error { | ||||
| 		collection, err := app.FindCollectionByNameOrId( | ||||
| 			pagemodels.GeneratePageTableName(pagemodels.P_REIHEN_NAME)) | ||||
| 		if err != nil { | ||||
| 			app.Logger().Error("Could not find Table Reihen! You need to execute table migrations first!") | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		record := pagemodels.NewReihen(core.NewRecord(collection)) | ||||
| 		record.SetTitle(INDEX_NAME) | ||||
| 		record.SetText(INDEX_TEXT) | ||||
| 		record.SetDescription(INDEX_BESCHREIBUNG) | ||||
|  | ||||
| 		img, err := filesystem.NewFileFromPath(START_BILD) | ||||
| 		if err != nil { | ||||
| 			app.Logger().Error("Failed to read image file", "error", err, "path", START_BILD) | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		record.SetImage(img) | ||||
|  | ||||
| 		if err := app.Save(record); err != nil { | ||||
| 			app.Logger().Error("Failed to save record", "error", err, "record", record) | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		return nil | ||||
| 	}, func(app core.App) error { | ||||
| 		coll, err := app.FindCollectionByNameOrId( | ||||
| 			pagemodels.GeneratePageTableName(pagemodels.P_REIHEN_NAME)) | ||||
|  | ||||
| 		if err == nil && coll != nil { | ||||
| 			app.DB().NewQuery("DELETE FROM " + coll.TableName()).Execute() | ||||
| 		} | ||||
| 		return nil | ||||
| 	}) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Simon Martens
					Simon Martens