Skip to content
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

Let ActiveRecord sort out proper limit #82

Closed
wants to merge 1 commit into from

Conversation

crdunwel
Copy link
Contributor

See #81 for details.

@crdunwel
Copy link
Contributor Author

Any thing preventing this from being merged?

@TheNotary
Copy link
Contributor

Hi crdunwel,

First, thanks for the PR! The primary maintainer for this app is passing that obligation over to me, but I'm not fully read up on the material to make autonomous changes.

From my standpoint, all of those limit definitions that show up in the schema.rb seem random. I don't know some are needed now, or if any of them were ever deliberate in the first place. Regardless of why, we should at the very least justify their existence in the db/migrate as a matter of etiquette. That said I see two path's forward:

a) Completely rebuild the schema.rb using rake db:migrate after dropping the database on a dev machine
OR
b) Add a migration script to add those limit definitions to the database where desirable, and then rebuild the schema.rb using padrino rake ar:migrate

Does that sound reasonable, and are you in a position to give it a try? Be careful with any important data you may lose in your db, of course :)

@crdunwel
Copy link
Contributor Author

Sorry, my lack of familiarity with padrino and active record is showing. I believe that the issue may be that the dev setup script is loading the versioned schema file without generating the adapter-specific schema from scratch as intended. The schema file generated with the postgresql adapter looks a bit different and may be incompatible with mysql, but, aside from limit on boolean fields, postgresql doesn't have any issues with the mysql generated schema.

I can create a migration file to remove the limit, but anybody rolling back with postgres will likely get a syntax error in the SQL. The schema can be built from scratch so this isn't a huge issue but it does cause an extra step in setting up a development environment with vagrant / docker. Really not a huge deal in any case. Perhaps altering the setup scripts to rebuild the schema from scratch may be a better alternative?

@Hainish
Copy link
Member

Hainish commented Mar 4, 2016

@crdunwel I'm confused what you mean by "rebuild the schema from scratch" since that seems to be what it's already doing with the ar:schema:load...

I'm fine with removing the limits generally, not really sure why they're there in the first place. Maybe it's padrino's way to by default have limits when add_column is issued or something. I'm fine with merging this, and can get to it tomorrow

@crdunwel
Copy link
Contributor Author

crdunwel commented Mar 4, 2016

@Hainish Yeah looking back I may have missed a step in creating the schema from scratch. Probably somewhere between setting up locally with setup_dev.sh and production using PostgreSQL. Sorry for trouble y'all!

@crdunwel crdunwel closed this Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants