Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ defmodule AshPostgres.DataLayer do

def can?(_, {:aggregate, :unrelated}), do: true
def can?(_, {:exists, :unrelated}), do: true
def can?(_, {:exists, :embedded_array}), do: true
def can?(_, :aggregate_filter), do: true
def can?(_, :aggregate_sort), do: true
def can?(_, :calculate), do: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "name",
"type": "text"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "76AC03FB2DBC3C968CBC922C933E82F084A07AFD4FBE6C90BBE53E5E755BC37F",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "embedded_array_companies"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "title",
"type": "text"
},
{
"allow_nil?": true,
"default": "true",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "active",
"type": "boolean"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "options",
"type": "jsonb"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "7E03C1BEBCCEE486DAB75FCA9D4BA7454F6C120C032ABB5C08398C120196EFC2",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "embedded_array_estimates"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "title",
"type": "text"
},
{
"allow_nil?": true,
"default": "true",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "active",
"type": "boolean"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "options",
"type": "jsonb"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": {
"deferrable": false,
"destination_attribute": "id",
"destination_attribute_default": null,
"destination_attribute_generated": null,
"index?": false,
"match_type": null,
"match_with": null,
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"name": "embedded_array_estimates_company_id_fkey",
"on_delete": null,
"on_update": null,
"primary_key?": true,
"schema": "public",
"table": "embedded_array_companies"
},
"scale": null,
"size": null,
"source": "company_id",
"type": "uuid"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "29C7F9D1AA3AFAEA997BBBD762FBDA7486336DCBFFBC4A065C45B6DE34DB1707",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "embedded_array_estimates"
}
22 changes: 22 additions & 0 deletions priv/test_repo/migrations/20260515050043_migrate_resources68.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule AshPostgres.TestRepo.Migrations.MigrateResources68 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(:embedded_array_estimates, primary_key: false) do
add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true)
add(:title, :text)
add(:active, :boolean, default: true)
add(:options, :jsonb)
end
end

def down do
drop(table(:embedded_array_estimates))
end
end
29 changes: 29 additions & 0 deletions priv/test_repo/migrations/20260516132941_migrate_resources71.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defmodule AshPostgres.TestRepo.Migrations.MigrateResources71 do
@moduledoc """
Adds the `embedded_array_companies` table and the `company_id` column on
`embedded_array_estimates`. Other autogenerated changes for unrelated
resources (interest/profile_interest schemas, classroom.public) were
trimmed out because those tables already exist in the local test DB.
Comment on lines +4 to +6
"""

use Ecto.Migration

def up do
alter table(:embedded_array_estimates) do
add(:company_id, :uuid)
end

create table(:embedded_array_companies, primary_key: false) do
add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true)
add(:name, :text)
end
end

def down do
drop(table(:embedded_array_companies))

alter table(:embedded_array_estimates) do
remove(:company_id)
end
end
end
Loading
Loading