initial shift template migration & schema working with user field/assoc for default shift template
This commit is contained in:
parent
61db634c36
commit
a151bfcee7
16 changed files with 665 additions and 4 deletions
|
@ -0,0 +1,22 @@
|
|||
defmodule Shift73k.Repo.Migrations.CreateShiftTemplates do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:shift_templates, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :label, :string
|
||||
add :subject, :string, null: false
|
||||
add :description, :string
|
||||
add :location, :string
|
||||
add :timezone, :string, null: false
|
||||
add :start_time, :time, null: false
|
||||
add :length_hours, :integer, null: false
|
||||
add :length_minutes, :integer
|
||||
add :user_id, references(:users, on_delete: :nothing, type: :binary_id)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:shift_templates, [:user_id])
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Shift73k.Repo.Migrations.AddUserDefaultShiftColumn do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:users) do
|
||||
add(:default_shift_template_id, references(:shift_templates, type: :binary_id, on_delete: :delete_all))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -46,7 +46,7 @@ this_path = Path.dirname(__ENV__.file)
|
|||
|
||||
users_json = Path.join(this_path, "MOCK_DATA_users.json")
|
||||
|
||||
count_to_take = 65
|
||||
count_to_take = 15
|
||||
|
||||
mock_users = users_json |> File.read!() |> Jason.decode!() |> Enum.take_random(count_to_take)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue