svg preview renderer

This commit is contained in:
zack 2024-10-26 21:41:22 -04:00
parent 43a8412f06
commit faa9599849
No known key found for this signature in database
GPG key ID: 5F873416BCF59F35
29 changed files with 1027 additions and 254 deletions

View file

@ -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

View 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

View 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

View file

@ -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