Browse Source

add setting seeding migration

main
Inhji Y. 9 months ago
parent
commit
a4b17560c8
  1. 10
      priv/repo/migrations/20210111174337_add_settings_data.exs

10
priv/repo/migrations/20210111174337_add_settings_data.exs

@ -2,10 +2,14 @@ defmodule Mirage.Repo.Migrations.AddSettingsData do
use Ecto.Migration
alias Mirage.Settings.Setting
alias Ecto.Multi
def up do
%Setting{}
|> Setting.changeset(%{name: "user_tagline", value: "some tagline"})
|> repo().insert()
Multi.new()
|> Multi.insert(:user_tagline, %Setting{name: "user_tagline", value: "some tagline"})
|> Multi.insert(:user_title, %Setting{name: "user_title", value: "Hi my name is John Void!"})
|> Multi.insert(:footer_text, %Setting{name: "footer_text", value: "2020 was fucking crazy"})
|> repo().transaction()
end
def down do

Loading…
Cancel
Save