If I add these database constraints, you can't create 2 statuses (for
example) with the same name (which I think is probably the desired
effect)...so I can change my seeded data to look like:
insert into status (name, description) values ('OFFLINE', 'Server is
Offline. Not active in any configuration.') ON CONFLICT (name) DO NOTHING;
and no more duplicate seeds...
On Tue, Apr 4, 2017 at 1:12 PM, Jeremy Mitchell <[email protected]>
wrote:
> I have moved all Traffic Ops seed data into ONE place -
> https://github.com/apache/incubator-trafficcontrol/blob/
> master/traffic_ops/app/db/seeds.sql
>
> (there used to be some in seeds.sql and others in
> traffic_ops/install/data/json)
>
> Anyhow, if you run seeds.sql multiple times (i.e. db/admin.pl upgrade),
> you'll end up with duplicate data as some tables don't have unique
> constraints.
>
> I'd like to add unique constraints to the following database table /
> columns:
>
> - role.name
> - status.name
> - type.name
> - job_status.name
>
> In my opinion, these constraints should have been in there since day 1 but
> if you have any objections, let me know.
>
> Thanks,
>
> Jeremy
>
>
>