# HG changeset patch
# User Adnan Maolood <me@adnano.co>
# Date 1650481164 14400
# Wed Apr 20 14:59:24 2022 -0400
# Node ID efc51c7552bad58f1c8db44244a12e4c79e7daf3
# Parent d1deba49befaadf6c48b68b7b0cc5940e16fe7d7
Drop source_repo_id and upstream_uri from repository
These columns are not used.
diff --git a/api/graph/model/repository.go b/api/graph/model/repository.go
--- a/api/graph/model/repository.go
+++ b/api/graph/model/repository.go
@@ -21,7 +21,6 @@
Updated time.Time `json:"updated"`
Name string `json:"name"`
Description *string `json:"description"`
- UpstreamURL *string `json:"upstreamUrl"`
Readme *string `json:"readme"`
NonPublishing bool `json:"nonPublishing"`
@@ -100,7 +99,6 @@
{"name", "name", &r.Name},
{"description", "description", &r.Description},
{"visibility", "visibility", &r.Visibility},
- {"upstream_uri", "upstreamUrl", &r.UpstreamURL},
{"readme", "readme", &r.Readme},
{"is_non_publishing", "nonPublishing", &r.NonPublishing},
diff --git a/api/graph/schema.graphqls b/api/graph/schema.graphqls
--- a/api/graph/schema.graphqls
+++ b/api/graph/schema.graphqls
@@ -118,12 +118,6 @@
"""
readme: String
- """
- If this repository was cloned from another, this is set to the original
- clone URL.
- """
- upstreamUrl: String
-
"Whether or not this repository is a non-publishing repository."
nonPublishing: Boolean!
diff --git a/hgsrht/alembic/versions/bb87b52896ac_drop_source_repo_id_from_repository.py b/hgsrht/alembic/versions/bb87b52896ac_drop_source_repo_id_from_repository.py
new file mode 100644
--- /dev/null
+++ b/hgsrht/alembic/versions/bb87b52896ac_drop_source_repo_id_from_repository.py
@@ -0,0 +1,32 @@
+"""Drop source_repo_id from repository
+
+Revision ID: bb87b52896ac
+Revises: 2d15ed918bbc
+Create Date: 2022-04-20 14:48:06.941109
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'bb87b52896ac'
+down_revision = '2d15ed918bbc'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ op.execute("""
+ ALTER TABLE repository
+ DROP COLUMN upstream_uri;
+ ALTER TABLE repository
+ DROP COLUMN source_repo_id;
+ """)
+
+
+def downgrade():
+ op.execute("""
+ ALTER TABLE repository
+ ADD COLUMN upstream_uri varchar;
+ ALTER TABLE repository
+ ADD COLUMN source_repo_id integer;
+ """)
diff --git a/hgsrht/types/__init__.py b/hgsrht/types/__init__.py
--- a/hgsrht/types/__init__.py
+++ b/hgsrht/types/__init__.py
@@ -115,9 +115,6 @@
readme = sa.Column(sa.Unicode)
is_non_publishing = sa.Column(sa.Boolean, nullable=False, default=False)
- upstream_uri = sa.Column(sa.Unicode)
- "If non-null, this is the URI from which this repo was originally cloned."
-
@declared_attr
def owner_id(cls):
return sa.Column(sa.Integer, sa.ForeignKey('user.id'), nullable=False)
@@ -126,16 +123,6 @@
def owner(cls):
return sa.orm.relationship('User', backref=sa.orm.backref('repos'))
- @declared_attr
- def source_repo_id(cls):
- """If non-null, this is the Repository from which this repo was originally
- cloned."""
- return sa.Column(sa.Integer, sa.ForeignKey('repository.id'))
-
- @declared_attr
- def source_repo(cls):
- return sa.orm.relationship('Repository', foreign_keys=[cls.source_repo_id])
-
def to_dict(self):
return {
"id": self.id,
Apr 30, 2022 8:34:20 PM Ludovic Chabant <ludovic@chabant.com>:
> Since this stuff is already there, would it be worth it to implement
> the
> cloning + upstream URI feature on hgsrht?
For git.sr.ht, these fields are not used for cloning. Instead, that
information is stored in the repository by git.
> For git.sr.ht, these fields are not used for cloning. Instead, that
> information is stored in the repository by git.
Right, thanks. Merged as 6584a267226c