aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/custom_field.rb2
-rw-r--r--db/migrate/20180109144120_create_custom_fields.rb14
-rw-r--r--db/schema.rb13
-rw-r--r--spec/factories/custom_fields.rb10
-rw-r--r--spec/models/custom_field_spec.rb5
5 files changed, 43 insertions, 1 deletions
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