gobuffalo/buffalo

Legacy Database

Closed this issue · 4 comments

I thought I saw somewhere in the docs how to deal with an non-uuid primary key? Is there a best practice for this?
Question 2. Is there a way using resources to not include updated/created dates? I guess I can just delete from the migration, but just wondering if there is a way to put that on the cli?

sio4 commented

(I think this is more likely a question instead of an issue)

First, I think this page could be the page you remember: https://gobuffalo.io/en/docs/db/models

Especially the following section is helpful when dealing with legacy/existing database tables that cannot be modified with my own will:

The first link for "UNIX Timestamps" explains how pop works for Datatime fields, and you can find the behavior here:
https://github.com/gobuffalo/pop/blob/4c1da2d172cafe8687aeb0c5dcd7a43fe62a08ad/model.go#L192-L207

Basically, I am not sure if the migration is the matter here since my idea about this kind of customization is that it is required when I dealing with existing tables which is not compatible with Buffalo/Pop's way, but models/MODEL.go is more important for customizing.

Personally, I have used integer ID before for newly created tables when the contents of the tables are actually not new but mirrored data from an existing system. In this case, migration also matters and I used predefined IDs instead of automated IDs.

It all depends on your needs, and they are mostly customizable with models. (buffalo CLI's role is scaffolding, I guess customizing is another area.)

Thanks for the comments. I guess I'm confused then. The model docs don't really describe what I'm talking about.

I was using the resources feature and that may have been the issue. I'll look at it later developing everything with other tools.

I am taking notes, to hopefully help write better docs. The whole database section is confusing with different programs (i.e. pop, soda, fizz), which is preferred and the whole, if you use buffalo, you don't need to call them directly.

As I mentioned in another issue, I'm a go novice, but I've been programming for 40 years so the concepts are similar.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.