From 2be1e1c2bc313f586c4e0385d90a8cfbcd9ab609 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 9 Jan 2018 15:49:02 +0100 Subject: Refs: #5505@1h; Spec discussed, model scaffolded [amend me] [skip-ci] --- app/models/custom_field.rb | 2 ++ db/migrate/20180109144120_create_custom_fields.rb | 14 ++++++++++++++ db/schema.rb | 13 ++++++++++++- spec/factories/custom_fields.rb | 10 ++++++++++ spec/models/custom_field_spec.rb | 5 +++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 app/models/custom_field.rb create mode 100644 db/migrate/20180109144120_create_custom_fields.rb create mode 100644 spec/factories/custom_fields.rb create mode 100644 spec/models/custom_field_spec.rb diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb new file mode 100644 index 000000000..74e825d77 --- /dev/null +++ b/app/models/custom_field.rb @@ -0,0 +1,2 @@ +class CustomField < ActiveRecord::Base +end diff --git a/db/migrate/20180109144120_create_custom_fields.rb b/db/migrate/20180109144120_create_custom_fields.rb new file mode 100644 index 000000000..49df645c5 --- /dev/null +++ b/db/migrate/20180109144120_create_custom_fields.rb @@ -0,0 +1,14 @@ +class CreateCustomFields < ActiveRecord::Migration + def change + create_table :custom_fields do |t| + t.string :code + t.string :resource_type + t.string :name + t.string :field_type + t.json :options + t.bigint :workgroup_id + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 19af8690b..99493260d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180109133022) do +ActiveRecord::Schema.define(version: 20180109144120) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -281,6 +281,17 @@ ActiveRecord::Schema.define(version: 20180109133022) do add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree + create_table "custom_fields", id: :bigserial, force: :cascade do |t| + t.string "code" + t.string "resource_type" + t.string "name" + t.string "field_type" + t.json "options" + t.integer "workgroup_id", limit: 8 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "exports", id: :bigserial, force: :cascade do |t| t.integer "referential_id", limit: 8 t.string "status" diff --git a/spec/factories/custom_fields.rb b/spec/factories/custom_fields.rb new file mode 100644 index 000000000..8ce8aae91 --- /dev/null +++ b/spec/factories/custom_fields.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :custom_field do + code "MyString" + resource_type "MyString" + name "MyString" + field_type "MyString" + options "" + workgroup_id "" + end +end diff --git a/spec/models/custom_field_spec.rb b/spec/models/custom_field_spec.rb new file mode 100644 index 000000000..3668e9858 --- /dev/null +++ b/spec/models/custom_field_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CustomField, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end -- cgit v1.2.3