svg preview renderer
This commit is contained in:
parent
43a8412f06
commit
faa9599849
29 changed files with 1027 additions and 254 deletions
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Zoeyscomputer.Repo.Migrations.UpdateGistsCodeType do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:gists) do
|
||||
modify :code, :text
|
||||
end
|
||||
end
|
||||
end
|
||||
10
priv/repo/migrations/20241026223550_add_gists_info.exs
Normal file
10
priv/repo/migrations/20241026223550_add_gists_info.exs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
defmodule Zoeyscomputer.Repo.Migrations.AddGistsInfo do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:gists) do
|
||||
add :title, :string
|
||||
add :desc, :text
|
||||
end
|
||||
end
|
||||
end
|
||||
26
priv/repo/migrations/20241027003540_change_gists_id.exs
Normal file
26
priv/repo/migrations/20241027003540_change_gists_id.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule Zoeyscomputer.Repo.Migrations.ChangeGistsId do
|
||||
alias Ecto.Repo
|
||||
alias Zoeyscomputer.IdGenerator
|
||||
use Ecto.Migration
|
||||
|
||||
import Ecto.Query, only: [from: 2]
|
||||
|
||||
def change do
|
||||
alter table(:gists) do
|
||||
add(:new_id, :string)
|
||||
end
|
||||
|
||||
flush()
|
||||
|
||||
execute """
|
||||
UPDATE gists SET new_id = substring(md5(random()::text), 0, 8)
|
||||
"""
|
||||
|
||||
alter table(:gists) do
|
||||
remove(:id)
|
||||
modify(:new_id, :string, primary_key: true)
|
||||
end
|
||||
|
||||
rename(table(:gists), :new_id, to: :id)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Zoeyscomputer.Repo.Migrations.GistsAuthorField do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:gists) do
|
||||
add :author_id, references(:users, on_delete: :nothing)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue