Skip to content
  • eileencodes's avatar
    059d64b8
    Add support for setting the schema/structure dump filepath in the config · 059d64b8
    eileencodes authored
    Previously Rails would generate your schema/structure dump based on the
    database config name. As noted on the forum in
    https://discuss.rubyonrails.org/t/horizontal-sharding-schema-management/78621/6
    
    
    this is problematic if you want to your shards to share the same schema
    dump file.
    
    This is also useful for applications that might have already written a
    custom solution for setting the schema dump filename and want to use
    something upstream. We allow setting the path for the schema cache, why
    not the schema dump too?
    
    To do this I deprecated the old schema_file database task in favor for a
    new one that passes the `db_config`. The code to derive the filename
    from the db_config has been duplicated there and will be the correct way
    to determine filename in the future. Since these values are set on the
    config they should be accessible in the config as well.
    
    I did not need to deprecate the behavior of schema_dump because it has
    not been included in any release yet (other than the alpha). However the
    behavior is the same for false/nil.
    
    Closes #43173
    Supercedes #43240
    
    Co-authored-by: default avatarRyan Kerr <leboshi@gmail.com>
    059d64b8
    Add support for setting the schema/structure dump filepath in the config
    eileencodes authored
    Previously Rails would generate your schema/structure dump based on the
    database config name. As noted on the forum in
    https://discuss.rubyonrails.org/t/horizontal-sharding-schema-management/78621/6
    
    
    this is problematic if you want to your shards to share the same schema
    dump file.
    
    This is also useful for applications that might have already written a
    custom solution for setting the schema dump filename and want to use
    something upstream. We allow setting the path for the schema cache, why
    not the schema dump too?
    
    To do this I deprecated the old schema_file database task in favor for a
    new one that passes the `db_config`. The code to derive the filename
    from the db_config has been duplicated there and will be the correct way
    to determine filename in the future. Since these values are set on the
    config they should be accessible in the config as well.
    
    I did not need to deprecate the behavior of schema_dump because it has
    not been included in any release yet (other than the alpha). However the
    behavior is the same for false/nil.
    
    Closes #43173
    Supercedes #43240
    
    Co-authored-by: default avatarRyan Kerr <leboshi@gmail.com>
Loading