add zone model
This commit is contained in:
parent
05c81e902d
commit
219eaf0d5e
3 changed files with 31 additions and 1 deletions
13
app/models/zone.rb
Normal file
13
app/models/zone.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: zones
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# acronym :string
|
||||||
|
# label :string
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
class Zone < ApplicationRecord
|
||||||
|
validates :acronym, presence: true, uniqueness: true
|
||||||
|
end
|
10
db/migrate/20211127133549_create_zones.rb
Normal file
10
db/migrate/20211127133549_create_zones.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateZones < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :zones do |t|
|
||||||
|
t.string :acronym
|
||||||
|
t.string :label
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
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.define(version: 2021_11_26_150915) do
|
ActiveRecord::Schema.define(version: 2021_11_27_133549) 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 "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -823,6 +823,13 @@ ActiveRecord::Schema.define(version: 2021_11_26_150915) do
|
||||||
t.index ["procedure_id"], name: "index_without_continuation_mails_on_procedure_id"
|
t.index ["procedure_id"], name: "index_without_continuation_mails_on_procedure_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "zones", force: :cascade do |t|
|
||||||
|
t.string "acronym"
|
||||||
|
t.string "label"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
end
|
||||||
|
|
||||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||||
add_foreign_key "archives_groupe_instructeurs", "archives"
|
add_foreign_key "archives_groupe_instructeurs", "archives"
|
||||||
add_foreign_key "archives_groupe_instructeurs", "groupe_instructeurs"
|
add_foreign_key "archives_groupe_instructeurs", "groupe_instructeurs"
|
||||||
|
|
Loading…
Add table
Reference in a new issue