ash.codegen for media

This commit is contained in:
2026-03-30 13:34:32 -04:00
parent 63d91043e4
commit 6152dcdeea
5 changed files with 229 additions and 4 deletions

View File

@@ -0,0 +1,38 @@
defmodule Mixer.Repo.Migrations.AddPostsMediaS3 do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
alter table(:tweets) do
add :likes, :bigint, null: false, default: 0
end
create table(:media, primary_key: false) do
add :id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true
add :s3_key, :text, null: false
add :tweet_id,
references(:tweets,
column: :id,
name: "media_tweet_id_fkey",
type: :uuid,
prefix: "public"
), null: false
end
end
def down do
drop constraint(:media, "media_tweet_id_fkey")
drop table(:media)
alter table(:tweets) do
remove :likes
end
end
end