Skip to content

Commit

Permalink
feat: Add repository branch field to applications (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-martinez authored May 2, 2022
1 parent 030b408 commit 1e17857
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/lenra/lib/lenra/db_schema/lenra_application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ defmodule Lenra.LenraApplication do
# As long as we do not handle repository link read access, we need to redact it
# and remove it from the JSON response.
field(:repository, :string, redact: true)
field(:repository_branch, :string, redact: true)

belongs_to(:creator, User)
has_many(:datastores, Datastore, foreign_key: :application_id)
Expand All @@ -42,7 +43,7 @@ defmodule Lenra.LenraApplication do

def changeset(application, params \\ %{}) do
application
|> cast(params, [:name, :color, :icon, :repository])
|> cast(params, [:name, :color, :icon, :repository, :repository_branch])
|> validate_required([:name, :service_name, :color, :icon, :creator_id])
|> unique_constraint(:name)
|> unique_constraint(:service_name)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Lenra.Repo.Migrations.AddRepositoryBranch do
use Ecto.Migration

def change do
alter table(:applications) do
add(:repository_branch, :string)
end
end
end

0 comments on commit 1e17857

Please sign in to comment.