Skip to content

Commit

Permalink
alphabetize schema field list #13
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jun 8, 2024
1 parent e51f32e commit 065e3f2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
6 changes: 3 additions & 3 deletions BUILDIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ This app stores data in **five** schemas:

For each of these schemas we are storing
a _subset_ of the data;
only what we need right now.
only what we need right now. <br />
We can always add more
("[backfill](https://stackoverflow.com/questions/70871818/what-is-backfilling-in-data)")
later as needed.
Expand All @@ -450,8 +450,8 @@ commands:
```sh
mix phx.gen.schema User users login:string avatar_url:string name:string company:string bio:string blog:string location:string email:string created_at:string two_factor_authentication:boolean followers:integer following:integer
mix phx.gen.schema Org orgs login:string avatar_url:string name:string company:string public_repos:integer location:string description:string followers:integer
mix phx.gen.schema Repository repositories name:string full_name:string owner_id:integer description:string fork:boolean forks_count:integer watchers_count:integer stargazers_count:integer topics:string open_issues_count:integer created_at:string pushed_at:string

mix phx.gen.schema Repository repositories name:string full_name:string owner_id:integer owner_name:string description:string fork:boolean forks_count:integer watchers_count:integer stargazers_count:integer topics:string open_issues_count:integer created_at:string pushed_at:string
mix phx.gen.schema Stars stars repo_id:integer
```

At the end of this step,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ defmodule App.User do
field :location, :string
field :login, :string
field :name, :string
field :two_factor_authentication, :boolean, default: false
field :public_repos, :integer
field :two_factor_authentication, :boolean, default: false

timestamps()
end
Expand Down
12 changes: 6 additions & 6 deletions priv/repo/migrations/20221005213110_create_users.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ defmodule App.Repo.Migrations.CreateUsers do
def change do
create table(:users) do
add :avatar_url, :string
add :login, :string
add :name, :string
add :company, :string
add :bio, :string
add :blog, :string
add :location, :string
add :email, :string
add :company, :string
add :created_at, :string
add :two_factor_authentication, :boolean, default: false, null: false
add :email, :string
add :followers, :integer
add :following, :integer
add :hireable, :boolean, default: false, null: false
add :location, :string
add :login, :string
add :name, :string
add :public_repos, :integer
add :two_factor_authentication, :boolean, default: false, null: false

timestamps()
end
Expand Down
14 changes: 7 additions & 7 deletions priv/repo/migrations/20221005213326_create_repositories.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ defmodule App.Repo.Migrations.CreateRepositories do

def change do
create table(:repositories) do
add :name, :string
add :full_name, :string
add :owner_id, :integer
add :created_at, :string
add :description, :string
add :fork, :boolean, default: false, null: false
add :forks_count, :integer
add :watchers_count, :integer
add :stargazers_count, :integer
add :topics, :string
add :full_name, :string
add :name, :string
add :open_issues_count, :integer
add :created_at, :string
add :owner_id, :integer
add :pushed_at, :string
add :stargazers_count, :integer
add :topics, :string
add :watchers_count, :integer

timestamps()
end
Expand Down
4 changes: 3 additions & 1 deletion test/app/repository_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ defmodule App.RepositoryTest do
forks_count: 110,
full_name: "dwyl/start-here",
id: 17338019,
owner_id: 123,
owner_name: "dwyl",
name: "start-here",
open_issues_count: 98,
pushed_at: "2022-08-10T07:41:05Z",
Expand All @@ -20,4 +22,4 @@ defmodule App.RepositoryTest do
assert {:ok, inserted_repo} = App.Repository.create(repo)
assert inserted_repo.name == repo.name
end
end
end

0 comments on commit 065e3f2

Please sign in to comment.