Update
This commit is contained in:
parent
fa350aa551
commit
c531beadb7
11 changed files with 20 additions and 41 deletions
|
@ -6,7 +6,6 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
|
|||
add :id, :integer, primary_key: true
|
||||
add :name, :string, default: "Nulla", null: false
|
||||
add :description, :text, default: "Freedom Social Network", null: false
|
||||
add :domain, :string, default: "localhost", null: false
|
||||
add :registration, :boolean, default: false, null: false
|
||||
add :max_characters, :integer, default: 5000, null: false
|
||||
add :max_upload_size, :integer, default: 50, null: false
|
||||
|
@ -25,20 +24,15 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
|
|||
{public_key, private_key} = Nulla.KeyGen.gen()
|
||||
now = DateTime.utc_now()
|
||||
|
||||
domain =
|
||||
Application.get_env(:nulla, NullaWeb.Endpoint, [])
|
||||
|> Keyword.get(:url, [])
|
||||
|> Keyword.get(:host, "localhost")
|
||||
|
||||
esc = fn str -> "'#{String.replace(str, "'", "''")}'" end
|
||||
|
||||
sql = """
|
||||
INSERT INTO instance_settings (
|
||||
id, name, description, domain, registration,
|
||||
id, name, description, registration,
|
||||
max_characters, max_upload_size, api_limit,
|
||||
public_key, private_key, inserted_at, updated_at
|
||||
) VALUES (
|
||||
1, 'Nulla', 'Freedom Social Network', '#{domain}', false,
|
||||
1, 'Nulla', 'Freedom Social Network', false,
|
||||
5000, 50, 100,
|
||||
#{esc.(public_key)}, #{esc.(private_key)},
|
||||
'#{now}', '#{now}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue