diff --git a/app/models/guidance.rb b/app/models/guidance.rb index 4258326..59a03c2 100644 --- a/app/models/guidance.rb +++ b/app/models/guidance.rb @@ -12,7 +12,6 @@ # created_at :datetime not null # updated_at :datetime not null # guidance_group_id :integer -# question_id :integer # # Indexes # diff --git a/app/models/guidance_group.rb b/app/models/guidance_group.rb index db9888a..a2b23ea 100644 --- a/app/models/guidance_group.rb +++ b/app/models/guidance_group.rb @@ -7,8 +7,8 @@ # # id :integer not null, primary key # name :string -# optional_subset :boolean -# published :boolean +# optional_subset :boolean default(FALSE), not null +# published :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null # org_id :integer @@ -21,6 +21,7 @@ # # fk_rails_... (org_id => orgs.id) # + class GuidanceGroup < ActiveRecord::Base include GlobalHelpers include ValidationValues diff --git a/app/models/note.rb b/app/models/note.rb index a78dc00..f63d5a6 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -3,7 +3,7 @@ # Table name: notes # # id :integer not null, primary key -# archived :boolean +# archived :boolean default(FALSE), not null # archived_by :integer # text :text # created_at :datetime diff --git a/app/models/org.rb b/app/models/org.rb index cc259f9..a3cd8d2 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -4,26 +4,22 @@ # # id :integer not null, primary key # abbreviation :string -# banner_text :text # contact_email :string # contact_name :string # feedback_email_msg :text # feedback_email_subject :string # feedback_enabled :boolean default(FALSE) -# is_other :boolean +# is_other :boolean default(FALSE), not null # links :text -# logo_file_name :string # logo_name :string # logo_uid :string # name :string # org_type :integer default(0), not null # sort_name :string # target_url :string -# wayfless_entity :string # created_at :datetime not null # updated_at :datetime not null # language_id :integer -# parent_id :integer # region_id :integer # # Foreign Keys diff --git a/app/models/phase.rb b/app/models/phase.rb index 41a985b..58a466d 100644 --- a/app/models/phase.rb +++ b/app/models/phase.rb @@ -6,7 +6,6 @@ # description :text # modifiable :boolean # number :integer -# slug :string # title :string # created_at :datetime # updated_at :datetime diff --git a/app/models/plan.rb b/app/models/plan.rb index 04e7642..85f101a 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -21,7 +21,6 @@ # principal_investigator_email :string # principal_investigator_identifier :string # principal_investigator_phone :string -# slug :string # title :string # visibility :integer default(3), not null # created_at :datetime @@ -36,6 +35,7 @@ # # fk_rails_... (template_id => templates.id) # + class Plan < ActiveRecord::Base include ConditionalUserMailer include ExportablePlan diff --git a/app/models/user.rb b/app/models/user.rb index babd2fd..1fe37cf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -32,9 +32,7 @@ # updated_at :datetime not null # invited_by_id :integer # language_id :integer -# orcid_id :string # org_id :integer -# shibboleth_id :string # # Indexes # diff --git a/db/migrate/20130905073232_remove_slug_from_plans.rb b/db/migrate/20130905073232_remove_slug_from_plans.rb deleted file mode 100644 index a06bdee..0000000 --- a/db/migrate/20130905073232_remove_slug_from_plans.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveSlugFromPlans < ActiveRecord::Migration - def up - remove_column :plans, :slug - end - - def down - add_column :plans, :slug, :string - end -end diff --git a/db/migrate/20170303220255_remove_orcid_id_from_users.rb b/db/migrate/20170303220255_remove_orcid_id_from_users.rb deleted file mode 100644 index 7c71213..0000000 --- a/db/migrate/20170303220255_remove_orcid_id_from_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveOrcidIdFromUsers < ActiveRecord::Migration - def change - #remove_column :users, :orcid_id - end -end diff --git a/db/migrate/20180813114157_remove_logo_file_name_from_orgs.rb b/db/migrate/20180813114157_remove_logo_file_name_from_orgs.rb new file mode 100644 index 0000000..334fdd7 --- /dev/null +++ b/db/migrate/20180813114157_remove_logo_file_name_from_orgs.rb @@ -0,0 +1,11 @@ +class RemoveLogoFileNameFromOrgs < ActiveRecord::Migration + def up + if column_exists?(:orgs, :logo_file_name) + remove_column :orgs, :logo_file_name + end + end + + def down + add_column :orgs, :logo_file_name, :string + end +end diff --git a/db/migrate/20180813114216_remove_parent_id_from_orgs.rb b/db/migrate/20180813114216_remove_parent_id_from_orgs.rb new file mode 100644 index 0000000..118125b --- /dev/null +++ b/db/migrate/20180813114216_remove_parent_id_from_orgs.rb @@ -0,0 +1,11 @@ +class RemoveParentIdFromOrgs < ActiveRecord::Migration + def up + if column_exists?(:orgs, :parent_id) + remove_column :orgs, :parent_id + end + end + + def down + add_column :orgs, :parent_id, :integer + end +end diff --git a/db/migrate/20180813114234_remove_wayfless_entity_from_orgs.rb b/db/migrate/20180813114234_remove_wayfless_entity_from_orgs.rb new file mode 100644 index 0000000..a19bb0c --- /dev/null +++ b/db/migrate/20180813114234_remove_wayfless_entity_from_orgs.rb @@ -0,0 +1,11 @@ +class RemoveWayflessEntityFromOrgs < ActiveRecord::Migration + def up + if column_exists?(:orgs, :wayfless_entity) + remove_column :orgs, :wayfless_entity + end + end + + def down + add_column :orgs, :wayfless_entity, :string + end +end diff --git a/db/migrate/20180813114348_remove_slug_from_phases.rb b/db/migrate/20180813114348_remove_slug_from_phases.rb new file mode 100644 index 0000000..3520ef6 --- /dev/null +++ b/db/migrate/20180813114348_remove_slug_from_phases.rb @@ -0,0 +1,11 @@ +class RemoveSlugFromPhases < ActiveRecord::Migration + def up + if column_exists?(:phases, :slug) + remove_column :phases, :slug + end + end + + def down + add_column :phases, :slug, :string + end +end diff --git a/db/migrate/20180813114525_remove_slug_from_plans.rb b/db/migrate/20180813114525_remove_slug_from_plans.rb new file mode 100644 index 0000000..11ebb04 --- /dev/null +++ b/db/migrate/20180813114525_remove_slug_from_plans.rb @@ -0,0 +1,11 @@ +class RemoveSlugFromPlans < ActiveRecord::Migration + def up + if column_exists?(:plans, :slug) + remove_column :plans, :slug + end + end + + def down + add_column :plans, :slug, :string + end +end diff --git a/db/migrate/20180813114550_drop_table_friendly_id_slugs.rb b/db/migrate/20180813114550_drop_table_friendly_id_slugs.rb new file mode 100644 index 0000000..8d0ab2e --- /dev/null +++ b/db/migrate/20180813114550_drop_table_friendly_id_slugs.rb @@ -0,0 +1,17 @@ +class DropTableFriendlyIdSlugs < ActiveRecord::Migration + def up + drop_table :friendly_id_slugs if table_exists?(:friendly_id_slugs) + end + + def down + create_table :friendly_id_slugs do |t| + t.string :slug, :null => false + t.integer :sluggable_id, :null => false + t.string :sluggable_type, :limit => 40 + t.datetime :created_at + end + add_index :friendly_id_slugs, :sluggable_id + add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true + add_index :friendly_id_slugs, :sluggable_type + end +end diff --git a/db/migrate/20180813114614_drop_table_file_types.rb b/db/migrate/20180813114614_drop_table_file_types.rb new file mode 100644 index 0000000..d0be6f1 --- /dev/null +++ b/db/migrate/20180813114614_drop_table_file_types.rb @@ -0,0 +1,17 @@ +class DropTableFileTypes < ActiveRecord::Migration + + def up + drop_table(:file_types) if table_exists?(:file_types) + end + + def down + create_table "file_types", force: :cascade do |t| + t.string "name" + t.string "icon_name" + t.integer "icon_size" + t.string "icon_location" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end +end diff --git a/db/migrate/20180813114622_drop_table_file_uploads.rb b/db/migrate/20180813114622_drop_table_file_uploads.rb new file mode 100644 index 0000000..efc1f5c --- /dev/null +++ b/db/migrate/20180813114622_drop_table_file_uploads.rb @@ -0,0 +1,19 @@ +class DropTableFileUploads < ActiveRecord::Migration + def up + drop_table(:file_uploads) if table_exists?(:file_uploads) + end + + def down + create_table "file_uploads", force: :cascade do |t| + t.string "name" + t.string "title" + t.text "description" + t.integer "size" + t.boolean "published" + t.string "location" + t.integer "file_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end +end diff --git a/db/migrate/20180813114628_drop_table_splash_logs.rb b/db/migrate/20180813114628_drop_table_splash_logs.rb new file mode 100644 index 0000000..b09cc0b --- /dev/null +++ b/db/migrate/20180813114628_drop_table_splash_logs.rb @@ -0,0 +1,13 @@ +class DropTableSplashLogs < ActiveRecord::Migration + def up + drop_table(:splash_logs) if table_exists?(:splash_logs) + end + + def down + create_table "splash_logs", force: :cascade do |t| + t.string "destination" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end +end diff --git a/db/migrate/20180813114649_remove_banner_text_from_orgs.rb b/db/migrate/20180813114649_remove_banner_text_from_orgs.rb new file mode 100644 index 0000000..315e4b4 --- /dev/null +++ b/db/migrate/20180813114649_remove_banner_text_from_orgs.rb @@ -0,0 +1,9 @@ +class RemoveBannerTextFromOrgs < ActiveRecord::Migration + def up + remove_column :orgs, :banner_text + end + + def down + add_column :orgs, :banner_text, :text + end +end diff --git a/db/migrate/20180813114719_remove_question_id_from_guidances.rb b/db/migrate/20180813114719_remove_question_id_from_guidances.rb new file mode 100644 index 0000000..4849d84 --- /dev/null +++ b/db/migrate/20180813114719_remove_question_id_from_guidances.rb @@ -0,0 +1,9 @@ +class RemoveQuestionIdFromGuidances < ActiveRecord::Migration + def up + remove_column :guidances, :question_id + end + + def down + add_column :guidances, :question_id, :integer + end +end diff --git a/db/migrate/20180813114801_remove_orcid_id_from_users.rb b/db/migrate/20180813114801_remove_orcid_id_from_users.rb new file mode 100644 index 0000000..aa89421 --- /dev/null +++ b/db/migrate/20180813114801_remove_orcid_id_from_users.rb @@ -0,0 +1,9 @@ +class RemoveOrcidIdFromUsers < ActiveRecord::Migration + def up + remove_column :users, :orcid_id + end + + def down + add_column :users, :orcid_id, :string + end +end diff --git a/db/migrate/20180813114813_remove_shibboleth_id_from_users.rb b/db/migrate/20180813114813_remove_shibboleth_id_from_users.rb new file mode 100644 index 0000000..51cd451 --- /dev/null +++ b/db/migrate/20180813114813_remove_shibboleth_id_from_users.rb @@ -0,0 +1,9 @@ +class RemoveShibbolethIdFromUsers < ActiveRecord::Migration + def up + remove_column :users, :shibboleth_id + end + + def down + add_column :users, :shibboleth_id, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 6bf71f9..41ee2bf 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: 20180803105147) do +ActiveRecord::Schema.define(version: 20180813114813) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -56,34 +56,13 @@ t.integer "phase_id" end - create_table "file_types", force: :cascade do |t| - t.string "name" - t.string "icon_name" - t.integer "icon_size" - t.string "icon_location" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "file_uploads", force: :cascade do |t| - t.string "name" - t.string "title" - t.text "description" - t.integer "size" - t.boolean "published" - t.string "location" - t.integer "file_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "guidance_groups", force: :cascade do |t| t.string "name" t.integer "org_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "optional_subset" - t.boolean "published" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "optional_subset", default: false, null: false + t.boolean "published", default: false, null: false end add_index "guidance_groups", ["org_id"], name: "index_guidance_groups_on_org_id", using: :btree @@ -93,7 +72,6 @@ t.integer "guidance_group_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.integer "question_id" t.boolean "published" end @@ -119,7 +97,7 @@ create_table "notes", force: :cascade do |t| t.integer "user_id" t.text "text" - t.boolean "archived" + t.boolean "archived", default: false, null: false t.integer "answer_id" t.integer "archived_by" t.datetime "created_at" @@ -172,14 +150,10 @@ t.string "name" t.string "abbreviation" t.string "target_url" - t.string "wayfless_entity" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.integer "parent_id" - t.boolean "is_other" + t.boolean "is_other", default: false, null: false t.string "sort_name" - t.text "banner_text" - t.string "logo_file_name" t.integer "region_id" t.integer "language_id" t.string "logo_uid" @@ -206,7 +180,6 @@ t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug" t.boolean "modifiable" end @@ -217,7 +190,6 @@ t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug" t.string "grant_number" t.string "identifier" t.text "description" @@ -329,12 +301,6 @@ t.datetime "updated_at", null: false end - create_table "splash_logs", force: :cascade do |t| - t.string "destination" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "templates", force: :cascade do |t| t.string "title" t.text "description" @@ -395,8 +361,6 @@ t.string "firstname" t.string "surname" t.string "email", limit: 80, default: "", null: false - t.string "orcid_id" - t.string "shibboleth_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "encrypted_password", default: "" diff --git a/spec/factories/guidance_groups.rb b/spec/factories/guidance_groups.rb index 82c7b09..627cff7 100644 --- a/spec/factories/guidance_groups.rb +++ b/spec/factories/guidance_groups.rb @@ -4,8 +4,8 @@ # # id :integer not null, primary key # name :string -# optional_subset :boolean -# published :boolean +# optional_subset :boolean default(FALSE), not null +# published :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null # org_id :integer diff --git a/spec/factories/guidances.rb b/spec/factories/guidances.rb index d57c1a0..43a8e68 100644 --- a/spec/factories/guidances.rb +++ b/spec/factories/guidances.rb @@ -8,7 +8,6 @@ # created_at :datetime not null # updated_at :datetime not null # guidance_group_id :integer -# question_id :integer # # Indexes # diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 5aa5919..3fcf2b3 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -3,7 +3,7 @@ # Table name: notes # # id :integer not null, primary key -# archived :boolean +# archived :boolean default(FALSE), not null # archived_by :integer # text :text # created_at :datetime diff --git a/spec/factories/orgs.rb b/spec/factories/orgs.rb index c4477f6..3d19e1b 100644 --- a/spec/factories/orgs.rb +++ b/spec/factories/orgs.rb @@ -4,26 +4,22 @@ # # id :integer not null, primary key # abbreviation :string -# banner_text :text # contact_email :string # contact_name :string # feedback_email_msg :text # feedback_email_subject :string # feedback_enabled :boolean default(FALSE) -# is_other :boolean +# is_other :boolean default(FALSE), not null # links :text -# logo_file_name :string # logo_name :string # logo_uid :string # name :string # org_type :integer default(0), not null # sort_name :string # target_url :string -# wayfless_entity :string # created_at :datetime not null # updated_at :datetime not null # language_id :integer -# parent_id :integer # region_id :integer # # Foreign Keys diff --git a/spec/factories/phases.rb b/spec/factories/phases.rb index 9cb7d85..c51c4f2 100644 --- a/spec/factories/phases.rb +++ b/spec/factories/phases.rb @@ -6,7 +6,6 @@ # description :text # modifiable :boolean # number :integer -# slug :string # title :string # created_at :datetime # updated_at :datetime diff --git a/spec/factories/plans.rb b/spec/factories/plans.rb index bbb922b..c91a105 100644 --- a/spec/factories/plans.rb +++ b/spec/factories/plans.rb @@ -16,7 +16,6 @@ # principal_investigator_email :string # principal_investigator_identifier :string # principal_investigator_phone :string -# slug :string # title :string # visibility :integer default(3), not null # created_at :datetime diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 0f32562..d6cf3dd 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -32,9 +32,7 @@ # updated_at :datetime not null # invited_by_id :integer # language_id :integer -# orcid_id :string # org_id :integer -# shibboleth_id :string # # Indexes #