Rela
EN Startup guide:
-
Install this module as a dependency in your mix and run
mix deps.get - Create your own database schema modules
- Create a separate Rela module in your app lib folder
-
With the help of
useadd this Rela app to your Rela module with opts that have this structure: use Rela, %{
}relations: [ %{actor: `One of your schema modules`, contractor: `One of your schema modules`, arity: :one_to_one}, %{actor: `One of your schema modules`, contractor: `One of your schema modules`, arity: :one_to_many}, %{actor: `One of your schema modules`, contractor: `One of your schema modules`, arity: :many_to_many}, ... ], repo: `Your Repo module here` -
In your Application, after starting your Repo, you should call
Name of your Rela module.checkr_tables(), which will create `r`-tables -
If you were using the old version of Rela, you should call
Name of your Rela module.update_from_previous_version\1 with a key map that contains previously used aliases and the table names they represented, similar to this: update_from_previous_version(%{
})"`alias used in relation_types`" => "`table name that used the alias`", ... -
After all of that, you should be able to use the remaining functions to manipulate the
r_-tables
RU Быстрый старт
-
Установите этот модуль как зависимость в вашем mix и запустите
mix deps.get - Создайте модули схем для своей базы данных
- Создайте отдельный Rela модуль в своей папке lib
-
С помощью
useдобавьте это Rela приложение к своему Rela модулю с опциями, похожими на эту структуру: use Rela, %{
}relations: [ %{actor: `Один из ваших модулей схемы`, contractor: `Один из ваших модулей схемы`, arity: :one_to_one}, %{actor: `Один из ваших модулей схемы`, contractor: `Один из ваших модулей схемы`, arity: :one_to_many}, %{actor: `Один из ваших модулей схемы`, contractor: `Один из ваших модулей схемы`, arity: :many_to_many}, ... ], repo: `Ваш Repo модуль` -
В вашем Application, после запуска репозитория, необходимо вызвать
Имя вашего модуля Rela.checkr_tables(), что создаст `r`-таблицы -
Если вы использовали старую версию Rela, необходимо вызвать
Имя вашего модуля Rela.update_from_previous_version\1 с ключевой картой в которой находятся прежде используемые псевдонимы и таблицы, которые они представляли, похожую на эту: update_from_previous_version(%{
})"`псевдоним с relation_types`" => "`имя таблицы, использующую этот псевдоним`", ... -
После всего этого, вы можете проверять оставшиеся функции для манипуляции
r_-таблиц