-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column default incorrectly showing as NULL
#935
Comments
Strangely, if I run
# == Schema Information
#
# Table name: identities
#
# id :uuid not null, primary key
# callback_url :text not null
# state :text default("pending_review"), not null
#
class Identity < ApplicationRecord Further, if I edit the migration to have any default string other than This makes no sense to me... |
Oh damn... I think it's related to #768 or #677 or something in those code paths, but that at least allowed me to fix it. The issue was that an |
Related: #839 This is VERY surprising behaviour. I expected this to be documenting the database schema and its defaults, not mapping to/from application-level values (which in my case are the same as my enum is |
I have two models, both with a
state
field, both with a default value.annotate_models
correctly reflected the default for both, until I ran a migration withchange_column :table, :col, :type, default: 'new-default'
. Now, the changed default is documented asdefault(NULL), not null
(which doesn't even make sense) and I can't get it to show the correct default anymore, even after tearing down DB and re-running all migrations.This is a pretty brand new app, undeployed, not even any controllers yet... I have no theory for how/why this is happening.
Migration:
psql
of both tables:The comments generated since running the migration:
Commands
The default is incorrect (and overwrites manual corrections) both when running a post-migration rake hook and when running
bundle exec annotate
directly.Version
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [aarch64-linux-musl]
annotate
3.2.0The text was updated successfully, but these errors were encountered: