From 25febba9be5c4f731d2ffadfd336f377fea53c42 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 13 Mar 2023 01:53:49 +0000 Subject: [PATCH 1/2] Add missing migration for #3247 --- ...te_active_storage_tables.active_storage.rb | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 db/migrate/20230313015323_create_active_storage_tables.active_storage.rb diff --git a/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb b/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb new file mode 100644 index 000000000..8a7bfe189 --- /dev/null +++ b/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb @@ -0,0 +1,57 @@ +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[5.2] + def change + # Use Active Record's configured type for primary and foreign keys + primary_key_type, foreign_key_type = primary_and_foreign_key_types + + create_table :active_storage_blobs, id: primary_key_type do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.string :service_name, null: false + t.bigint :byte_size, null: false + t.string :checksum + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :key ], unique: true + end + + create_table :active_storage_attachments, id: primary_key_type do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type + t.references :blob, null: false, type: foreign_key_type + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + + create_table :active_storage_variant_records, id: primary_key_type do |t| + t.belongs_to :blob, null: false, index: false, type: foreign_key_type + t.string :variation_digest, null: false + + t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + def primary_and_foreign_key_types + config = Rails.configuration.generators + setting = config.options[config.orm][:primary_key_type] + primary_key_type = setting || :primary_key + foreign_key_type = setting || :bigint + [primary_key_type, foreign_key_type] + end +end From 9f6fe4d7d88ff23e63ed630a0d243031370d3d5b Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 13 Mar 2023 02:00:46 +0000 Subject: [PATCH 2/2] Fix #3247 broken links --- README.md | 3 +-- app/views/crops/_form.html.haml | 2 +- spec/views/crops/new.html.haml_spec.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bb9ab076a..ff17178d2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ encourage participation from people of all backgrounds and skill levels. * [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're working on, known bugs, etc) * [![Gitter](https://badges.gitter.im/Growstuff/growstuff.svg)](https://gitter.im/Growstuff/growstuff?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org)) +* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc.) ## For coders @@ -29,7 +29,6 @@ frontend features. We welcome contributions -- see [CONTRIBUTING](CONTRIBUTING.md) for details. * To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide). -* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers. * You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API). ## For designers, writers, researchers, data wranglers, and other contributors diff --git a/app/views/crops/_form.html.haml b/app/views/crops/_form.html.haml index 2ef58f243..dcf451e6a 100644 --- a/app/views/crops/_form.html.haml +++ b/app/views/crops/_form.html.haml @@ -19,7 +19,7 @@ %p %span.help-block For detailed crop wrangling guidelines, please consult the - = link_to "crop wrangling guide", "http://wiki.growstuff.org/index.php/Crop_wrangling" + = link_to "crop wrangling guide", "https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling" on the Growstuff wiki. -# Everyone (wranglers and requesters) sees the basic info section diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index 95dfc5db0..eeee051b9 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -16,6 +16,6 @@ describe "crops/new" do end it "shows a link to crop wrangling guidelines" do - assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide" + assert_select "a[href^='https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling']", "crop wrangling guide" end end