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

[Idea] Support custom checks on TableDefinition methods #263

Open
cthomas-figma opened this issue Apr 23, 2024 · 0 comments
Open

[Idea] Support custom checks on TableDefinition methods #263

cthomas-figma opened this issue Apr 23, 2024 · 0 comments

Comments

@cthomas-figma
Copy link

I'd like to propose adding general support for custom checks on TableDefinition methods ex. column or references

This was proposed in #170 as a mechanism to check for foreign key creations in TableDefinitions and was closed since creating foreign keys on an empty table is not a dangerous operaiton. My motivation for TableDefinition is different. I'd like to broadly restrict the schema that can be created via custom checks on TableDefinition. For example, at Figma we require folks to use bigint rather than integer columns to avoid overflow bugs. The below migration would not be allowed to run since it creates a new table with an integer column.

create_table(:photos) do |t|
  t.integer :like_count
  t.references :photographer, null: false, foreign_key: true, type: :uuid
end

Also full disclosure, I'm somewhat new to the ruby/rails ecosystem so please let me know if the "restrict the schema" problem would be better solved by a different tool.

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

No branches or pull requests

1 participant