Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamps migration #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/fun_with_flags/store/persistent/ecto/record.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule FunWithFlags.Store.Persistent.Ecto.Record do
field :gate_type, :string
field :target, :string
field :enabled, :boolean
timestamps(type: :utc_datetime)
end

@fields [:flag_name, :gate_type, :target, :enabled]
Expand Down
17 changes: 17 additions & 0 deletions priv/ecto_repo/migrations/00000000000001_add_timestamps.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule FunWithFlags.Dev.EctoRepo.Migrations.AddTimestamps do
use Ecto.Migration

def up do
alter table(:fun_with_flags_toggles) do
add :inserted_at, :utc_datetime, null: false, default: fragment("CURRENT_TIMESTAMP")
add :updated_at, :utc_datetime, null: false, default: fragment("CURRENT_TIMESTAMP")
end
end

def down do
alter table(:fun_with_flags_toggles) do
remove :inserted_at
remove :updated_at
end
end
end
Loading