add zone model

This commit is contained in:
Christophe Robillard 2021-12-01 20:00:29 +01:00
parent 05c81e902d
commit 219eaf0d5e
3 changed files with 31 additions and 1 deletions

13
app/models/zone.rb Normal file
View 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

View 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

View file

@ -10,7 +10,7 @@
#
# 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
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"
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 "archives_groupe_instructeurs", "archives"
add_foreign_key "archives_groupe_instructeurs", "groupe_instructeurs"