create default_zones_administrateurs
This commit is contained in:
parent
53dd2955e4
commit
34540d34e9
3 changed files with 17 additions and 1 deletions
|
@ -15,6 +15,7 @@ class Administrateur < ApplicationRecord
|
||||||
has_many :procedures, through: :administrateurs_procedures
|
has_many :procedures, through: :administrateurs_procedures
|
||||||
has_many :services
|
has_many :services
|
||||||
has_many :api_tokens, inverse_of: :administrateur, dependent: :destroy
|
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
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pgcrypto"
|
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"
|
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
|
||||||
end
|
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|
|
create_table "delayed_jobs", id: :serial, force: :cascade do |t|
|
||||||
t.integer "attempts", default: 0, null: false
|
t.integer "attempts", default: 0, null: false
|
||||||
t.datetime "created_at", precision: 6
|
t.datetime "created_at", precision: 6
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue