mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-29 06:46:03 +08:00
Add migration for new file system attributes compatible with Livebook main
This commit is contained in:
parent
95c95d75cb
commit
6c5b4bb586
1 changed files with 22 additions and 0 deletions
|
|
@ -9,7 +9,9 @@ defmodule Livebook.Migration do
|
|||
move_app_secrets_to_personal_hub()
|
||||
add_personal_hub_secret_key()
|
||||
update_file_systems_to_deterministic_ids()
|
||||
ensure_new_file_system_attributes()
|
||||
move_default_file_system_id_to_default_dir()
|
||||
:ok
|
||||
end
|
||||
|
||||
defp delete_local_host_hub() do
|
||||
|
|
@ -96,6 +98,26 @@ defmodule Livebook.Migration do
|
|||
end
|
||||
end
|
||||
|
||||
defp ensure_new_file_system_attributes() do
|
||||
# Note that this is already handled by update_file_systems_to_deterministic_ids/0,
|
||||
# we add this migration so it also applies to people using Livebook main
|
||||
|
||||
# TODO: remove on Livebook v0.12
|
||||
|
||||
for attrs <- Livebook.Storage.all(:file_systems) do
|
||||
# Ensure new file system fields
|
||||
new_attrs = %{
|
||||
hub_id: Livebook.Hubs.Personal.id(),
|
||||
external_id: nil,
|
||||
region: Livebook.FileSystem.S3.region_from_uri(attrs.bucket_url)
|
||||
}
|
||||
|
||||
attrs = Map.merge(new_attrs, attrs)
|
||||
|
||||
Livebook.Storage.insert(:file_systems, attrs.id, Map.to_list(attrs))
|
||||
end
|
||||
end
|
||||
|
||||
defp move_default_file_system_id_to_default_dir() do
|
||||
# Convert default_file_system_id to default_dir
|
||||
# TODO: remove on Livebook v0.12
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue