lux icon indicating copy to clipboard operation
lux copied to clipboard

how to set uuid as model primary?

Open guodong opened this issue 8 years ago • 4 comments

guodong avatar Aug 18 '16 06:08 guodong

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 avatar Aug 24 '16 00:08 zacharygolba

@zacharygolba Do you think this will land for 1.0.0?

seawatts avatar Oct 12 '16 17:10 seawatts

@seawatts It's possible but may be an after 1.0 fix

zacharygolba avatar Oct 12 '16 19:10 zacharygolba

@zacharygolba fair enough =)

seawatts avatar Oct 12 '16 20:10 seawatts