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

Set section to nullable on attributes #1259

Merged

Conversation

netzknecht
Copy link
Contributor

The table column section should be nullable, because it is not a required column e.G. model property. I think, it's only relevant if the hub is used but not required, too. Currently, it has to be set to nonsense or [space] string.

https://docs.lunarphp.io/core/reference/attributes.html#attributes-1

Field Description
section An optional name to define where an attribute should be used.

@vercel
Copy link

vercel bot commented Sep 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 28, 2023 7:55am

@netzknecht netzknecht changed the title set section to nullable on attributes Set section to nullable on attributes Sep 21, 2023
@netzknecht netzknecht force-pushed the fix-set-section-to-nullable-on-attributes branch 2 times, most recently from 0442b91 to 67ae8d1 Compare September 21, 2023 14:28
@netzknecht netzknecht force-pushed the fix-set-section-to-nullable-on-attributes branch from 67ae8d1 to d4bb121 Compare September 22, 2023 09:06
@alecritson
Copy link
Collaborator

@netzknecht
Copy link
Contributor Author

Done. That was a good example of why testing is so important. Obviously there is no such thing here and I'm currently only working with the core package.

@netzknecht
Copy link
Contributor Author

Hi @alecritson, would it be possible to merge this pull request or should I add a test for core and admin first?

I've also discovered some more sensible but missing default values for some database field definitions like "boolean" values. If I create migrations for it, should I separate them per schema or is it okay for you, to collect them into one file? At some point it will be time to squash migrations anyway.

Copy link
Collaborator

@alecritson alecritson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @netzknecht Will get this merged in and ready to go. If you feel like the changes proposed are all related to each other, a single PR should be fine :)

@alecritson alecritson merged commit ecb29f1 into lunarphp:0.6 Sep 29, 2023
12 checks passed
Comment on lines +16 to +21
public function down()
{
Schema::table($this->prefix.'attributes', function ($table) {
$table->string('section')->nullable(false)->change();
});
}
Copy link
Contributor

@wychoong wychoong Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alecritson this probably shouldn't be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I can skip something like that if desired? Principle, migrations should also be reversible. Couldn't find any code relating to that column/property, is there any future plan for it? If not, we can simple drop the column.

@netzknecht netzknecht deleted the fix-set-section-to-nullable-on-attributes branch October 16, 2023 07:56
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