Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .check.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

[
## all available options with default values (see `mix check` docs for description)
# parallel: true,
Expand All @@ -12,7 +16,8 @@
# {:credo, "mix credo --format oneline"},

{:check_formatter, command: "mix spark.formatter --check"},
{:check_migrations, command: "mix test.check_migrations"}
{:check_migrations, command: "mix test.check_migrations"},
{:reuse, command: ["pipx", "run", "reuse", "lint", "-q"]}
## custom new tools may be added (mix tasks or arbitrary commands)
# {:my_mix_task, command: "mix release", env: %{"MIX_ENV" => "prod"}},
# {:my_arbitrary_tool, command: "npm test", cd: "assets"},
Expand Down
4 changes: 4 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
Expand Down
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

spark_locals_without_parens = [
all_tenants?: 1,
base_filter_sql: 1,
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

---
updates:
- directory: /
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

name: CI
on:
push:
Expand All @@ -19,6 +23,6 @@ jobs:
publish-docs: ${{ matrix.postgres-version == '16' }}
release: ${{ matrix.postgres-version == '16' }}
igniter-upgrade: ${{matrix.postgres-version == '16'}}

reuse: true
secrets:
hex_api_key: ${{ secrets.HEX_API_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

# The directory Mix will write compiled artifacts to.
/_build/

Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
erlang 27.1.2
elixir 1.18.4-otp-27
pipx 1.8.0
3 changes: 3 additions & 0 deletions .tool-versions.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
3 changes: 3 additions & 0 deletions .vscode/settings.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Change Log

All notable changes to this project will be documented in this file.
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

18 changes: 18 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

![Logo](https://github.com/ash-project/ash/blob/main/logos/cropped-for-header-black-text.png?raw=true#gh-light-mode-only)
![Logo](https://github.com/ash-project/ash/blob/main/logos/cropped-for-header-white-text.png?raw=true#gh-dark-mode-only)

![Elixir CI](https://github.com/ash-project/ash_postgres/workflows/CI/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/MIT)
[![Hex version badge](https://img.shields.io/hexpm/v/ash_postgres.svg)](https://hex.pm/packages/ash_postgres)
[![Hexdocs badge](https://img.shields.io/badge/docs-hexdocs-purple)](https://hexdocs.pm/ash_postgres)
[![REUSE status](https://api.reuse.software/badge/github.com/ash-project/ash_postgres)](https://api.reuse.software/info/github.com/ash-project/ash_postgres)

# AshPostgres

Expand Down
6 changes: 6 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Security Policy

This is a copy of the security policy in the core Ash repo. That is the authoritative source.
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/bulk_create.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

alias AshPostgres.Test.{Domain, Post}

AshPostgres.TestRepo.start_link()
Expand Down
4 changes: 4 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

import Config

if Mix.env() == :dev do
Expand Down
6 changes: 6 additions & 0 deletions documentation/1.0-CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

## [v2.0.0-rc.14](https://github.com/ash-project/ash_postgres/compare/v2.0.0-rc.13...v2.0.0-rc.14) (2024-04-29)

### Improvements:
Expand Down
3 changes: 3 additions & 0 deletions documentation/dsls/DSL-AshPostgres.DataLayer.md.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# What is AshPostgres?

AshPostgres is the PostgreSQL `Ash.DataLayer` for [Ash Framework](https://hexdocs.pm/ash). This is the most fully-featured Ash data layer, and unless you need a specific characteristic or feature of another data layer, you should use `AshPostgres`.
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/advanced/expressions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Expressions

In addition to the expressions listed in the [Ash expressions guide](https://hexdocs.pm/ash/expressions.html), AshPostgres provides the following expressions
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/advanced/manual-relationships.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Manual Relationships

See [Manual Relationships](https://hexdocs.pm/ash/relationships.html#manual-relationships) for an idea of manual relationships in general.
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/advanced/schema-based-multitenancy.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Schema Based Multitenancy

Multitenancy in AshPostgres is implemented via postgres schemas. For more information on schemas, see postgres' [schema documentation](https://www.postgresql.org/docs/current/ddl-schemas.html)
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/advanced/using-multiple-repos.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Using Multiple Repos

When scaling PostgreSQL you may want to setup _read_ replicas to improve
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/development/migrations-and-tasks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Migrations

## Tasks
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/development/testing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Testing with AshPostgres

When using AshPostgres resources in tests, you will likely want to include use a test case similar to the following. This will ensure that your repo runs everything in a transaction.
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/development/upgrading-to-2.0.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Upgrading to 2.0

There are only three breaking changes in this release, one of them is very significant, the other two are minor.
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/resources/polymorphic-resources.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Polymorphic Resources

To support leveraging the same resource backed by multiple tables (useful for things like polymorphic associations), AshPostgres supports setting the `data_layer.table` context for a given resource. For this example, lets assume that you have a `MyApp.Post` resource and a `MyApp.Comment` resource. For each of those resources, users can submit `reactions`. However, you want a separate table for `post_reactions` and `comment_reactions`. You could accomplish that like so:
Expand Down
6 changes: 6 additions & 0 deletions documentation/topics/resources/references.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# References

To configure the behavior of generated foreign keys on a resource, we use the `references` section, within the `postgres` configuration block.
Expand Down
6 changes: 6 additions & 0 deletions documentation/tutorials/get-started-with-ash-postgres.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Get Started With Postgres

## Installation
Expand Down
6 changes: 6 additions & 0 deletions documentation/tutorials/set-up-with-existing-database.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2020 Zach Daniel

SPDX-License-Identifier: MIT
-->

# Setting AshPostgres up with an existing database

If you already have a postgres database and you'd like to get
Expand Down
4 changes: 4 additions & 0 deletions lib/ash_postgres.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres do
@moduledoc """
The AshPostgres extension gives you tools to map a resource to a postgres database table.
Expand Down
4 changes: 4 additions & 0 deletions lib/check_constraint.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.CheckConstraint do
@moduledoc "Represents a configured check constraint on the table backing a resource"

Expand Down
4 changes: 4 additions & 0 deletions lib/custom_aggregate.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.CustomAggregate do
@moduledoc """
A custom aggregate implementation for ecto.
Expand Down
4 changes: 4 additions & 0 deletions lib/custom_extension.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.CustomExtension do
@moduledoc """
A custom extension implementation.
Expand Down
4 changes: 4 additions & 0 deletions lib/custom_index.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.CustomIndex do
@moduledoc "Represents a custom index on the table backing a resource"
@fields [
Expand Down
4 changes: 4 additions & 0 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.DataLayer do
require Ecto.Query
require Ash.Expr
Expand Down
4 changes: 4 additions & 0 deletions lib/data_layer/info.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.DataLayer.Info do
@moduledoc "Introspection functions for "

Expand Down
4 changes: 4 additions & 0 deletions lib/ecto_migration_default.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defprotocol EctoMigrationDefault do
@moduledoc """
Allows configuring how values are translated to default values in migrations.
Expand Down
4 changes: 4 additions & 0 deletions lib/extensions/immutable_raise_error.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.Extensions.ImmutableRaiseError do
@moduledoc """
An extension that installs an immutable version of ash_raise_error.
Expand Down
4 changes: 4 additions & 0 deletions lib/extensions/vector.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.Extensions.Vector do
@moduledoc """
An extension that adds support for the `vector` type.
Expand Down
4 changes: 4 additions & 0 deletions lib/functions/binding.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Zach Daniel
#
# SPDX-License-Identifier: MIT

defmodule AshPostgres.Functions.Binding do
@moduledoc """
Refers to the current table binding.
Expand Down
Loading
Loading