From 1753cb1279530281b411e13633709d87c20c7695 Mon Sep 17 00:00:00 2001 From: ConnorSheremeta Date: Wed, 10 Jun 2020 14:56:21 -0600 Subject: [PATCH] Beef up AR migrations with null:false --- CHANGELOG.md | 3 +++ db/migrate/20190806193807_add_ar_community.rb | 2 +- db/migrate/20190806193857_add_ar_collection.rb | 2 +- db/migrate/20190815215625_create_ar_item.rb | 6 +++--- db/migrate/20190822183423_create_ar_thesis.rb | 6 +++--- db/schema.rb | 16 ++++++++-------- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 962859302..289947cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and releases in Jupiter project adheres to [Semantic Versioning](http://semver.o ## [Unreleased] +### Changed +- Beefed up AR migrations by stating that certain attributes cannot be null [PR#1704](https://github.com/ualbertalib/jupiter/pull/1704) + ## [1.2.17] - 2019-09-24 ### Security diff --git a/db/migrate/20190806193807_add_ar_community.rb b/db/migrate/20190806193807_add_ar_community.rb index 51694bdd0..bb80316e9 100644 --- a/db/migrate/20190806193807_add_ar_community.rb +++ b/db/migrate/20190806193807_add_ar_community.rb @@ -8,7 +8,7 @@ def change t.datetime :record_created_at t.string :hydra_noid t.datetime :date_ingested - t.string :title + t.string :title, null: false t.string :fedora3_uuid t.string :depositor t.text :description diff --git a/db/migrate/20190806193857_add_ar_collection.rb b/db/migrate/20190806193857_add_ar_collection.rb index eadd924a9..58e81f29c 100644 --- a/db/migrate/20190806193857_add_ar_collection.rb +++ b/db/migrate/20190806193857_add_ar_collection.rb @@ -6,7 +6,7 @@ def change t.datetime :record_created_at t.string :hydra_noid t.datetime :date_ingested - t.string :title + t.string :title, null: false t.string :fedora3_uuid t.string :depositor t.uuid :community_id diff --git a/db/migrate/20190815215625_create_ar_item.rb b/db/migrate/20190815215625_create_ar_item.rb index d94daaed6..494dcb300 100644 --- a/db/migrate/20190815215625_create_ar_item.rb +++ b/db/migrate/20190815215625_create_ar_item.rb @@ -5,8 +5,8 @@ def change t.references :owner, null: false, index: true, foreign_key: {to_table: :users, column: :id} t.datetime :record_created_at t.string :hydra_noid - t.datetime :date_ingested - t.string :title + t.datetime :date_ingested, null: false + t.string :title, null: false t.string :fedora3_uuid t.string :depositor t.string :alternative_title @@ -21,7 +21,7 @@ def change t.integer :sort_year t.json :embargo_history, array: true t.json :is_version_of, array: true - t.json :member_of_paths, array: true + t.json :member_of_paths, null: false, array: true t.json :subject, array: true t.json :creators, array: true t.json :contributors, array: true diff --git a/db/migrate/20190822183423_create_ar_thesis.rb b/db/migrate/20190822183423_create_ar_thesis.rb index 03a18bef9..cff60a658 100644 --- a/db/migrate/20190822183423_create_ar_thesis.rb +++ b/db/migrate/20190822183423_create_ar_thesis.rb @@ -5,8 +5,8 @@ def change t.references :owner, null: false, index: true, foreign_key: {to_table: :users, column: :id} t.datetime :record_created_at t.string :hydra_noid - t.datetime :date_ingested - t.string :title + t.datetime :date_ingested, null: false + t.string :title, null: false t.string :fedora3_uuid t.string :depositor t.string :alternative_title @@ -22,7 +22,7 @@ def change t.json :embargo_history, array: true t.json :is_version_of, array: true - t.json :member_of_paths, array: true + t.json :member_of_paths, null: false, array: true t.json :subject, array: true t.text :abstract diff --git a/db/schema.rb b/db/schema.rb index f1376cd3d..b35cfa915 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -55,7 +55,7 @@ t.datetime "record_created_at" t.string "hydra_noid" t.datetime "date_ingested" - t.string "title" + t.string "title", null: false t.string "fedora3_uuid" t.string "depositor" t.uuid "community_id" @@ -73,7 +73,7 @@ t.datetime "record_created_at" t.string "hydra_noid" t.datetime "date_ingested" - t.string "title" + t.string "title", null: false t.string "fedora3_uuid" t.string "depositor" t.text "description" @@ -88,8 +88,8 @@ t.bigint "owner_id", null: false t.datetime "record_created_at" t.string "hydra_noid" - t.datetime "date_ingested" - t.string "title" + t.datetime "date_ingested", null: false + t.string "title", null: false t.string "fedora3_uuid" t.string "depositor" t.string "alternative_title" @@ -104,7 +104,7 @@ t.integer "sort_year" t.json "embargo_history", array: true t.json "is_version_of", array: true - t.json "member_of_paths", array: true + t.json "member_of_paths", null: false, array: true t.json "subject", array: true t.json "creators", array: true t.json "contributors", array: true @@ -132,8 +132,8 @@ t.bigint "owner_id", null: false t.datetime "record_created_at" t.string "hydra_noid" - t.datetime "date_ingested" - t.string "title" + t.datetime "date_ingested", null: false + t.string "title", null: false t.string "fedora3_uuid" t.string "depositor" t.string "alternative_title" @@ -148,7 +148,7 @@ t.integer "sort_year" t.json "embargo_history", array: true t.json "is_version_of", array: true - t.json "member_of_paths", array: true + t.json "member_of_paths", null: false, array: true t.json "subject", array: true t.text "abstract" t.string "language"