diff --git a/app/models/glitch/note.rb b/app/models/glitch/note.rb new file mode 100644 index 000000000..e437d99f1 --- /dev/null +++ b/app/models/glitch/note.rb @@ -0,0 +1,15 @@ +# == Schema Information +# +# Table name: glitch_notes +# +# id :integer not null, primary key +# target_id :integer not null +# target_type :string not null +# note :text not null +# created_at :datetime not null +# updated_at :datetime not null +# + +class Glitch::Note < ApplicationRecord + belongs_to :target, polymorphic: true +end diff --git a/db/migrate/20180118192721_create_glitch_notes.rb b/db/migrate/20180118192721_create_glitch_notes.rb new file mode 100644 index 000000000..12988901b --- /dev/null +++ b/db/migrate/20180118192721_create_glitch_notes.rb @@ -0,0 +1,11 @@ +class CreateGlitchNotes < ActiveRecord::Migration[5.1] + def change + create_table :glitch_notes do |t| + t.bigint :target_id, null: false + t.string :target_type, null: false + t.text :note, null: false + t.index [:target_id, :target_type] + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 11ca12235..e4f843291 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180106000232) do +ActiveRecord::Schema.define(version: 20180118192721) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -182,6 +182,15 @@ ActiveRecord::Schema.define(version: 20180106000232) do t.index ["account_id"], name: "index_glitch_keyword_mutes_on_account_id" end + create_table "glitch_notes", force: :cascade do |t| + t.bigint "target_id", null: false + t.string "target_type", null: false + t.text "note", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["target_id", "target_type"], name: "index_glitch_notes_on_target_id_and_target_type" + end + create_table "imports", force: :cascade do |t| t.integer "type", null: false t.boolean "approved", default: false, null: false diff --git a/spec/fabricators/glitch_note_fabricator.rb b/spec/fabricators/glitch_note_fabricator.rb new file mode 100644 index 000000000..05695e736 --- /dev/null +++ b/spec/fabricators/glitch_note_fabricator.rb @@ -0,0 +1,2 @@ +Fabricator('Glitch::Note') do +end diff --git a/spec/models/glitch/note_spec.rb b/spec/models/glitch/note_spec.rb new file mode 100644 index 000000000..3e5fb2335 --- /dev/null +++ b/spec/models/glitch/note_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Glitch::Note, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end