Add snowflake IDs
This commit is contained in:
parent
4a890a39f4
commit
44b484de21
24 changed files with 116 additions and 14 deletions
|
@ -2,7 +2,8 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
|
|||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:instance_settings) do
|
||||
create table(:instance_settings, primary_key: false) 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
|
||||
|
@ -16,6 +17,8 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
|
|||
timestamps()
|
||||
end
|
||||
|
||||
execute "ALTER TABLE instance_settings ADD CONSTRAINT single_row CHECK (id = 1);"
|
||||
|
||||
flush()
|
||||
|
||||
execute(fn ->
|
||||
|
@ -31,11 +34,11 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
|
|||
|
||||
sql = """
|
||||
INSERT INTO instance_settings (
|
||||
name, description, domain, registration,
|
||||
id, name, description, domain, registration,
|
||||
max_characters, max_upload_size, api_offset,
|
||||
public_key, private_key, inserted_at, updated_at
|
||||
) VALUES (
|
||||
'Nulla', 'Freedom Social Network', '#{domain}', false,
|
||||
1, 'Nulla', 'Freedom Social Network', '#{domain}', false,
|
||||
5000, 50, 100,
|
||||
#{esc.(public_key)}, #{esc.(private_key)},
|
||||
'#{now}', '#{now}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue