Skip to content

Commit dfd2010

Browse files
committed
add db migrations
1 parent 5457ad9 commit dfd2010

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
defmodule Algora.Repo.Migrations.CreateLeads do
2+
use Ecto.Migration
3+
4+
def change do
5+
# Drop existing tables if they exist
6+
drop_if_exists table(:lead_job_invitations)
7+
drop_if_exists table(:lead_jobs)
8+
drop_if_exists table(:leads)
9+
10+
create table(:leads, primary_key: false) do
11+
add :id, :string, primary_key: true, null: false
12+
add :seed, :text, null: false
13+
add :name, :string
14+
add :bio, :text
15+
add :avatar_url, :text
16+
add :website_url, :string
17+
add :careers_url, :string
18+
add :job_ids, {:array, :string}, default: []
19+
add :members, :jsonb, default: "[]"
20+
add :user_id, references(:users, type: :string, on_delete: :nilify_all)
21+
22+
timestamps()
23+
end
24+
25+
create index(:leads, [:user_id])
26+
end
27+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.AddJobUrlsToLeads do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:leads) do
6+
add :job_urls, {:array, :string}, default: []
7+
end
8+
end
9+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.AddProgressToLeads do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:leads) do
6+
add :progress, :string
7+
end
8+
end
9+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.ChangeJobPostingsLocationToText do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:job_postings) do
6+
modify :location, :text
7+
end
8+
end
9+
end

0 commit comments

Comments
 (0)