create default_zones_administrateurs

This commit is contained in:
Christophe Robillard 2023-04-04 18:28:21 +02:00
parent 53dd2955e4
commit 34540d34e9
3 changed files with 17 additions and 1 deletions

View file

@ -15,6 +15,7 @@ class Administrateur < ApplicationRecord
has_many :procedures, through: :administrateurs_procedures
has_many :services
has_many :api_tokens, inverse_of: :administrateur, dependent: :destroy
has_and_belongs_to_many :default_zones, class_name: 'Zone', join_table: 'default_zones_administrateurs'
belongs_to :user

View file

@ -0,0 +1,8 @@
class CreateDefaultZonesAdministrateurs < ActiveRecord::Migration[6.1]
def change
create_table :default_zones_administrateurs, id: false do |t|
t.belongs_to :administrateur
t.belongs_to :zone
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_05_08_103932) do
ActiveRecord::Schema[7.0].define(version: 2023_05_08_160551) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
@ -269,6 +269,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_08_103932) do
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
end
create_table "default_zones_administrateurs", id: false, force: :cascade do |t|
t.bigint "administrateur_id"
t.bigint "zone_id"
t.index ["administrateur_id"], name: "index_default_zones_administrateurs_on_administrateur_id"
t.index ["zone_id"], name: "index_default_zones_administrateurs_on_zone_id"
end
create_table "delayed_jobs", id: :serial, force: :cascade do |t|
t.integer "attempts", default: 0, null: false
t.datetime "created_at", precision: 6