lux
lux copied to clipboard
how to set uuid as model primary?
Hey, thank you for using Lux!
Unfortunately, the way id's are resolved from route params only work for integers in the current version. This is an issue we're planning to resolve soon (hopefully) in the next release. After we fix the dynamic route parameter bug, all you will have to do is change your Model
's migration file found in the db/migrate
to use a uuid instead of an auto incrementing int. I have included an example below.
export function up(schema) {
return schema.createTable('posts', table => {
table.uuid('id').primary(); // replaces table.increments('id');
});
}
export function down(schema) {
return schema.dropTable('posts');
}
Let me know if you have any more questions! 😃
@zacharygolba Do you think this will land for 1.0.0?
@seawatts It's possible but may be an after 1.0
fix
@zacharygolba fair enough =)