ash.codegen for media
This commit is contained in:
38
priv/repo/migrations/20260330173403_add_posts_media_s3.exs
Normal file
38
priv/repo/migrations/20260330173403_add_posts_media_s3.exs
Normal 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
|
||||
Reference in New Issue
Block a user