From ed837eb5b8bd9f4f734eb8dcedc28bd1167a851d Mon Sep 17 00:00:00 2001 From: Philip How Date: Tue, 9 Apr 2024 19:25:51 +0100 Subject: [PATCH] add timestamp to users roles table (#20844) --- .../20240408101038_add_timestamps_to_users_roles_table.rb | 5 +++++ db/schema.rb | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240408101038_add_timestamps_to_users_roles_table.rb diff --git a/db/migrate/20240408101038_add_timestamps_to_users_roles_table.rb b/db/migrate/20240408101038_add_timestamps_to_users_roles_table.rb new file mode 100644 index 000000000..fddc712b1 --- /dev/null +++ b/db/migrate/20240408101038_add_timestamps_to_users_roles_table.rb @@ -0,0 +1,5 @@ +class AddTimestampsToUsersRolesTable < ActiveRecord::Migration[7.0] + def change + add_timestamps :users_roles, default: -> { 'CURRENT_TIMESTAMP' } + end +end diff --git a/db/schema.rb b/db/schema.rb index 4d6ee8237..271f56a4c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_03_06_173309) do +ActiveRecord::Schema[7.0].define(version: 2024_04_08_101038) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "ltree" @@ -1386,7 +1386,9 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_06_173309) do end create_table "users_roles", id: false, force: :cascade do |t| + t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false t.bigint "role_id" + t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false t.bigint "user_id" t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" end