-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create groups_people schema+migration for #220
- Loading branch information
Showing
6 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
defmodule Auth.GroupPeople do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "group_people" do | ||
|
||
field :group_id, :id | ||
field :person_id, :id | ||
field :people_role_id, :id | ||
|
||
timestamps() | ||
end | ||
|
||
@doc false | ||
def changeset(group_people, attrs) do | ||
group_people | ||
|> cast(attrs, []) | ||
|> validate_required([]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<h1 class="w-full h-full text-center text-7xl text-white font-bold | ||
<h1 class="w-full text-center text-2xl text-white font-bold | ||
bg-gradient-to-r from-green-400 to-blue-500 p-4"> | ||
Groups LiveView! | ||
Groups | ||
</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
priv/repo/migrations/20221021211337_create_group_people.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule Auth.Repo.Migrations.CreateGroupPeople do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:group_people) do | ||
add :group_id, references(:groups, on_delete: :nothing) | ||
add :person_id, references(:people, on_delete: :nothing) | ||
add :people_role_id, references(:people_roles, on_delete: :nothing) | ||
|
||
timestamps() | ||
end | ||
|
||
create index(:group_people, [:group_id]) | ||
create index(:group_people, [:person_id]) | ||
create index(:group_people, [:people_role_id]) | ||
end | ||
end |