forked from MarseyWorld/MarseyWorld
dedup table rows
parent
b8938f6c13
commit
906d51cfb9
|
@ -27,10 +27,9 @@ class Media(Base):
|
|||
|
||||
class MediaUsage(Base):
|
||||
__tablename__ = "media_usages"
|
||||
id = Column(Integer, primary_key=True)
|
||||
filename = Column(String, ForeignKey("media.filename"))
|
||||
post_id = Column(Integer, ForeignKey("posts.id"))
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
filename = Column(String, ForeignKey("media.filename"), primary_key=True)
|
||||
post_id = Column(Integer, ForeignKey("posts.id"), primary_key=True)
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||
created_utc = Column(Integer)
|
||||
deleted_utc = Column(Integer)
|
||||
removed_utc = Column(Integer)
|
||||
|
|
|
@ -16,6 +16,9 @@ CREATE SEQUENCE public.media_usages_id_seq
|
|||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
ALTER TABLE ONLY public.media_usages
|
||||
ADD CONSTRAINT group_media_usages_pkey PRIMARY KEY (filename, post_id, comment_id);
|
||||
|
||||
ALTER SEQUENCE public.media_usages_id_seq OWNED BY public.media_usages.id;
|
||||
|
||||
ALTER TABLE ONLY public.media_usages ALTER COLUMN id SET DEFAULT nextval('public.media_usages_id_seq'::regclass);
|
||||
|
|
Loading…
Reference in New Issue