Add the datalayer and a migration for books.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
defmodule DecentralisedBookIndex.Repo.Migrations.CreateBooks 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
|
||||
create table(:books, primary_key: false) do
|
||||
add :id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true
|
||||
add :title, :text, null: false
|
||||
add :isbn, :text, null: false
|
||||
add :description, :text, null: false
|
||||
|
||||
add :inserted_at, :utc_datetime_usec,
|
||||
null: false,
|
||||
default: fragment("(now() AT TIME ZONE 'utc')")
|
||||
|
||||
add :updated_at, :utc_datetime_usec,
|
||||
null: false,
|
||||
default: fragment("(now() AT TIME ZONE 'utc')")
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
drop table(:books)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user