-
Notifications
You must be signed in to change notification settings - Fork 88
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
Can't have a number or underscore in the column name #449
Comments
This issue is probably connected or the real issue behind #448 |
Seems underscore ( |
I would like to know the status and if someone could help out fixing this. I can fix it if I get pointed in the correct direction (file) where the issue might be. |
So Granite does underscore column names when they are words and not numbers, I think this issue is focusing on the name ending with a number. And that should be supported, it makes total sense. It's a common enough pattern, and numbers being present in column names is no big deal. |
I wasn't able to recreate this using Granite version 0.23.2. @confact is this still an issue? Here's the full script I used to try to recreate: require "sqlite3"
Granite::Connections << Granite::Adapter::Sqlite.new(name: "test", url: "sqlite3:./db.sqlite3")
require "granite"
require "granite/adapter/sqlite"
class User < Granite::Base
connection test
table users
column id : Int32, primary: true
column phone1 : String? = ""
column first_name : String? = ""
column last_name : String? = ""
column email : String? = ""
end
User.migrator.drop_and_create
user = User.create(phone1: "23", first_name: "a", last_name: "5", email: "5")
puts User.find!(user.id).to_h
# => {"id" => 1, "phone1" => "23", "first_name" => "a", "last_name" => "5", "email" => "5"} |
@stufro I'm not able to reproduce either. I had forgotten about this issue and I have an app in production with a column name with a number and column names with an underscore and everything works fine. I'm using Postgres not SQLite. I'm going to close this because this appears to be resolved. |
I have a model with the column name
phone1
from an old rails app.When I added
column phone1 : String? = ""
All columns are set to the default value, and it will not get all the data from DB.Model:
Log when phone1 is commented
When I uncomment phone1 column:
If I move the phone1 column lower down in the model, the columns above will work fine. So I think it is some serialize issue or macro issue.
The text was updated successfully, but these errors were encountered: