Remove unnessesary id columns from relation tables.
This commit is contained in:
parent
8ef1f0820a
commit
31c5823464
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on
|
The format is based on
|
||||||
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
* Removed unnessesary id columns from relation tables.
|
||||||
|
|
||||||
|
|
||||||
## Release 0.12.0 (2023-02-26)
|
## Release 0.12.0 (2023-02-26)
|
||||||
|
|
||||||
* Database access is now async (PR #10).
|
* Database access is now async (PR #10).
|
||||||
|
6
migrations/2023-02-26-185729_drop-extra-ids/down.sql
Normal file
6
migrations/2023-02-26-185729_drop-extra-ids/down.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
alter table photo_tags drop constraint photo_tags_pkey;
|
||||||
|
alter table photo_tags add column id serial primary key;
|
||||||
|
alter table photo_people drop constraint photo_people_pkey;
|
||||||
|
alter table photo_people add column id serial primary key;
|
||||||
|
alter table photo_places drop constraint photo_places_pkey;
|
||||||
|
alter table photo_places add column id serial primary key;
|
8
migrations/2023-02-26-185729_drop-extra-ids/up.sql
Normal file
8
migrations/2023-02-26-185729_drop-extra-ids/up.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
alter table photo_tags drop column id;
|
||||||
|
alter table photo_tags add primary key (photo_id, tag_id);
|
||||||
|
|
||||||
|
alter table photo_people drop column id;
|
||||||
|
alter table photo_people add primary key (photo_id, person_id);
|
||||||
|
|
||||||
|
alter table photo_places drop column id;
|
||||||
|
alter table photo_places add primary key (photo_id, place_id);
|
@ -329,7 +329,6 @@ impl Facet for Person {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Queryable)]
|
#[derive(Debug, Clone, Queryable)]
|
||||||
pub struct PhotoPerson {
|
pub struct PhotoPerson {
|
||||||
pub id: i32,
|
|
||||||
pub photo_id: i32,
|
pub photo_id: i32,
|
||||||
pub person_id: i32,
|
pub person_id: i32,
|
||||||
}
|
}
|
||||||
@ -355,7 +354,6 @@ impl Facet for Place {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Queryable)]
|
#[derive(Debug, Clone, Queryable)]
|
||||||
pub struct PhotoPlace {
|
pub struct PhotoPlace {
|
||||||
pub id: i32,
|
|
||||||
pub photo_id: i32,
|
pub photo_id: i32,
|
||||||
pub place_id: i32,
|
pub place_id: i32,
|
||||||
}
|
}
|
||||||
|
@ -22,24 +22,21 @@ table! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
photo_people (id) {
|
photo_people (photo_id, person_id) {
|
||||||
id -> Int4,
|
|
||||||
photo_id -> Int4,
|
photo_id -> Int4,
|
||||||
person_id -> Int4,
|
person_id -> Int4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
photo_places (id) {
|
photo_places (photo_id, place_id) {
|
||||||
id -> Int4,
|
|
||||||
photo_id -> Int4,
|
photo_id -> Int4,
|
||||||
place_id -> Int4,
|
place_id -> Int4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
photo_tags (id) {
|
photo_tags (photo_id, tag_id) {
|
||||||
id -> Int4,
|
|
||||||
photo_id -> Int4,
|
photo_id -> Int4,
|
||||||
tag_id -> Int4,
|
tag_id -> Int4,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user