Rename record.release to record.release_date

Includes changes to dependent tables (i.e. the record search index) and
related functions.
This commit is contained in:
Claudio Ortolina
2025-05-01 14:04:57 +01:00
parent 8be0144cc7
commit e083950138
20 changed files with 1066 additions and 51 deletions
+5 -5
View File
@@ -175,11 +175,6 @@ msgstr ""
msgid "Record updated successfully"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Save"
@@ -742,3 +737,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Top %{n} Genres"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release Date"
msgstr ""
+744
View File
@@ -0,0 +1,744 @@
## "msgid"s in this file come from POT (.pot) files.
###
### Do not add, change, or remove "msgid"s manually here as
### they're tied to the ones in the corresponding POT file
### (with the same domain).
###
### Use "mix gettext.extract --merge" or "mix gettext.merge"
### to merge POT files into PO files.
msgid ""
msgstr ""
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Actions"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Are you sure?"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Choose a value"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/artist_live/show.html.heex
#: lib/music_library_web/live/collection_live/index.ex
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Collection"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Cover art"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Delete"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Error importing record"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Error!"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Format"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Formats"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Genres"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Hang in there while we get back on track"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Inserted at"
msgstr ""
#: lib/music_library_web/controllers/session_controller.ex
#, elixir-autogen, elixir-format
msgid "Invalid password"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Latest purchase"
msgstr ""
#: lib/music_library_web/controllers/session_controller.ex
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Login"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Logout"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "MusicBrainz ID"
msgstr ""
#: lib/music_library_web/components/pagination_component.ex
#, elixir-autogen, elixir-format
msgid "Next"
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#, elixir-autogen, elixir-format
msgid "No results"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Open options"
msgstr ""
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Password"
msgstr ""
#: lib/music_library_web/components/pagination_component.ex
#, elixir-autogen, elixir-format
msgid "Previous"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Purchase"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Purchased at"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Purchased on"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Record imported successfully"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Record updated successfully"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Save"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Saving..."
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Search"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Show"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#: lib/music_library_web/live/wishlist_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Showing <b>%{visible}</b> of <b>%{total}</b> records"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Something went wrong!"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/stats_live/index.ex
#, elixir-autogen, elixir-format
msgid "Stats"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Success!"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "The application has been updated, please reload."
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Total collection"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Total wishlist"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Types"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Updated at"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "View on MusicBrainz"
msgstr ""
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Welcome to your Music Library"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/artist_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Wishlist"
msgstr ""
#: lib/music_library_web/auth.ex
#, elixir-autogen, elixir-format
msgid "You must be logged in to access this page"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "close"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Copy MusicBrainz ID to clipboard"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Scrobble activity"
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Choose which format to import"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Collected"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Wishlisted"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Includes"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "MusicBrainz data refreshed successfully"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh LastFm Feed"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Cover refreshed successfully"
msgstr ""
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing Cover"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing cover"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "No MB ID"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Details"
msgstr ""
#: lib/music_library_web/components/layouts/root.html.heex
#, elixir-autogen, elixir-format
msgid "Made by"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "View details"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading play count"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error populating genres"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Genres populated successfully"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Populate genres"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh MB data"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh cover"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Records"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading play count"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "A->Z"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Errors"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "On Tour"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "1 record"
msgid_plural "%{count} records"
msgstr[0] ""
msgstr[1] ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "1 scrobble"
msgid_plural "%{count} scrobbles"
msgstr[0] ""
msgstr[1] ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Copy record ID to clipboard"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "ID"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Unreleased"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Album"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Backup"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Blu-ray"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "CD"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Comp"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "DVD"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "EP"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Live"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Multi"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Other"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Single"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Vinyl"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Purchased"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record added to the collection"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Published releases"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Scan"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Scan barcodes · Collection"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Scan one or more barcodes"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Open camera"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Failed to search release for barcode %{number}"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Records imported successfully"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "New"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading similar artists"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading similar artists"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Similar artists"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "PNG, JPG, WEBP up to 8MB"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Upload a file"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "or drag and drop"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Live Dashboard"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Barcode not found"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Some records could not be imported: %{summary}"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#: lib/music_library_web/live/wishlist_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Add"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Add new Record · Collection"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Add new Record · Wishlist"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Add releases"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Adding..."
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#, elixir-autogen, elixir-format
msgid "Search for a record"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Albums"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Tracks"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Add more"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Add more · Artist"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/stats_live/index.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Error wishlisting record"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/stats_live/index.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Record wishlisted successfully"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "No scrobbles"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Meta"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record updated in the background"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Oban"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Top %{n} Artists"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Top %{n} Genres"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release Date"
msgstr ""
@@ -0,0 +1,269 @@
defmodule MusicLibrary.Repo.Migrations.RenameRecordsReleaseToReleaseDate do
use Ecto.Migration
def up do
rename table(:records), :release, to: :release_date
flush()
execute "DROP TRIGGER IF EXISTS records_after_update"
execute "DROP TRIGGER IF EXISTS records_after_insert"
execute "DROP TABLE records_search_index"
flush()
execute """
CREATE VIRTUAL TABLE records_search_index USING fts5(
id UNINDEXED,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids UNINDEXED,
included_release_group_ids UNINDEXED,
cover_hash UNINDEXED,
purchased_at UNINDEXED,
release_date
);
"""
flush()
execute """
CREATE TRIGGER records_after_insert
AFTER INSERT ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records
WHERE NEW.id = records.id;
END;
"""
execute """
CREATE TRIGGER records_after_update
AFTER UPDATE ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records
WHERE NEW.id = records.id;
END;
"""
flush()
execute """
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records;
"""
end
def down do
rename table(:records), :release_date, to: :release
flush()
execute "DROP TRIGGER IF EXISTS records_after_update"
execute "DROP TRIGGER IF EXISTS records_after_insert"
execute "DROP TABLE records_search_index"
flush()
execute """
CREATE VIRTUAL TABLE records_search_index USING fts5(
id UNINDEXED,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids UNINDEXED,
included_release_group_ids UNINDEXED,
cover_hash UNINDEXED,
purchased_at UNINDEXED,
release
);
"""
flush()
execute """
CREATE TRIGGER records_after_insert
AFTER INSERT ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records
WHERE NEW.id = records.id;
END;
"""
execute """
CREATE TRIGGER records_after_update
AFTER UPDATE ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records
WHERE NEW.id = records.id;
END;
"""
flush()
execute """
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records;
"""
end
end