deploy: Migrations no longer run successfully from scratch since rails 8.1.
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2
- Forks
- 5
- Avg merge
- 42m
- Merged PRs (30d)
- 1
Description
On an empty mariadb 11.8 database, tap won't start with this error:
tap_1 | database: tap
tap_1 | Current version: 0
tap_1 |
tap_1 | bin/rails aborted!
tap_1 | ActiveRecord::MismatchedForeignKey: Column `product_id` on table `barcodes` does not match column `id` on `products`, which has type `bigint(20)`. To resolve this issue, change the type of the `product_id` column on `barcodes` to be :bigint. (For example `t.bigint :product_id`). (ActiveRecord::MismatchedForeignKey)
tap_1 | Original message: Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed")
tap_1 | /tap/db/schema.rb:90:in 'block in <main>'
tap_1 | /tap/db/schema.rb:13:in '<main>'
tap_1 |
tap_1 | Caused by:
tap_1 | ActiveRecord::MismatchedForeignKey: There is a mismatch between the foreign key and primary key column types. Verify that the foreign key column type and the primary key of the associated table match types. (ActiveRecord::MismatchedForeignKey)
tap_1 | Original message: Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed")
tap_1 | /tap/db/schema.rb:90:in 'block in <main>'
tap_1 | /tap/db/schema.rb:13:in '<main>'
tap_1 |
tap_1 | Caused by:
tap_1 | Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed") (Mysql2::Error)
tap_1 | /tap/db/schema.rb:90:in 'block in <main>'
tap_1 | /tap/db/schema.rb:13:in '<main>'
tap_1 | Tasks: TOP => db:prepare
tap_1 | (See full trace by running task with --trace)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with an empty MariaDB 11.8 database and Rails db:prepare, then inspect db/schema.rb around line 90 where the barcodes foreign key is created. Confirm that the product_id and products.id column types match, and consider the issue done when the schema can be created successfully from scratch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, rails, ruby
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100