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

Inconsistent datatype of number product attributes in database #1969

Open
ken717w opened this issue Sep 26, 2024 · 0 comments · May be fixed by #1970
Open

Inconsistent datatype of number product attributes in database #1969

ken717w opened this issue Sep 26, 2024 · 0 comments · May be fixed by #1970
Labels
bug Something isn't working unconfirmed

Comments

@ken717w
Copy link

ken717w commented Sep 26, 2024

  • Lunar version: 1.0.0-beta.2
  • Laravel Version: 11.22.0
  • PHP Version: 8.3.11
  • Database Driver & Version: MySQL 8.0.32

Expected Behaviour:

Running SQL query SELECT JSON_EXTRACT(attribute_data, '$.my_number_field') AS my_number_field FROM lunar_products; should show my_number_field in integers.

Actual Behaviour:

For new products which I didn't change any of the attributes the above query gives:

{
	"value": 0,
	"field_type": "Lunar\\FieldTypes\\Number"
}

While if I've changed my_number_field to 1, the query gives:

{
	"value": "1",
	"field_type": "Lunar\\FieldTypes\\Number"
}

If I change it back to 0, the query gives:

{
	"value": "0",
	"field_type": "Lunar\\FieldTypes\\Number"
}

Steps To Reproduce:

  1. Create a product attribute of type Lunar\FieldTypes\Number
  2. Create 2 products, and update this attribute in one of them
  3. Run the SQL query above
@ken717w ken717w added bug Something isn't working unconfirmed labels Sep 26, 2024
@ken717w ken717w linked a pull request Sep 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant