mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 06:22:55 +00:00
Revise Reminder Ecto schema
This commit is contained in:
parent
b9a6e8dbf0
commit
a630938df9
2 changed files with 23 additions and 5 deletions
|
|
@ -1,14 +1,13 @@
|
|||
defmodule Jenot.Reminder do
|
||||
use Ecto.Schema
|
||||
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@primary_key false
|
||||
schema "reminders" do
|
||||
field(:date, :date)
|
||||
field(:time, :time)
|
||||
field(:day_of_week, :integer)
|
||||
field(:repeat_period, Ecto.Enum, values: [:day, :week, :month, :year])
|
||||
field(:repeat_count, :integer)
|
||||
field(:deleted_at, :utc_datetime_usec)
|
||||
field(:repeat, Ecto.Enum, values: [:day, :week, :month, :year])
|
||||
field(:unit, :integer)
|
||||
field(:enabled, :boolean)
|
||||
|
||||
belongs_to(:note, Jenot.Note)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
defmodule Jenot.Repo.Migrations.UpdateRemindersSchema do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
drop table(:reminders)
|
||||
|
||||
create table(:reminders, primary_key: false) do
|
||||
add :date, :date, null: false
|
||||
add :time, :time, null: false
|
||||
add :repeat_period, :text, null: false
|
||||
add :repeat_count, :integer, null: false
|
||||
add :enabled, :boolean, null: false
|
||||
|
||||
add :note_id, references(:note, on_delete: :delete_all), null: false, primary_key: true
|
||||
|
||||
timestamps(type: :datetime_usec)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue