Big database migration refactor
This commit is contained in:
parent
28ba3c6c38
commit
8df6ebd2e7
|
@ -93,7 +93,7 @@ def reimport_packages():
|
|||
@action("Import forum topic list")
|
||||
def import_topic_list():
|
||||
task = importTopicList.delay()
|
||||
return redirect(url_for("tasks.check", id=task.id, r=url_for("todo.topics")))
|
||||
return redirect(url_for("tasks.check", id=task.id, r=url_for("admin.admin_page")))
|
||||
|
||||
@action("Import appstream from flathub")
|
||||
def import_from_flathub():
|
||||
|
|
|
@ -22,42 +22,42 @@ from wtforms.validators import InputRequired, Length
|
|||
|
||||
from app.utils import rank_required
|
||||
from . import bp
|
||||
from ...models import UserRank, MinetestRelease, db
|
||||
from ...models import UserRank, db
|
||||
|
||||
|
||||
@bp.route("/versions/")
|
||||
@rank_required(UserRank.MODERATOR)
|
||||
def version_list():
|
||||
return render_template("admin/versions/list.html", versions=MinetestRelease.query.order_by(db.asc(MinetestRelease.id)).all())
|
||||
# @bp.route("/versions/")
|
||||
# @rank_required(UserRank.MODERATOR)
|
||||
# def version_list():
|
||||
# return render_template("admin/versions/list.html", versions=MinetestRelease.query.order_by(db.asc(MinetestRelease.id)).all())
|
||||
|
||||
|
||||
class VersionForm(FlaskForm):
|
||||
name = StringField("Name", [InputRequired(), Length(3, 100)])
|
||||
protocol = IntegerField("Protocol")
|
||||
submit = SubmitField("Save")
|
||||
# class VersionForm(FlaskForm):
|
||||
# name = StringField("Name", [InputRequired(), Length(3, 100)])
|
||||
# protocol = IntegerField("Protocol")
|
||||
# submit = SubmitField("Save")
|
||||
|
||||
|
||||
@bp.route("/versions/new/", methods=["GET", "POST"])
|
||||
@bp.route("/versions/<name>/edit/", methods=["GET", "POST"])
|
||||
@rank_required(UserRank.MODERATOR)
|
||||
def create_edit_version(name=None):
|
||||
version = None
|
||||
if name is not None:
|
||||
version = MinetestRelease.query.filter_by(name=name).first()
|
||||
if version is None:
|
||||
abort(404)
|
||||
# @bp.route("/versions/new/", methods=["GET", "POST"])
|
||||
# @bp.route("/versions/<name>/edit/", methods=["GET", "POST"])
|
||||
# @rank_required(UserRank.MODERATOR)
|
||||
# def create_edit_version(name=None):
|
||||
# version = None
|
||||
# if name is not None:
|
||||
# version = MinetestRelease.query.filter_by(name=name).first()
|
||||
# if version is None:
|
||||
# abort(404)
|
||||
|
||||
form = VersionForm(formdata=request.form, obj=version)
|
||||
if form.validate_on_submit():
|
||||
if version is None:
|
||||
version = MinetestRelease(form.name.data)
|
||||
db.session.add(version)
|
||||
flash("Created version " + form.name.data, "success")
|
||||
else:
|
||||
flash("Updated version " + form.name.data, "success")
|
||||
# form = VersionForm(formdata=request.form, obj=version)
|
||||
# if form.validate_on_submit():
|
||||
# if version is None:
|
||||
# version = MinetestRelease(form.name.data)
|
||||
# db.session.add(version)
|
||||
# flash("Created version " + form.name.data, "success")
|
||||
# else:
|
||||
# flash("Updated version " + form.name.data, "success")
|
||||
|
||||
form.populate_obj(version)
|
||||
db.session.commit()
|
||||
return redirect(url_for("admin.version_list"))
|
||||
# form.populate_obj(version)
|
||||
# db.session.commit()
|
||||
# return redirect(url_for("admin.version_list"))
|
||||
|
||||
return render_template("admin/versions/edit.html", version=version, form=form)
|
||||
# return render_template("admin/versions/edit.html", version=version, form=form)
|
||||
|
|
|
@ -26,7 +26,7 @@ from sqlalchemy.sql.expression import func
|
|||
from app import csrf
|
||||
from app.markdown import render_markdown
|
||||
from app.models import Tag, PackageState, PackageType, Package, db, PackageRelease, Permission, ForumTopic, \
|
||||
MinetestRelease, APIToken, PackageScreenshot, License, ContentWarning, User, PackageReview, Thread
|
||||
APIToken, PackageScreenshot, License, ContentWarning, User, PackageReview, Thread
|
||||
from app.querybuilder import QueryBuilder
|
||||
from app.utils import is_package_page, get_int_or_abort, url_set_query, abs_url, isYes
|
||||
from . import bp
|
||||
|
@ -521,20 +521,20 @@ def welcome_v1():
|
|||
})
|
||||
|
||||
|
||||
@bp.route("/api/minetest_versions/")
|
||||
@cors_allowed
|
||||
def versions():
|
||||
protocol_version = request.args.get("protocol_version")
|
||||
engine_version = request.args.get("engine_version")
|
||||
if protocol_version or engine_version:
|
||||
rel = MinetestRelease.get(engine_version, get_int_or_abort(protocol_version))
|
||||
if rel is None:
|
||||
error(404, "No releases found")
|
||||
# @bp.route("/api/minetest_versions/")
|
||||
# @cors_allowed
|
||||
# def versions():
|
||||
# protocol_version = request.args.get("protocol_version")
|
||||
# engine_version = request.args.get("engine_version")
|
||||
# if protocol_version or engine_version:
|
||||
# rel = MinetestRelease.get(engine_version, get_int_or_abort(protocol_version))
|
||||
# if rel is None:
|
||||
# error(404, "No releases found")
|
||||
|
||||
return jsonify(rel.getAsDictionary())
|
||||
# return jsonify(rel.getAsDictionary())
|
||||
|
||||
return jsonify([rel.getAsDictionary() \
|
||||
for rel in MinetestRelease.query.all() if rel.getActual() is not None])
|
||||
# return jsonify([rel.getAsDictionary() \
|
||||
# for rel in MinetestRelease.query.all() if rel.getActual() is not None])
|
||||
|
||||
|
||||
@bp.route("/api/dependencies/")
|
||||
|
|
|
@ -20,7 +20,7 @@ from flask import jsonify, abort, make_response, url_for, current_app
|
|||
from app.logic.packages import do_edit_package
|
||||
from app.logic.releases import LogicError, do_create_vcs_release, do_create_zip_release
|
||||
from app.logic.screenshots import do_create_screenshot, do_order_screenshots, do_set_cover_image
|
||||
from app.models import APIToken, Package, MinetestRelease, PackageScreenshot
|
||||
from app.models import APIToken, Package, PackageScreenshot
|
||||
|
||||
|
||||
def error(code: int, msg: str):
|
||||
|
@ -38,7 +38,7 @@ def guard(f):
|
|||
|
||||
|
||||
def api_create_vcs_release(token: APIToken, package: Package, title: str, ref: str,
|
||||
min_v: MinetestRelease = None, max_v: MinetestRelease = None, reason="API"):
|
||||
min_v = None, max_v = None, reason="API"):
|
||||
if not token.canOperateOnPackage(package):
|
||||
error(403, "API token does not have access to the package")
|
||||
|
||||
|
@ -54,7 +54,7 @@ def api_create_vcs_release(token: APIToken, package: Package, title: str, ref: s
|
|||
|
||||
|
||||
def api_create_zip_release(token: APIToken, package: Package, title: str, file,
|
||||
min_v: MinetestRelease = None, max_v: MinetestRelease = None, reason="API", commit_hash:str=None):
|
||||
min_v = None, max_v = None, reason="API", commit_hash:str=None):
|
||||
if not token.canOperateOnPackage(package):
|
||||
error(403, "API token does not have access to the package")
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ def list_releases(package):
|
|||
tabs=get_package_tabs(current_user, package), current_tab="releases")
|
||||
|
||||
|
||||
def get_mt_releases(is_max):
|
||||
query = MinetestRelease.query.order_by(db.asc(MinetestRelease.id))
|
||||
if is_max:
|
||||
query = query.limit(query.count() - 1)
|
||||
else:
|
||||
query = query.filter(MinetestRelease.name != "0.4.17")
|
||||
# def get_mt_releases(is_max):
|
||||
# query = MinetestRelease.query.order_by(db.asc(MinetestRelease.id))
|
||||
# if is_max:
|
||||
# query = query.limit(query.count() - 1)
|
||||
# else:
|
||||
# query = query.filter(MinetestRelease.name != "0.4.17")
|
||||
|
||||
return query
|
||||
# return query
|
||||
|
||||
|
||||
class CreatePackageReleaseForm(FlaskForm):
|
||||
|
@ -167,15 +167,15 @@ def edit_release(package, id):
|
|||
|
||||
|
||||
|
||||
class BulkReleaseForm(FlaskForm):
|
||||
set_min = BooleanField(lazy_gettext("Set Min"))
|
||||
min_rel = QuerySelectField(lazy_gettext("Minimum Minetest Version"), [InputRequired()],
|
||||
query_factory=lambda: get_mt_releases(False), get_pk=lambda a: a.id, get_label=lambda a: a.name)
|
||||
set_max = BooleanField(lazy_gettext("Set Max"))
|
||||
max_rel = QuerySelectField(lazy_gettext("Maximum Minetest Version"), [InputRequired()],
|
||||
query_factory=lambda: get_mt_releases(True), get_pk=lambda a: a.id, get_label=lambda a: a.name)
|
||||
only_change_none = BooleanField(lazy_gettext("Only change values previously set as none"))
|
||||
submit = SubmitField(lazy_gettext("Update"))
|
||||
# class BulkReleaseForm(FlaskForm):
|
||||
# set_min = BooleanField(lazy_gettext("Set Min"))
|
||||
# min_rel = QuerySelectField(lazy_gettext("Minimum Minetest Version"), [InputRequired()],
|
||||
# query_factory=lambda: get_mt_releases(False), get_pk=lambda a: a.id, get_label=lambda a: a.name)
|
||||
# set_max = BooleanField(lazy_gettext("Set Max"))
|
||||
# max_rel = QuerySelectField(lazy_gettext("Maximum Minetest Version"), [InputRequired()],
|
||||
# query_factory=lambda: get_mt_releases(True), get_pk=lambda a: a.id, get_label=lambda a: a.name)
|
||||
# only_change_none = BooleanField(lazy_gettext("Only change values previously set as none"))
|
||||
# submit = SubmitField(lazy_gettext("Update"))
|
||||
|
||||
|
||||
@bp.route("/packages/<author>/<name>/releases/bulk_change/", methods=["GET", "POST"])
|
||||
|
|
|
@ -32,6 +32,20 @@ def populate(session):
|
|||
appstream_user.rank = UserRank.BOT
|
||||
session.add(appstream_user)
|
||||
|
||||
featured = Tag("featured")
|
||||
featured.is_protected = True
|
||||
|
||||
# These tags replace "package types"
|
||||
game_tag = Tag("Game")
|
||||
game_tag.is_toplevel = True
|
||||
tool_tag = Tag("Tool")
|
||||
tool_tag.is_toplevel = True
|
||||
mod_tag = Tag("Mod")
|
||||
mod_tag.is_toplevel = True
|
||||
session.add(featured)
|
||||
session.add(game_tag)
|
||||
session.add(tool_tag)
|
||||
session.add(mod_tag)
|
||||
|
||||
tags = {}
|
||||
for tag in [
|
||||
|
@ -52,7 +66,7 @@ def populate(session):
|
|||
row = Tag(tag)
|
||||
tags[row.name] = row
|
||||
session.add(row)
|
||||
|
||||
tags["featured"] = featured
|
||||
licenses = {}
|
||||
for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
|
||||
"Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
|
||||
|
@ -71,9 +85,9 @@ def populate_test_data(session):
|
|||
licenses = { x.name : x for x in License.query.all() }
|
||||
tags = { x.name : x for x in Tag.query.all() }
|
||||
admin_user = User.query.filter_by(rank=UserRank.ADMIN).first()
|
||||
v4 = MinetestRelease.query.filter_by(protocol=32).first()
|
||||
v50 = MinetestRelease.query.filter_by(protocol=37).first()
|
||||
v51 = MinetestRelease.query.filter_by(protocol=38).first()
|
||||
# v4 = MinetestRelease.query.filter_by(protocol=32).first()
|
||||
# v50 = MinetestRelease.query.filter_by(protocol=37).first()
|
||||
# v51 = MinetestRelease.query.filter_by(protocol=38).first()
|
||||
|
||||
ez = User("Shara")
|
||||
ez.github_username = "Ezhh"
|
||||
|
|
|
@ -22,7 +22,7 @@ from flask_babel import lazy_gettext
|
|||
|
||||
from app.logic.LogicError import LogicError
|
||||
from app.logic.uploads import upload_file
|
||||
from app.models import PackageRelease, db, Permission, User, Package, MinetestRelease
|
||||
from app.models import PackageRelease, db, Permission, User, Package
|
||||
from app.tasks.importtasks import makeVCSRelease, checkZipRelease
|
||||
from app.utils import AuditSeverity, addAuditLog, nonEmptyOrNone
|
||||
|
||||
|
@ -38,7 +38,7 @@ def check_can_create_release(user: User, package: Package):
|
|||
|
||||
|
||||
def do_create_vcs_release(user: User, package: Package, title: str, ref: str,
|
||||
min_v: MinetestRelease = None, max_v: MinetestRelease = None, reason: str = None):
|
||||
min_v = None, max_v = None, reason: str = None):
|
||||
check_can_create_release(user, package)
|
||||
|
||||
rel = PackageRelease()
|
||||
|
@ -46,8 +46,6 @@ def do_create_vcs_release(user: User, package: Package, title: str, ref: str,
|
|||
rel.title = title
|
||||
rel.url = ""
|
||||
rel.task_id = uuid()
|
||||
rel.min_rel = min_v
|
||||
rel.max_rel = max_v
|
||||
db.session.add(rel)
|
||||
|
||||
if reason is None:
|
||||
|
@ -64,7 +62,7 @@ def do_create_vcs_release(user: User, package: Package, title: str, ref: str,
|
|||
|
||||
|
||||
def do_create_zip_release(user: User, package: Package, title: str, file,
|
||||
min_v: MinetestRelease = None, max_v: MinetestRelease = None, reason: str = None,
|
||||
min_v = None, max_v = None, reason: str = None,
|
||||
commit_hash: str = None):
|
||||
check_can_create_release(user, package)
|
||||
|
||||
|
@ -81,8 +79,7 @@ def do_create_zip_release(user: User, package: Package, title: str, file,
|
|||
rel.url = uploaded_url
|
||||
rel.task_id = uuid()
|
||||
rel.commit_hash = commit_hash
|
||||
rel.min_rel = min_v
|
||||
rel.max_rel = max_v
|
||||
|
||||
db.session.add(rel)
|
||||
|
||||
if reason is None:
|
||||
|
|
|
@ -23,7 +23,7 @@ from flask_babel import lazy_gettext
|
|||
from flask_sqlalchemy import BaseQuery
|
||||
from sqlalchemy_searchable import SearchQueryMixin
|
||||
from sqlalchemy_utils.types import TSVectorType
|
||||
|
||||
from app.markdown import render_markdown
|
||||
from . import db
|
||||
from .users import Permission, UserRank, User
|
||||
from .. import app
|
||||
|
@ -376,6 +376,8 @@ class Package(db.Model):
|
|||
title = db.Column(db.Unicode(100), nullable=False)
|
||||
short_desc = db.Column(db.Unicode(200), nullable=False)
|
||||
desc = db.Column(db.UnicodeText, nullable=True)
|
||||
build_desc = db.Column(db.UnicodeText, nullable=True)
|
||||
install_desc = db.Column(db.UnicodeText, nullable=True)
|
||||
type = db.Column(db.Enum(PackageType), nullable=False)
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
approved_at = db.Column(db.DateTime, nullable=True, default=None)
|
||||
|
@ -636,9 +638,7 @@ class Package(db.Model):
|
|||
|
||||
def getDownloadRelease(self, version=None):
|
||||
for rel in self.releases:
|
||||
if rel.approved and (version is None or
|
||||
((rel.min_rel is None or rel.min_rel_id <= version.id) and
|
||||
(rel.max_rel is None or rel.max_rel_id >= version.id))):
|
||||
if rel.approved:
|
||||
return rel
|
||||
|
||||
return None
|
||||
|
@ -765,7 +765,6 @@ class Package(db.Model):
|
|||
review_scores = [ 100 * r.asSign() for r in self.reviews ]
|
||||
self.score = self.score_downloads + sum(review_scores)
|
||||
|
||||
|
||||
class MetaPackage(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(100), unique=True, nullable=False)
|
||||
|
@ -848,6 +847,7 @@ class Tag(db.Model):
|
|||
textColor = db.Column(db.String(6), nullable=False)
|
||||
views = db.Column(db.Integer, nullable=False, default=0)
|
||||
is_protected = db.Column(db.Boolean, nullable=False, default=False)
|
||||
is_toplevel = db.Column(db.Boolean, nullable=False, default=False)
|
||||
|
||||
packages = db.relationship("Package", back_populates="tags", secondary=Tags)
|
||||
|
||||
|
@ -867,50 +867,51 @@ class Tag(db.Model):
|
|||
"title": self.title,
|
||||
"description": description,
|
||||
"is_protected": self.is_protected,
|
||||
"is_toplevel": self.is_toplevel,
|
||||
"views": self.views,
|
||||
}
|
||||
|
||||
|
||||
class MinetestRelease(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(100), unique=True, nullable=False)
|
||||
protocol = db.Column(db.Integer, nullable=False, default=0)
|
||||
# class MinetestRelease(db.Model):
|
||||
# id = db.Column(db.Integer, primary_key=True)
|
||||
# name = db.Column(db.String(100), unique=True, nullable=False)
|
||||
# protocol = db.Column(db.Integer, nullable=False, default=0)
|
||||
|
||||
def __init__(self, name=None, protocol=0):
|
||||
self.name = name
|
||||
self.protocol = protocol
|
||||
# def __init__(self, name=None, protocol=0):
|
||||
# self.name = name
|
||||
# self.protocol = protocol
|
||||
|
||||
def getActual(self):
|
||||
return None if self.name == "None" else self
|
||||
# def getActual(self):
|
||||
# return None if self.name == "None" else self
|
||||
|
||||
def getAsDictionary(self):
|
||||
return {
|
||||
"name": self.name,
|
||||
"protocol_version": self.protocol,
|
||||
"is_dev": "-dev" in self.name,
|
||||
}
|
||||
# def getAsDictionary(self):
|
||||
# return {
|
||||
# "name": self.name,
|
||||
# "protocol_version": self.protocol,
|
||||
# "is_dev": "-dev" in self.name,
|
||||
# }
|
||||
|
||||
@classmethod
|
||||
def get(cls, version, protocol_num):
|
||||
if version:
|
||||
parts = version.strip().split(".")
|
||||
if len(parts) >= 2:
|
||||
major_minor = parts[0] + "." + parts[1]
|
||||
query = MinetestRelease.query.filter(MinetestRelease.name.like("{}%".format(major_minor)))
|
||||
if protocol_num:
|
||||
query = query.filter_by(protocol=protocol_num)
|
||||
# @classmethod
|
||||
# def get(cls, version, protocol_num):
|
||||
# if version:
|
||||
# parts = version.strip().split(".")
|
||||
# if len(parts) >= 2:
|
||||
# major_minor = parts[0] + "." + parts[1]
|
||||
# query = MinetestRelease.query.filter(MinetestRelease.name.like("{}%".format(major_minor)))
|
||||
# if protocol_num:
|
||||
# query = query.filter_by(protocol=protocol_num)
|
||||
|
||||
release = query.one_or_none()
|
||||
if release:
|
||||
return release
|
||||
# release = query.one_or_none()
|
||||
# if release:
|
||||
# return release
|
||||
|
||||
if protocol_num:
|
||||
# Find the closest matching release
|
||||
return MinetestRelease.query.order_by(db.desc(MinetestRelease.protocol),
|
||||
db.desc(MinetestRelease.id)) \
|
||||
.filter(MinetestRelease.protocol <= protocol_num).first()
|
||||
# if protocol_num:
|
||||
# # Find the closest matching release
|
||||
# return MinetestRelease.query.order_by(db.desc(MinetestRelease.protocol),
|
||||
# db.desc(MinetestRelease.id)) \
|
||||
# .filter(MinetestRelease.protocol <= protocol_num).first()
|
||||
|
||||
return None
|
||||
# return None
|
||||
|
||||
|
||||
class PackageRelease(db.Model):
|
||||
|
@ -927,11 +928,12 @@ class PackageRelease(db.Model):
|
|||
commit_hash = db.Column(db.String(41), nullable=True, default=None)
|
||||
downloads = db.Column(db.Integer, nullable=False, default=0)
|
||||
|
||||
min_rel_id = db.Column(db.Integer, db.ForeignKey("minetest_release.id"), nullable=True, server_default=None)
|
||||
min_rel = db.relationship("MinetestRelease", foreign_keys=[min_rel_id])
|
||||
channel = db.Column(db.String(200), nullable=False, default="")
|
||||
# min_rel_id = db.Column(db.Integer, db.ForeignKey("minetest_release.id"), nullable=True, server_default=None)
|
||||
# min_rel = db.relationship("MinetestRelease", foreign_keys=[min_rel_id])
|
||||
|
||||
max_rel_id = db.Column(db.Integer, db.ForeignKey("minetest_release.id"), nullable=True, server_default=None)
|
||||
max_rel = db.relationship("MinetestRelease", foreign_keys=[max_rel_id])
|
||||
# max_rel_id = db.Column(db.Integer, db.ForeignKey("minetest_release.id"), nullable=True, server_default=None)
|
||||
# max_rel = db.relationship("MinetestRelease", foreign_keys=[max_rel_id])
|
||||
|
||||
# If the release is approved, then the task_id must be null and the url must be present
|
||||
CK_approval_valid = db.CheckConstraint("not approved OR (task_id IS NULL AND (url = '') IS NOT FALSE)")
|
||||
|
@ -948,8 +950,9 @@ class PackageRelease(db.Model):
|
|||
"release_date": self.releaseDate.isoformat(),
|
||||
"commit": self.commit_hash,
|
||||
"downloads": self.downloads,
|
||||
"min_minetest_version": self.min_rel and self.min_rel.getAsDictionary(),
|
||||
"max_minetest_version": self.max_rel and self.max_rel.getAsDictionary(),
|
||||
"channel": self.channel,
|
||||
# "min_minetest_version": self.min_rel and self.min_rel.getAsDictionary(),
|
||||
# "max_minetest_version": self.max_rel and self.max_rel.getAsDictionary(),
|
||||
}
|
||||
|
||||
def getLongAsDictionary(self):
|
||||
|
@ -960,8 +963,9 @@ class PackageRelease(db.Model):
|
|||
"release_date": self.releaseDate.isoformat(),
|
||||
"commit": self.commit_hash,
|
||||
"downloads": self.downloads,
|
||||
"min_minetest_version": self.min_rel and self.min_rel.getAsDictionary(),
|
||||
"max_minetest_version": self.max_rel and self.max_rel.getAsDictionary(),
|
||||
# "min_minetest_version": self.min_rel and self.min_rel.getAsDictionary(),
|
||||
# "max_minetest_version": self.max_rel and self.max_rel.getAsDictionary(),
|
||||
"channel": self.channel,
|
||||
"package": self.package.getAsDictionaryKey()
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from sqlalchemy import or_
|
|||
from sqlalchemy.orm import subqueryload
|
||||
from sqlalchemy.sql.expression import func
|
||||
|
||||
from .models import db, PackageType, Package, ForumTopic, License, MinetestRelease, PackageRelease, User, Tag, \
|
||||
from .models import db, PackageType, Package, ForumTopic, License, PackageRelease, User, Tag, \
|
||||
ContentWarning, PackageState, PackageDevState
|
||||
from .utils import isYes, get_int_or_abort
|
||||
|
||||
|
@ -61,11 +61,11 @@ class QueryBuilder:
|
|||
self.author = args.get("author")
|
||||
|
||||
protocol_version = get_int_or_abort(args.get("protocol_version"))
|
||||
minetest_version = args.get("engine_version")
|
||||
if protocol_version or minetest_version:
|
||||
self.version = MinetestRelease.get(minetest_version, protocol_version)
|
||||
else:
|
||||
self.version = None
|
||||
# minetest_version = args.get("engine_version")
|
||||
# if protocol_version or minetest_version:
|
||||
# self.version = MinetestRelease.get(minetest_version, protocol_version)
|
||||
# else:
|
||||
self.version = None
|
||||
|
||||
self.show_discarded = isYes(args.get("show_discarded"))
|
||||
self.show_added = args.get("show_added")
|
||||
|
|
|
@ -78,10 +78,10 @@ CELERYBEAT_SCHEDULE = {
|
|||
'task': 'app.tasks.importtasks.check_for_updates',
|
||||
'schedule': crontab(minute=10, hour=1), # 0110
|
||||
},
|
||||
'send_pending_notifications': {
|
||||
'task': 'app.tasks.emails.send_pending_notifications',
|
||||
'schedule': crontab(minute='*/5'), # every 5 minutes
|
||||
},
|
||||
# 'send_pending_notifications': {
|
||||
# 'task': 'app.tasks.emails.send_pending_notifications',
|
||||
# 'schedule': crontab(minute='*/5'), # every 5 minutes
|
||||
# },
|
||||
'send_notification_digests': {
|
||||
'task': 'app.tasks.emails.send_pending_digests',
|
||||
'schedule': crontab(minute=0, hour=14), # 1400
|
||||
|
|
|
@ -66,7 +66,7 @@ def importFromFlathub():
|
|||
admin_user.rank = UserRank.ADMIN
|
||||
session.add(admin_user)
|
||||
|
||||
|
||||
featured = Tag.query.filter_by(name="featured").first()
|
||||
for app in apps:
|
||||
screenshots = getScreenshots(app)
|
||||
urls = get_urls(app)
|
||||
|
@ -97,6 +97,11 @@ def importFromFlathub():
|
|||
print("adding tag: ", row.name)
|
||||
session.add(row)
|
||||
game1.tags.append(tags[category.lower()])
|
||||
|
||||
# this short list seems like a reasonable set of initial "featured" games
|
||||
if app.get_id() in alwaysAccept:
|
||||
game1.tags.append(featured)
|
||||
|
||||
game1.license = licenses[license]
|
||||
game1.media_license = licenses["MIT"]
|
||||
game1.author = admin_user
|
||||
|
@ -111,6 +116,10 @@ def importFromFlathub():
|
|||
game1.forums = 12835
|
||||
game1.short_desc = "" or app.get_comment()
|
||||
game1.desc = app.get_description()
|
||||
game1.install_desc = "Make sure to follow the [setup guide](https://flatpak.org/setup/) before installing. \n"
|
||||
game1.install_desc += f"\n```\nflatpak install flathub {app.get_id()}\n```\n"
|
||||
game1.install_desc += "Run: \n"
|
||||
game1.install_desc += f"\n```\nflatpak run {app.get_id()}\n```\n"
|
||||
session.add(game1)
|
||||
|
||||
install_url = f"https://dl.flathub.org/repo/appstream/{app.get_id()}.flatpakref"
|
||||
|
|
|
@ -113,12 +113,12 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||
resolver = GameSupportResolver()
|
||||
resolver.update(package)
|
||||
|
||||
# Update min/max
|
||||
if tree.meta.get("min_minetest_version"):
|
||||
release.min_rel = MinetestRelease.get(tree.meta["min_minetest_version"], None)
|
||||
# # Update min/max
|
||||
# if tree.meta.get("min_minetest_version"):
|
||||
# release.min_rel = MinetestRelease.get(tree.meta["min_minetest_version"], None)
|
||||
|
||||
if tree.meta.get("max_minetest_version"):
|
||||
release.max_rel = MinetestRelease.get(tree.meta["max_minetest_version"], None)
|
||||
# if tree.meta.get("max_minetest_version"):
|
||||
# release.max_rel = MinetestRelease.get(tree.meta["max_minetest_version"], None)
|
||||
|
||||
try:
|
||||
with open(os.path.join(tree.baseDir, ".cdb.json"), "r") as f:
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<a class="list-group-item list-group-item-action" href="{{ url_for('users.list_all') }}">User list</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.tag_list') }}">Tag Editor</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.license_list') }}">License Editor</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.version_list') }}">Version Editor</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.warning_list') }}">Warning Editor</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_email') }}">Send bulk email</a>
|
||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_notification') }}">Send bulk notification</a>
|
||||
|
|
|
@ -1,23 +1,2 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% if version %}
|
||||
Edit {{ version.name }}
|
||||
{% else %}
|
||||
New Minetest Version
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<a class="btn btn-primary float-right" href="{{ url_for('admin.create_edit_version') }}">New Version</a>
|
||||
<a class="btn btn-secondary mb-4" href="{{ url_for('admin.version_list') }}">Back to list</a>
|
||||
|
||||
{% from "macros/forms.html" import render_field, render_submit_field %}
|
||||
<form method="POST" action="" enctype="multipart/form-data">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{{ render_field(form.name) }}
|
||||
{{ render_field(form.protocol) }}
|
||||
{{ render_submit_field(form.submit) }}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
<div class="collapse navbar-collapse" id="navbarColor01">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', type='game') }}">{{ _("Games") }}</a>
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', tag='game') }}">{{ _("Games") }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', type='tool') }}">{{ _("Tools") }}</a>
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', tag='development') }}">{{ _("Tools") }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', type='asset_pack') }}">{{ _("Asset Packs") }}</a>
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', tag='gtk') }}">{{ _("Asset Packs") }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('packages.list_all', random=1, lucky=1) }}">{{ _("Random") }}</a>
|
||||
|
|
|
@ -39,11 +39,7 @@
|
|||
</div>
|
||||
<div class="carousel-caption text-shadow">
|
||||
<h3 class="mt-0 mb-3">
|
||||
{% if package.author %}
|
||||
{{ _('<strong>%(title)s</strong> by %(author)s', title=package.title, author=package.author.display_name) }}
|
||||
{% else %}
|
||||
<strong>{{ package.title }}</strong>
|
||||
{% endif %}
|
||||
<strong>{{ package.title }}</strong>
|
||||
</h3>
|
||||
<p>
|
||||
{{ package.short_desc }}
|
||||
|
|
|
@ -255,6 +255,25 @@
|
|||
</article>
|
||||
{% endif %}
|
||||
|
||||
{% if package.build_desc %}
|
||||
<article class="markdown panel mb-5">
|
||||
{{ package.build_desc | markdown }}
|
||||
</article>
|
||||
{% endif %}
|
||||
|
||||
{% if package.install_desc %}
|
||||
<div class="card mt-0 mb-4">
|
||||
<div class="card-header">
|
||||
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#install_desc" aria-expanded="true" aria-controls="install_desc">
|
||||
{{ _("Installation Instructions") }}
|
||||
</button>
|
||||
</div>
|
||||
<article class="markdown panel mb-5 collapse" id="install_desc">
|
||||
{{ package.install_desc | markdown }}
|
||||
</article>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h2 id="reviews" class="mt-0">{{ _("Reviews") }}</h2>
|
||||
|
||||
{% from "macros/reviews.html" import render_reviews, render_review_form, render_review_preview with context %}
|
||||
|
|
|
@ -30,12 +30,12 @@ def make_package(name: str, versions: List[Tuple[Optional[str], Optional[str]]])
|
|||
rel.title = "test"
|
||||
rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
|
||||
|
||||
if minv:
|
||||
rel.min_rel = MinetestRelease.query.filter_by(name=minv).first()
|
||||
assert rel.min_rel
|
||||
if maxv:
|
||||
rel.max_rel = MinetestRelease.query.filter_by(name=maxv).first()
|
||||
assert rel.max_rel
|
||||
# if minv:
|
||||
# rel.min_rel = MinetestRelease.query.filter_by(name=minv).first()
|
||||
# assert rel.min_rel
|
||||
# if maxv:
|
||||
# rel.max_rel = MinetestRelease.query.filter_by(name=maxv).first()
|
||||
# assert rel.max_rel
|
||||
|
||||
rel.approved = True
|
||||
db.session.add(rel)
|
||||
|
|
|
@ -27,6 +27,16 @@ services:
|
|||
volumes:
|
||||
- './data/redis:/data'
|
||||
|
||||
redis-commander:
|
||||
container_name: redis-commander
|
||||
hostname: redis-commander
|
||||
image: rediscommander/redis-commander:latest
|
||||
restart: always
|
||||
environment:
|
||||
- REDIS_HOSTS=local:redis:6379
|
||||
ports:
|
||||
- "8082:8081"
|
||||
|
||||
app:
|
||||
build: .
|
||||
container_name: contentdb_app_1
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 011e42c52d21
|
||||
Revises: 6e57b2b4dcdf
|
||||
Create Date: 2022-01-25 18:48:46.367409
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '011e42c52d21'
|
||||
down_revision = '6e57b2b4dcdf'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package', sa.Column('video_url', sa.String(length=200), nullable=True))
|
||||
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package', 'video_url')
|
|
@ -1,29 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 019da77ba02d
|
||||
Revises: 4f2e19bc2a27
|
||||
Create Date: 2020-07-09 04:07:23.926213
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import datetime
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '019da77ba02d'
|
||||
down_revision = '4f2e19bc2a27'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package_review', sa.Column('created_at', sa.DateTime(), nullable=False, server_default=datetime.datetime.utcnow().isoformat()))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package_review', 'created_at')
|
||||
# ### end Alembic commands ###
|
|
@ -1,35 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 06d23947e7ef
|
||||
Revises: 5d7233cf8a00
|
||||
Create Date: 2020-12-05 20:30:12.166357
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '06d23947e7ef'
|
||||
down_revision = '5d7233cf8a00'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('email_subscription',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('email', sa.String(length=100), nullable=False),
|
||||
sa.Column('blacklisted', sa.Boolean(), nullable=False),
|
||||
sa.Column('token', sa.String(length=32), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('email')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('email_subscription')
|
||||
# ### end Alembic commands ###
|
|
@ -1,30 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 105d4c740ad6
|
||||
Revises: 886c92dc6eaa
|
||||
Create Date: 2020-12-15 17:28:56.559801
|
||||
|
||||
"""
|
||||
import datetime
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
from sqlalchemy import orm
|
||||
from app.models import User, UserRank
|
||||
|
||||
revision = '105d4c740ad6'
|
||||
down_revision = '886c92dc6eaa'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("COMMIT")
|
||||
op.execute("ALTER TYPE userrank ADD VALUE 'BOT' AFTER 'EDITOR'")
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 11b6ef362f98
|
||||
Revises: 9fc23495713b
|
||||
Create Date: 2018-07-04 01:01:45.440662
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '11b6ef362f98'
|
||||
down_revision = '9fc23495713b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('score', sa.Float(), nullable=False, server_default="0.0"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'score')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 13113e5710da
|
||||
Revises: ead35f7d446c
|
||||
Create Date: 2018-05-23 20:18:07.606646
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '13113e5710da'
|
||||
down_revision = 'ead35f7d446c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('created_at', sa.DateTime(), nullable=False, server_default=sa.func.current_timestamp()))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'created_at')
|
||||
# ### end Alembic commands ###
|
|
@ -1,27 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 17b303f33f68
|
||||
Revises: 96a01fe23389
|
||||
Create Date: 2021-12-20 19:48:58.571336
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '17b303f33f68'
|
||||
down_revision = '96a01fe23389'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
status = postgresql.ENUM('WIP', 'BETA', 'ACTIVELY_DEVELOPED', 'MAINTENANCE_ONLY', 'AS_IS', 'DEPRECATED', 'LOOKING_FOR_MAINTAINER', name='packagedevstate')
|
||||
status.create(op.get_bind())
|
||||
|
||||
op.add_column('package', sa.Column('dev_state', sa.Enum('WIP', 'BETA', 'ACTIVELY_DEVELOPED', 'MAINTENANCE_ONLY', 'AS_IS', 'DEPRECATED', 'LOOKING_FOR_MAINTAINER', name='packagedevstate'), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package', 'dev_state')
|
|
@ -1,25 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 1af840af0209
|
||||
Revises: 725ff70ea316
|
||||
Create Date: 2021-08-16 17:17:12.060257
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1af840af0209'
|
||||
down_revision = '725ff70ea316'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("COMMIT")
|
||||
op.execute("ALTER TYPE userrank ADD VALUE 'APPROVER' BEFORE 'EDITOR'")
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
|
@ -1,25 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 28a427cbd4cf
|
||||
Revises: e9f534df23a8
|
||||
Create Date: 2018-06-03 01:47:33.006039
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '28a427cbd4cf'
|
||||
down_revision = 'e9f534df23a8'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
|
@ -1,35 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 2f3c3597c78d
|
||||
Revises: 9ec17b558413
|
||||
Create Date: 2019-01-29 02:43:08.865695
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy_searchable import sync_trigger
|
||||
from sqlalchemy_utils.types import TSVectorType
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2f3c3597c78d'
|
||||
down_revision = '9ec17b558413'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package', 'shortDesc', nullable=False, new_column_name='short_desc')
|
||||
op.add_column('package', sa.Column('search_vector', TSVectorType("title", "short_desc", "desc"), nullable=True))
|
||||
op.create_index('ix_package_search_vector', 'package', ['search_vector'], unique=False, postgresql_using='gin')
|
||||
|
||||
conn = op.get_bind()
|
||||
sync_trigger(conn, 'package', 'search_vector', ["title", "short_desc", "desc"])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('ix_package_search_vector', table_name='package')
|
||||
op.drop_column('package', 'search_vector')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 306ce331a2a7
|
||||
Revises: 6dca6eceb04d
|
||||
Create Date: 2020-01-18 23:00:40.487425
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '306ce331a2a7'
|
||||
down_revision = '6dca6eceb04d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
op.create_check_constraint("CK_approval_valid", "package_release", "not approved OR (task_id IS NULL AND NOT url = '')")
|
||||
|
||||
|
||||
def downgrade():
|
||||
conn = op.get_bind()
|
||||
op.drop_constraint("CK_approval_valid", "package_release", type_="check")
|
|
@ -1,54 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 3710e5fbbe87
|
||||
Revises: f6ef5f35abca
|
||||
Create Date: 2022-01-27 18:50:11.705061
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3710e5fbbe87'
|
||||
down_revision = 'f6ef5f35abca'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
command = """
|
||||
CREATE OR REPLACE FUNCTION parse_websearch(config regconfig, search_query text)
|
||||
RETURNS tsquery AS $$
|
||||
SELECT
|
||||
string_agg(
|
||||
(
|
||||
CASE
|
||||
WHEN position('''' IN words.word) > 0 THEN CONCAT(words.word, ':*')
|
||||
ELSE words.word
|
||||
END
|
||||
),
|
||||
' '
|
||||
)::tsquery
|
||||
FROM (
|
||||
SELECT trim(
|
||||
regexp_split_to_table(
|
||||
websearch_to_tsquery(config, lower(search_query))::text,
|
||||
' '
|
||||
)
|
||||
) AS word
|
||||
) AS words
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION parse_websearch(search_query text)
|
||||
RETURNS tsquery AS $$
|
||||
SELECT parse_websearch('pg_catalog.simple', search_query);
|
||||
$$ LANGUAGE SQL IMMUTABLE;"""
|
||||
|
||||
op.execute(command)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.execute('DROP FUNCTION public.parse_websearch(regconfig, text);')
|
||||
op.execute('DROP FUNCTION public.parse_websearch(text);')
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 3a24fc02365e
|
||||
Revises: b370c3eb4227
|
||||
Create Date: 2020-07-17 20:58:31.130449
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3a24fc02365e'
|
||||
down_revision = 'b370c3eb4227'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('tag', sa.Column('description', sa.String(length=500), nullable=True, server_default=None))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('tag', 'description')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 3f4d7cd8401f
|
||||
Revises: 13113e5710da
|
||||
Create Date: 2018-05-25 17:53:13.215127
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3f4d7cd8401f'
|
||||
down_revision = '13113e5710da'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("ALTER TYPE packagepropertykey ADD VALUE 'harddeps'")
|
||||
conn.execute("ALTER TYPE packagepropertykey ADD VALUE 'softdeps'")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
|
@ -1,37 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 3f5836a3df5c
|
||||
Revises: b3c7ff6655af
|
||||
Create Date: 2020-12-04 22:30:33.420071
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3f5836a3df5c'
|
||||
down_revision = 'b3c7ff6655af'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("''::character varying"))
|
||||
|
||||
op.execute("""
|
||||
UPDATE "user" SET password=NULL WHERE password=''
|
||||
""")
|
||||
op.create_check_constraint("CK_password", "user",
|
||||
"password IS NULL OR password != ''")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint("CK_password", "user", type_="check")
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text("''::character varying"))
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 43dc7dbf64c8
|
||||
Revises: c1ea65e2b492
|
||||
Create Date: 2020-12-09 19:06:11.891807
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '43dc7dbf64c8'
|
||||
down_revision = 'c1ea65e2b492'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('audit_log_entry', 'causer_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=True)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('audit_log_entry', 'causer_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=False)
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 44e138485931
|
||||
Revises: 9e2ac631efb0
|
||||
Create Date: 2018-07-28 14:45:28.879331
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '44e138485931'
|
||||
down_revision = '9e2ac631efb0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package_release', sa.Column('commit_hash', sa.String(length=41), nullable=True, server_default=None))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package_release', 'commit_hash')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 4585ce5147b8
|
||||
Revises: 105d4c740ad6
|
||||
Create Date: 2020-12-15 21:35:18.982716
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4585ce5147b8'
|
||||
down_revision = '105d4c740ad6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package_update_config', sa.Column('outdated', sa.Boolean(), nullable=False, server_default="false"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package_update_config', 'outdated')
|
|
@ -1,39 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 4e482c47e519
|
||||
Revises: 900758871713
|
||||
Create Date: 2018-05-27 22:38:16.507155
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4e482c47e519'
|
||||
down_revision = '900758871713'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('dependency',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('depender_id', sa.Integer(), nullable=True),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('meta_package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('optional', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['depender_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['meta_package_id'], ['meta_package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('depender_id', 'package_id', 'meta_package_id', name='_dependency_uc')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('dependency')
|
||||
# ### end Alembic commands ###
|
|
@ -1,40 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 4f2e19bc2a27
|
||||
Revises: dd27f1311a90
|
||||
Create Date: 2020-07-09 00:35:35.066719
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4f2e19bc2a27'
|
||||
down_revision = 'dd27f1311a90'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('package_review',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('recommends', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('thread', sa.Column('review_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'thread', 'package_review', ['review_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'thread', type_='foreignkey')
|
||||
op.drop_column('thread', 'review_id')
|
||||
op.drop_table('package_review')
|
||||
# ### end Alembic commands ###
|
|
@ -1,35 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 51be0401bb85
|
||||
Revises: d4262fb15b37
|
||||
Create Date: 2021-07-24 00:25:04.706191
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '51be0401bb85'
|
||||
down_revision = 'd4262fb15b37'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('package_alias',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('author', sa.String(length=50), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('package_alias')
|
||||
# ### end Alembic commands ###
|
|
@ -1,42 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 5d7233cf8a00
|
||||
Revises: 81de25b72f66
|
||||
Create Date: 2020-12-05 03:50:18.843494
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5d7233cf8a00'
|
||||
down_revision = '81de25b72f66'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('user_notification_preferences',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_other', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_package_edit', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_package_approval', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_new_thread', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_new_review', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_thread_reply', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_maintainer', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_editor_alert', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_editor_misc', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('user_notification_preferences')
|
||||
# ### end Alembic commands ###
|
|
@ -1,55 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 605b3d74ada1
|
||||
Revises: 28a427cbd4cf
|
||||
Create Date: 2018-06-11 22:50:36.828818
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '605b3d74ada1'
|
||||
down_revision = '28a427cbd4cf'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('thread',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('private', sa.Boolean(), server_default='0', nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('thread_reply',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('thread_id', sa.Integer(), nullable=False),
|
||||
sa.Column('comment', sa.String(length=500), nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
op.add_column('package', sa.Column('review_thread_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'package', 'thread', ['review_thread_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'package', type_='foreignkey')
|
||||
op.drop_constraint(None, 'package', type_='foreignkey')
|
||||
op.drop_column('package', 'review_thread_id')
|
||||
op.drop_table('thread_reply')
|
||||
op.drop_table('thread')
|
||||
# ### end Alembic commands ###
|
|
@ -1,22 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 64fee8e5ab34
|
||||
Revises: 306ce331a2a7
|
||||
Create Date: 2020-01-19 02:28:05.432244
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '64fee8e5ab34'
|
||||
down_revision = '306ce331a2a7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('user', 'confirmed_at', nullable=False, new_column_name='email_confirmed_at')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('user', 'email_confirmed_at', nullable=False, new_column_name='confirmed_at')
|
|
@ -0,0 +1,403 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 668167a0e2d8
|
||||
Revises:
|
||||
Create Date: 2022-02-25 02:30:06.547144
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy_utils
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '668167a0e2d8'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('content_warning',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('description', sa.String(length=500), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('email_subscription',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('email', sa.String(length=100), nullable=False),
|
||||
sa.Column('blacklisted', sa.Boolean(), nullable=False),
|
||||
sa.Column('token', sa.String(length=32), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('email')
|
||||
)
|
||||
op.create_table('license',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=50), nullable=False),
|
||||
sa.Column('is_foss', sa.Boolean(), nullable=False),
|
||||
sa.Column('url', sa.String(length=128), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('meta_package',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('username', sa.String(length=50), nullable=False),
|
||||
sa.Column('password', sa.String(length=255), nullable=True),
|
||||
sa.Column('reset_password_token', sa.String(length=100), server_default='', nullable=False),
|
||||
sa.Column('rank', sa.Enum('BANNED', 'NOT_JOINED', 'NEW_MEMBER', 'MEMBER', 'TRUSTED_MEMBER', 'APPROVER', 'EDITOR', 'BOT', 'MODERATOR', 'ADMIN', name='userrank'), nullable=False),
|
||||
sa.Column('github_username', sa.String(length=50), nullable=True),
|
||||
sa.Column('forums_username', sa.String(length=50), nullable=True),
|
||||
sa.Column('github_access_token', sa.String(length=50), nullable=True),
|
||||
sa.Column('email', sa.String(length=255), nullable=True),
|
||||
sa.Column('email_confirmed_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('locale', sa.String(length=10), nullable=True),
|
||||
sa.Column('profile_pic', sa.String(length=255), nullable=True),
|
||||
sa.Column('is_active', sa.Boolean(), server_default='0', nullable=False),
|
||||
sa.Column('display_name', sa.String(length=100), nullable=False),
|
||||
sa.Column('website_url', sa.String(length=255), nullable=True),
|
||||
sa.Column('donate_url', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('email'),
|
||||
sa.UniqueConstraint('forums_username'),
|
||||
sa.UniqueConstraint('github_username')
|
||||
)
|
||||
op.create_table('thread',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
# sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
# sa.Column('review_id', sa.Integer(), nullable=True),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('private', sa.Boolean(), server_default='0', nullable=False),
|
||||
sa.Column('locked', sa.Boolean(), server_default='0', nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
# sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
# sa.ForeignKeyConstraint(['review_id'], ['package_review.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
op.create_table('package',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=100), nullable=False),
|
||||
sa.Column('title', sa.Unicode(length=100), nullable=False),
|
||||
sa.Column('short_desc', sa.Unicode(length=200), nullable=False),
|
||||
sa.Column('desc', sa.UnicodeText(), nullable=True),
|
||||
sa.Column('build_desc', sa.UnicodeText(), nullable=True),
|
||||
sa.Column('install_desc', sa.UnicodeText(), nullable=True),
|
||||
sa.Column('type', sa.Enum('GAME', 'TOOL', 'ASSETPACK', name='packagetype'), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('approved_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('search_vector', sqlalchemy_utils.types.ts_vector.TSVectorType(), nullable=True),
|
||||
sa.Column('license_id', sa.Integer(), nullable=False),
|
||||
sa.Column('media_license_id', sa.Integer(), nullable=False),
|
||||
sa.Column('state', sa.Enum('WIP', 'CHANGES_NEEDED', 'READY_FOR_REVIEW', 'APPROVED', 'DELETED', name='packagestate'), nullable=False),
|
||||
sa.Column('dev_state', sa.Enum('WIP', 'BETA', 'ACTIVELY_DEVELOPED', 'MAINTENANCE_ONLY', 'AS_IS', 'DEPRECATED', 'LOOKING_FOR_MAINTAINER', name='packagedevstate'), nullable=True),
|
||||
sa.Column('score', sa.Float(), nullable=False),
|
||||
sa.Column('score_downloads', sa.Float(), nullable=False),
|
||||
sa.Column('downloads', sa.Integer(), nullable=False),
|
||||
sa.Column('review_thread_id', sa.Integer(), nullable=True),
|
||||
sa.Column('repo', sa.String(length=200), nullable=True),
|
||||
sa.Column('website', sa.String(length=200), nullable=True),
|
||||
sa.Column('issueTracker', sa.String(length=200), nullable=True),
|
||||
sa.Column('forums', sa.Integer(), nullable=True),
|
||||
sa.Column('video_url', sa.String(length=200), nullable=True),
|
||||
# sa.Column('cover_image_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
# sa.ForeignKeyConstraint(['cover_image_id'], ['package_screenshot.id'], ),
|
||||
sa.ForeignKeyConstraint(['license_id'], ['license.id'], ),
|
||||
sa.ForeignKeyConstraint(['media_license_id'], ['license.id'], ),
|
||||
sa.ForeignKeyConstraint(['review_thread_id'], ['thread.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package_review',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('recommends', sa.Boolean(), nullable=False),
|
||||
sa.Column('score', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('thread', sa.Column('package_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'thread', 'package', ['package_id'], ['id'])
|
||||
op.add_column('thread', sa.Column('review_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'thread', 'package_review', ['review_id'], ['id'] )
|
||||
|
||||
op.create_index('ix_package_search_vector', 'package', ['search_vector'], unique=False, postgresql_using='gin')
|
||||
|
||||
op.create_table('package_screenshot',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('order', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=100), nullable=False),
|
||||
sa.Column('approved', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('width', sa.Integer(), nullable=False),
|
||||
sa.Column('height', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# sa.Column('cover_image_id', sa.Integer(), nullable=True),
|
||||
# sa.ForeignKeyConstraint(['cover_image_id'], ['package_screenshot.id'], ),
|
||||
|
||||
op.add_column('package', sa.Column('cover_image_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'package', 'package_screenshot', ['cover_image_id'], ['id'])
|
||||
|
||||
op.create_table('tag',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('description', sa.String(length=500), nullable=True),
|
||||
sa.Column('backgroundColor', sa.String(length=6), nullable=False),
|
||||
sa.Column('textColor', sa.String(length=6), nullable=False),
|
||||
sa.Column('views', sa.Integer(), nullable=False),
|
||||
sa.Column('is_protected', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_toplevel', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
|
||||
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
|
||||
op.create_table('api_token',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('access_token', sa.String(length=34), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('owner_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('access_token')
|
||||
)
|
||||
op.create_table('audit_log_entry',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('causer_id', sa.Integer(), nullable=True),
|
||||
sa.Column('severity', sa.Enum('NORMAL', 'USER', 'EDITOR', 'MODERATION', name='auditseverity'), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=200), nullable=True),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['causer_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('content_warnings',
|
||||
sa.Column('content_warning_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['content_warning_id'], ['content_warning.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('content_warning_id', 'package_id')
|
||||
)
|
||||
op.create_table('dependency',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('depender_id', sa.Integer(), nullable=True),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('meta_package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('optional', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['depender_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['meta_package_id'], ['meta_package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('depender_id', 'package_id', 'meta_package_id', name='_dependency_uc')
|
||||
)
|
||||
op.create_table('forum_topic',
|
||||
sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('wip', sa.Boolean(), nullable=False),
|
||||
sa.Column('discarded', sa.Boolean(), nullable=False),
|
||||
sa.Column('type', sa.Enum('GAME', 'TOOL', 'ASSETPACK', name='packagetype'), nullable=False),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('name', sa.String(length=30), nullable=True),
|
||||
sa.Column('link', sa.String(length=200), nullable=True),
|
||||
sa.Column('posts', sa.Integer(), nullable=False),
|
||||
sa.Column('views', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('topic_id')
|
||||
)
|
||||
op.create_table('maintainers',
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('user_id', 'package_id')
|
||||
)
|
||||
op.create_table('notification',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('causer_id', sa.Integer(), nullable=False),
|
||||
sa.Column('type', sa.Enum('PACKAGE_EDIT', 'PACKAGE_APPROVAL', 'NEW_THREAD', 'NEW_REVIEW', 'THREAD_REPLY', 'BOT', 'MAINTAINER', 'EDITOR_ALERT', 'EDITOR_MISC', 'OTHER', name='notificationtype'), nullable=False),
|
||||
sa.Column('emailed', sa.Boolean(), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=200), nullable=True),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['causer_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package_alias',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('author', sa.String(length=50), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package_game_support',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('game_id', sa.Integer(), nullable=False),
|
||||
sa.Column('supports', sa.Boolean(), nullable=False),
|
||||
sa.Column('confidence', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['game_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('game_id', 'package_id', name='_package_game_support_uc')
|
||||
)
|
||||
op.create_table('package_release',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('releaseDate', sa.DateTime(), nullable=False),
|
||||
sa.Column('url', sa.String(length=200), nullable=False),
|
||||
sa.Column('approved', sa.Boolean(), nullable=False),
|
||||
sa.Column('task_id', sa.String(length=37), nullable=True),
|
||||
sa.Column('commit_hash', sa.String(length=41), nullable=True),
|
||||
sa.Column('downloads', sa.Integer(), nullable=False),
|
||||
sa.Column('channel', sa.String(length=200), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package_review_vote',
|
||||
sa.Column('review_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('is_positive', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['review_id'], ['package_review.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('review_id', 'user_id')
|
||||
)
|
||||
op.create_table('package_update_config',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('last_commit', sa.String(length=41), nullable=True),
|
||||
sa.Column('last_tag', sa.String(length=41), nullable=True),
|
||||
sa.Column('outdated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('trigger', sa.Enum('COMMIT', 'TAG', name='packageupdatetrigger'), nullable=False),
|
||||
sa.Column('ref', sa.String(length=41), nullable=True),
|
||||
sa.Column('make_release', sa.Boolean(), nullable=False),
|
||||
sa.Column('auto_created', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id')
|
||||
)
|
||||
op.create_table('provides',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('metapackage_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['metapackage_id'], ['meta_package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'metapackage_id')
|
||||
)
|
||||
op.create_table('tags',
|
||||
sa.Column('tag_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
|
||||
sa.PrimaryKeyConstraint('tag_id', 'package_id')
|
||||
)
|
||||
op.create_table('thread_reply',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('thread_id', sa.Integer(), nullable=False),
|
||||
sa.Column('comment', sa.String(length=2000), nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('user_email_verification',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('email', sa.String(length=100), nullable=False),
|
||||
sa.Column('token', sa.String(length=32), nullable=True),
|
||||
sa.Column('is_password_reset', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('user_notification_preferences',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_package_edit', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_package_approval', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_new_thread', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_new_review', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_thread_reply', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_bot', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_maintainer', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_editor_alert', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_editor_misc', sa.Integer(), nullable=False),
|
||||
sa.Column('pref_other', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('watchers',
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('thread_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('user_id', 'thread_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('watchers')
|
||||
op.drop_table('user_notification_preferences')
|
||||
op.drop_table('user_email_verification')
|
||||
op.drop_table('thread_reply')
|
||||
op.drop_table('tags')
|
||||
op.drop_table('provides')
|
||||
op.drop_table('package_update_config')
|
||||
op.drop_table('package_review_vote')
|
||||
op.drop_table('package_release')
|
||||
op.drop_table('package_game_support')
|
||||
op.drop_table('package_alias')
|
||||
op.drop_table('notification')
|
||||
op.drop_table('maintainers')
|
||||
op.drop_table('forum_topic')
|
||||
op.drop_table('dependency')
|
||||
op.drop_table('content_warnings')
|
||||
op.drop_table('audit_log_entry')
|
||||
op.drop_table('api_token')
|
||||
op.drop_index(op.f('ix_user_username'), table_name='user')
|
||||
op.drop_table('user')
|
||||
op.drop_table('thread')
|
||||
op.drop_table('tag')
|
||||
op.drop_table('package_screenshot')
|
||||
op.drop_table('package_review')
|
||||
op.drop_index('ix_package_search_vector', table_name='package', postgresql_using='gin')
|
||||
op.drop_table('package')
|
||||
op.drop_table('meta_package')
|
||||
op.drop_table('license')
|
||||
op.drop_table('email_subscription')
|
||||
op.drop_table('content_warning')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 6dca6eceb04d
|
||||
Revises: fd25bf3e57c3
|
||||
Create Date: 2020-01-18 17:32:21.885068
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from sqlalchemy_searchable import sync_trigger
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6dca6eceb04d'
|
||||
down_revision = 'fd25bf3e57c3'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
sync_trigger(conn, 'package', 'search_vector', ["name", "title", "short_desc", "desc"])
|
||||
op.create_check_constraint("name_valid", "package", "name ~* '^[a-zA-Z0-9_\-\.]+$'")
|
||||
|
||||
|
||||
def downgrade():
|
||||
conn = op.get_bind()
|
||||
sync_trigger(conn, 'package', 'search_vector', ["title", "short_desc", "desc"])
|
||||
op.drop_constraint("name_valid", "package", type_="check")
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 6e57b2b4dcdf
|
||||
Revises: 17b303f33f68
|
||||
Create Date: 2022-01-22 20:35:25.494712
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6e57b2b4dcdf'
|
||||
down_revision = '17b303f33f68'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('user', sa.Column('locale', sa.String(length=10), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('user', 'locale')
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 725ff70ea316
|
||||
Revises: 51be0401bb85
|
||||
Create Date: 2021-07-31 19:10:36.683434
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '725ff70ea316'
|
||||
down_revision = '51be0401bb85'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('license', sa.Column('url', sa.String(length=128), nullable=True, default=None))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('license', 'url')
|
||||
# ### end Alembic commands ###
|
|
@ -1,23 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 7a48dbd05780
|
||||
Revises: df66c78e6791
|
||||
Create Date: 2020-01-24 21:52:49.744404
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7a48dbd05780'
|
||||
down_revision = 'df66c78e6791'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('user', sa.Column('github_access_token', sa.String(length=50), nullable=True, server_default=None))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('user', 'github_access_token')
|
|
@ -1,40 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 7def3e843d04
|
||||
Revises: dce69ad1e4eb
|
||||
Create Date: 2019-01-28 20:27:33.760232
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7def3e843d04'
|
||||
down_revision = 'dce69ad1e4eb'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('minetest_release',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.add_column('package_release', sa.Column('max_rel_id', sa.Integer(), nullable=True, server_default=None))
|
||||
op.add_column('package_release', sa.Column('min_rel_id', sa.Integer(), nullable=True, server_default=None))
|
||||
op.create_foreign_key(None, 'package_release', 'minetest_release', ['max_rel_id'], ['id'])
|
||||
op.create_foreign_key(None, 'package_release', 'minetest_release', ['min_rel_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'package_release', type_='foreignkey')
|
||||
op.drop_constraint(None, 'package_release', type_='foreignkey')
|
||||
op.drop_column('package_release', 'min_rel_id')
|
||||
op.drop_column('package_release', 'max_rel_id')
|
||||
op.drop_table('minetest_release')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 7f166b5218d7
|
||||
Revises: 3f5836a3df5c
|
||||
Create Date: 2020-12-05 00:06:41.466562
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7f166b5218d7'
|
||||
down_revision = '3f5836a3df5c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('user_email_verification', sa.Column('is_password_reset', sa.Boolean(), nullable=False, server_default="false"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('user_email_verification', 'is_password_reset')
|
|
@ -1,247 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 7ff57806ffd5
|
||||
Revises: 2f3c3597c78d
|
||||
Create Date: 2019-01-29 02:57:50.279918
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7ff57806ffd5'
|
||||
down_revision = '2f3c3597c78d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.execute("""
|
||||
DROP TYPE IF EXISTS tsq_state CASCADE;
|
||||
|
||||
CREATE TYPE tsq_state AS (
|
||||
search_query text,
|
||||
parentheses_stack int,
|
||||
skip_for int,
|
||||
current_token text,
|
||||
current_index int,
|
||||
current_char text,
|
||||
previous_char text,
|
||||
tokens text[]
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_append_current_token(state tsq_state)
|
||||
RETURNS tsq_state AS $$
|
||||
BEGIN
|
||||
IF state.current_token != '' THEN
|
||||
state.tokens := array_append(state.tokens, state.current_token);
|
||||
state.current_token := '';
|
||||
END IF;
|
||||
RETURN state;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_tokenize_character(state tsq_state)
|
||||
RETURNS tsq_state AS $$
|
||||
BEGIN
|
||||
IF state.current_char = '(' THEN
|
||||
state.tokens := array_append(state.tokens, '(');
|
||||
state.parentheses_stack := state.parentheses_stack + 1;
|
||||
state := tsq_append_current_token(state);
|
||||
ELSIF state.current_char = ')' THEN
|
||||
IF (state.parentheses_stack > 0 AND state.current_token != '') THEN
|
||||
state := tsq_append_current_token(state);
|
||||
state.tokens := array_append(state.tokens, ')');
|
||||
state.parentheses_stack := state.parentheses_stack - 1;
|
||||
END IF;
|
||||
ELSIF state.current_char = '"' THEN
|
||||
state.skip_for := position('"' IN substring(
|
||||
state.search_query FROM state.current_index + 1
|
||||
));
|
||||
|
||||
IF state.skip_for > 1 THEN
|
||||
state.tokens = array_append(
|
||||
state.tokens,
|
||||
substring(
|
||||
state.search_query
|
||||
FROM state.current_index FOR state.skip_for + 1
|
||||
)
|
||||
);
|
||||
ELSIF state.skip_for = 0 THEN
|
||||
state.current_token := state.current_token || state.current_char;
|
||||
END IF;
|
||||
ELSIF (
|
||||
state.current_char = '-' AND
|
||||
(state.current_index = 1 OR state.previous_char = ' ')
|
||||
) THEN
|
||||
state.tokens := array_append(state.tokens, '-');
|
||||
ELSIF state.current_char = ' ' THEN
|
||||
state := tsq_append_current_token(state);
|
||||
IF substring(
|
||||
state.search_query FROM state.current_index FOR 4
|
||||
) = ' or ' THEN
|
||||
state.skip_for := 2;
|
||||
|
||||
-- remove duplicate OR tokens
|
||||
IF state.tokens[array_length(state.tokens, 1)] != ' | ' THEN
|
||||
state.tokens := array_append(state.tokens, ' | ');
|
||||
END IF;
|
||||
END IF;
|
||||
ELSE
|
||||
state.current_token = state.current_token || state.current_char;
|
||||
END IF;
|
||||
RETURN state;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_tokenize(search_query text) RETURNS text[] AS $$
|
||||
DECLARE
|
||||
state tsq_state;
|
||||
BEGIN
|
||||
SELECT
|
||||
search_query::text AS search_query,
|
||||
0::int AS parentheses_stack,
|
||||
0 AS skip_for,
|
||||
''::text AS current_token,
|
||||
0 AS current_index,
|
||||
''::text AS current_char,
|
||||
''::text AS previous_char,
|
||||
'{}'::text[] AS tokens
|
||||
INTO state;
|
||||
|
||||
state.search_query := lower(trim(
|
||||
regexp_replace(search_query, '""+', '""', 'g')
|
||||
));
|
||||
|
||||
FOR state.current_index IN (
|
||||
SELECT generate_series(1, length(state.search_query))
|
||||
) LOOP
|
||||
state.current_char := substring(
|
||||
search_query FROM state.current_index FOR 1
|
||||
);
|
||||
|
||||
IF state.skip_for > 0 THEN
|
||||
state.skip_for := state.skip_for - 1;
|
||||
CONTINUE;
|
||||
END IF;
|
||||
|
||||
state := tsq_tokenize_character(state);
|
||||
state.previous_char := state.current_char;
|
||||
END LOOP;
|
||||
state := tsq_append_current_token(state);
|
||||
|
||||
state.tokens := array_nremove(state.tokens, '(', -state.parentheses_stack);
|
||||
|
||||
RETURN state.tokens;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql IMMUTABLE;
|
||||
|
||||
|
||||
-- Processes an array of text search tokens and returns a tsquery
|
||||
CREATE OR REPLACE FUNCTION tsq_process_tokens(config regconfig, tokens text[])
|
||||
RETURNS tsquery AS $$
|
||||
DECLARE
|
||||
result_query text;
|
||||
previous_value text;
|
||||
value text;
|
||||
BEGIN
|
||||
result_query := '';
|
||||
FOREACH value IN ARRAY tokens LOOP
|
||||
IF value = '"' THEN
|
||||
CONTINUE;
|
||||
END IF;
|
||||
|
||||
IF left(value, 1) = '"' AND right(value, 1) = '"' THEN
|
||||
value := phraseto_tsquery(config, value);
|
||||
ELSIF value NOT IN ('(', ' | ', ')', '-') THEN
|
||||
value := quote_literal(value) || ':*';
|
||||
END IF;
|
||||
|
||||
IF previous_value = '-' THEN
|
||||
IF value = '(' THEN
|
||||
value := '!' || value;
|
||||
ELSE
|
||||
value := '!(' || value || ')';
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
SELECT
|
||||
CASE
|
||||
WHEN result_query = '' THEN value
|
||||
WHEN (
|
||||
previous_value IN ('!(', '(', ' | ') OR
|
||||
value IN (')', ' | ')
|
||||
) THEN result_query || value
|
||||
ELSE result_query || ' & ' || value
|
||||
END
|
||||
INTO result_query;
|
||||
previous_value := value;
|
||||
END LOOP;
|
||||
|
||||
RETURN to_tsquery(config, result_query);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_process_tokens(tokens text[])
|
||||
RETURNS tsquery AS $$
|
||||
SELECT tsq_process_tokens(get_current_ts_config(), tokens);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_parse(config regconfig, search_query text)
|
||||
RETURNS tsquery AS $$
|
||||
SELECT tsq_process_tokens(config, tsq_tokenize(search_query));
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_parse(config text, search_query text)
|
||||
RETURNS tsquery AS $$
|
||||
SELECT tsq_parse(config::regconfig, search_query);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION tsq_parse(search_query text) RETURNS tsquery AS $$
|
||||
SELECT tsq_parse(get_current_ts_config(), search_query);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
-- remove first N elements equal to the given value from the array (array
|
||||
-- must be one-dimensional)
|
||||
--
|
||||
-- If negative value is given as the third argument the removal of elements
|
||||
-- starts from the last array element.
|
||||
CREATE OR REPLACE FUNCTION array_nremove(anyarray, anyelement, int)
|
||||
RETURNS ANYARRAY AS $$
|
||||
WITH replaced_positions AS (
|
||||
SELECT UNNEST(
|
||||
CASE
|
||||
WHEN $2 IS NULL THEN
|
||||
'{}'::int[]
|
||||
WHEN $3 > 0 THEN
|
||||
(array_positions($1, $2))[1:$3]
|
||||
WHEN $3 < 0 THEN
|
||||
(array_positions($1, $2))[
|
||||
(cardinality(array_positions($1, $2)) + $3 + 1):
|
||||
]
|
||||
ELSE
|
||||
'{}'::int[]
|
||||
END
|
||||
) AS position
|
||||
)
|
||||
SELECT COALESCE((
|
||||
SELECT array_agg(value)
|
||||
FROM unnest($1) WITH ORDINALITY AS t(value, index)
|
||||
WHERE index NOT IN (SELECT position FROM replaced_positions)
|
||||
), $1[1:0]);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
""")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
|
@ -1,31 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 81de25b72f66
|
||||
Revises: c154912eaa0c
|
||||
Create Date: 2020-12-05 03:38:42.004388
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '81de25b72f66'
|
||||
down_revision = 'c154912eaa0c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
status = postgresql.ENUM('OTHER', 'PACKAGE_EDIT', 'PACKAGE_APPROVAL', 'NEW_THREAD', 'NEW_REVIEW', 'THREAD_REPLY', 'MAINTAINER', 'EDITOR_ALERT', 'EDITOR_MISC', name='notificationtype')
|
||||
status.create(op.get_bind())
|
||||
|
||||
op.add_column('notification', sa.Column('emailed', sa.Boolean(), nullable=False, server_default="true"))
|
||||
op.add_column('notification', sa.Column('type', sa.Enum('OTHER', 'PACKAGE_EDIT', 'PACKAGE_APPROVAL', 'NEW_THREAD', 'NEW_REVIEW', 'THREAD_REPLY', 'MAINTAINER', 'EDITOR_ALERT', 'EDITOR_MISC', name='notificationtype'), nullable=False, server_default="OTHER"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('notification', 'type')
|
||||
op.drop_column('notification', 'emailed')
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 81e0eb07a3cd
|
||||
Revises: f30031f0b928
|
||||
Create Date: 2018-05-23 19:22:56.590653
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '81e0eb07a3cd'
|
||||
down_revision = 'f30031f0b928'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package_release', 'url',
|
||||
existing_type=sa.VARCHAR(length=100),
|
||||
type_=sa.String(length=200),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package_release', 'url',
|
||||
existing_type=sa.String(length=200),
|
||||
type_=sa.VARCHAR(length=100),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
|
@ -1,168 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 83622276d439
|
||||
Revises:
|
||||
Create Date: 2018-05-23 17:58:47.616987
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '83622276d439'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('license',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=50), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('tag',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('backgroundColor', sa.String(length=6), nullable=False),
|
||||
sa.Column('textColor', sa.String(length=6), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('username', sa.String(length=50), nullable=False),
|
||||
sa.Column('password', sa.String(length=255), server_default='', nullable=False),
|
||||
sa.Column('reset_password_token', sa.String(length=100), server_default='', nullable=False),
|
||||
sa.Column('rank', sa.Enum('NOT_JOINED', 'NEW_MEMBER', 'MEMBER', 'EDITOR', 'MODERATOR', 'ADMIN', name='userrank'), nullable=True),
|
||||
sa.Column('github_username', sa.String(length=50), nullable=True),
|
||||
sa.Column('forums_username', sa.String(length=50), nullable=True),
|
||||
sa.Column('email', sa.String(length=255), nullable=True),
|
||||
sa.Column('confirmed_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('is_active', sa.Boolean(), server_default='0', nullable=False),
|
||||
sa.Column('display_name', sa.String(length=100), server_default='', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('email'),
|
||||
sa.UniqueConstraint('forums_username'),
|
||||
sa.UniqueConstraint('github_username'),
|
||||
sa.UniqueConstraint('username')
|
||||
)
|
||||
op.create_table('notification',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('causer_id', sa.Integer(), nullable=True),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=200), nullable=True),
|
||||
sa.ForeignKeyConstraint(['causer_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=True),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('shortDesc', sa.String(length=200), nullable=False),
|
||||
sa.Column('desc', sa.Text(), nullable=True),
|
||||
sa.Column('type', sa.Enum('TOOL', 'GAME', 'ASSETPACK', name='packagetype'), nullable=True),
|
||||
sa.Column('license_id', sa.Integer(), nullable=True),
|
||||
sa.Column('approved', sa.Boolean(), nullable=False),
|
||||
sa.Column('repo', sa.String(length=200), nullable=True),
|
||||
sa.Column('website', sa.String(length=200), nullable=True),
|
||||
sa.Column('issueTracker', sa.String(length=200), nullable=True),
|
||||
sa.Column('forums', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['license_id'], ['license.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('user_email_verification',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('email', sa.String(length=100), nullable=True),
|
||||
sa.Column('token', sa.String(length=32), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('edit_request',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('author_id', sa.Integer(), nullable=True),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('desc', sa.String(length=1000), nullable=True),
|
||||
sa.Column('status', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('harddeps',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('dependency_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['dependency_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'dependency_id')
|
||||
)
|
||||
op.create_table('package_release',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('releaseDate', sa.DateTime(), nullable=False),
|
||||
sa.Column('url', sa.String(length=100), nullable=False),
|
||||
sa.Column('approved', sa.Boolean(), nullable=False),
|
||||
sa.Column('task_id', sa.String(length=32), nullable=True),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('package_screenshot',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=100), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('softdeps',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('dependency_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['dependency_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'dependency_id')
|
||||
)
|
||||
op.create_table('tags',
|
||||
sa.Column('tag_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
|
||||
sa.PrimaryKeyConstraint('tag_id', 'package_id')
|
||||
)
|
||||
op.create_table('edit_request_change',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('request_id', sa.Integer(), nullable=True),
|
||||
sa.Column('key', sa.Enum('name', 'title', 'shortDesc', 'desc', 'type', 'license', 'tags', 'repo', 'website', 'issueTracker', 'forums', name='packagepropertykey'), nullable=False),
|
||||
sa.Column('oldValue', sa.Text(), nullable=True),
|
||||
sa.Column('newValue', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['edit_request.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('edit_request_change')
|
||||
op.drop_table('tags')
|
||||
op.drop_table('softdeps')
|
||||
op.drop_table('package_screenshot')
|
||||
op.drop_table('package_release')
|
||||
op.drop_table('harddeps')
|
||||
op.drop_table('edit_request')
|
||||
op.drop_table('user_email_verification')
|
||||
op.drop_table('package')
|
||||
op.drop_table('notification')
|
||||
op.drop_table('user')
|
||||
op.drop_table('tag')
|
||||
op.drop_table('license')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 838081950f27
|
||||
Revises: 86512692b770
|
||||
Create Date: 2020-07-12 01:33:19.499459
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '838081950f27'
|
||||
down_revision = '86512692b770'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("""
|
||||
DELETE FROM provides AS t USING meta_package AS m WHERE t.metapackage_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$');
|
||||
DELETE FROM dependency AS t USING meta_package AS m WHERE t.meta_package_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$');
|
||||
DELETE FROM meta_package WHERE NOT (name ~* '^[a-z0-9_]+$');
|
||||
""")
|
||||
|
||||
op.create_check_constraint("mp_name_valid", "meta_package", "name ~* '^[a-z0-9_]+$'")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint("mp_name_valid", "meta_package", type_="check")
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 86512692b770
|
||||
Revises: ba730ce1dc3e
|
||||
Create Date: 2020-07-11 01:56:28.634661
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '86512692b770'
|
||||
down_revision = 'ba730ce1dc3e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('audit_log_entry', sa.Column('description', sa.Text, nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('audit_log_entry', 'description')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 8679442b8dde
|
||||
Revises: f612e293070a
|
||||
Create Date: 2020-07-11 00:14:02.330903
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8679442b8dde'
|
||||
down_revision = 'f612e293070a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('thread', sa.Column('locked', sa.Boolean(), server_default='0', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('thread', 'locked')
|
||||
# ### end Alembic commands ###
|
|
@ -1,35 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 886c92dc6eaa
|
||||
Revises: 8d22def23c8b
|
||||
Create Date: 2020-12-15 16:38:54.114559
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '886c92dc6eaa'
|
||||
down_revision = '8d22def23c8b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('package_update_config',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('last_commit', sa.String(length=41), nullable=True),
|
||||
sa.Column('trigger', sa.Enum('COMMIT', 'TAG', name='packageupdatetrigger'), nullable=False),
|
||||
sa.Column('make_release', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('package_update_config')
|
||||
# ### end Alembic commands ###
|
|
@ -1,30 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 8d22def23c8b
|
||||
Revises: 42b14763c95e
|
||||
Create Date: 2020-12-10 22:23:32.291613
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8d22def23c8b'
|
||||
down_revision = 'a9c1c08bf956'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('cover_image_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'package', 'package_screenshot', ['cover_image_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'package', type_='foreignkey')
|
||||
op.drop_column('package', 'cover_image_id')
|
||||
# ### end Alembic commands ###
|
|
@ -1,30 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 8ee3cf3fb312
|
||||
Revises: e82c2141fae3
|
||||
Create Date: 2021-05-03 22:21:02.167758
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8ee3cf3fb312'
|
||||
down_revision = 'e82c2141fae3'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('user', 'email_confirmed_at',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=True)
|
||||
op.execute("""UPDATE "user" SET email_confirmed_at = NULL WHERE email_confirmed_at < '2016-01-01'::date""")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('user', 'email_confirmed_at',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
op.execute(
|
||||
"""UPDATE "user" SET email_confirmed_at = '2004-01-01'::date WHERE email_confirmed_at IS NULL""")
|
|
@ -1,57 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 900758871713
|
||||
Revises: ea5a023711e0
|
||||
Create Date: 2018-05-27 16:36:44.258935
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '900758871713'
|
||||
down_revision = 'ea5a023711e0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('meta_package',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('provides',
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('metapackage_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['metapackage_id'], ['meta_package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'metapackage_id')
|
||||
)
|
||||
op.drop_table('harddeps')
|
||||
op.drop_table('softdeps')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('softdeps',
|
||||
sa.Column('package_id', sa.INTEGER(), nullable=False),
|
||||
sa.Column('dependency_id', sa.INTEGER(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['dependency_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'dependency_id')
|
||||
)
|
||||
op.create_table('harddeps',
|
||||
sa.Column('package_id', sa.INTEGER(), nullable=False),
|
||||
sa.Column('dependency_id', sa.INTEGER(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['dependency_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('package_id', 'dependency_id')
|
||||
)
|
||||
op.drop_table('provides')
|
||||
op.drop_table('meta_package')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 96811eb565c1
|
||||
Revises: a337bcc165c0
|
||||
Create Date: 2021-01-29 23:14:37.806520
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '96811eb565c1'
|
||||
down_revision = 'a337bcc165c0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package_update_config', sa.Column('auto_created', sa.Boolean(), nullable=False, server_default="false"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package_update_config', 'auto_created')
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 96a01fe23389
|
||||
Revises: cd5ab8a01f4a
|
||||
Create Date: 2021-11-24 17:12:33.893988
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '96a01fe23389'
|
||||
down_revision = 'cd5ab8a01f4a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("DELETE FROM user_email_verification")
|
||||
op.add_column('user', sa.Column('created_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('user_email_verification', sa.Column('created_at', sa.DateTime(), nullable=False))
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
op.drop_column('user_email_verification', 'created_at')
|
||||
op.drop_column('user', 'created_at')
|
|
@ -1,27 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 97a9c461bc2d
|
||||
Revises: 7def3e843d04
|
||||
Create Date: 2019-01-28 20:49:41.831991
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '97a9c461bc2d'
|
||||
down_revision = '7def3e843d04'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('minetest_release', sa.Column('protocol', sa.Integer(), nullable=False, server_default="0"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('minetest_release', 'protocol')
|
||||
# ### end Alembic commands ###
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 9832944cd1e4
|
||||
Revises: 838081950f27
|
||||
Create Date: 2020-07-15 15:00:45.440381
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9832944cd1e4'
|
||||
down_revision = '838081950f27'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('thread_reply', 'comment',
|
||||
existing_type=sa.VARCHAR(length=500),
|
||||
type_=sa.String(length=2000),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('thread_reply', 'comment',
|
||||
existing_type=sa.String(length=2000),
|
||||
type_=sa.VARCHAR(length=500),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 9e2ac631efb0
|
||||
Revises: 11b6ef362f98
|
||||
Create Date: 2018-07-06 23:16:50.507010
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9e2ac631efb0'
|
||||
down_revision = '11b6ef362f98'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('forum_topic', sa.Column('wip', sa.Boolean(), nullable=False, server_default="0"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('forum_topic', 'wip')
|
||||
# ### end Alembic commands ###
|
|
@ -1,27 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 9ec17b558413
|
||||
Revises: 97a9c461bc2d
|
||||
Create Date: 2019-01-29 00:37:49.507631
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9ec17b558413'
|
||||
down_revision = '97a9c461bc2d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package_release', sa.Column('downloads', sa.Integer(), nullable=False, server_default="0"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package_release', 'downloads')
|
||||
# ### end Alembic commands ###
|
|
@ -1,55 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 9fc23495713b
|
||||
Revises: de004661c5e1
|
||||
Create Date: 2018-07-04 00:03:20.123285
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9fc23495713b'
|
||||
down_revision = 'de004661c5e1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
|
||||
type_enum = ENUM('TOOL', 'GAME', 'ASSETPACK', name='packagetype', create_type=False)
|
||||
|
||||
def upgrade():
|
||||
type_enum.create(op.get_bind(), checkfirst=True)
|
||||
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('krock_forum_topic')
|
||||
op.create_table('forum_topic',
|
||||
sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('type', type_enum, nullable=True),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('name', sa.String(length=30), nullable=True),
|
||||
sa.Column('link', sa.String(length=200), nullable=True),
|
||||
sa.Column('posts', sa.Integer(), nullable=False),
|
||||
sa.Column('views', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('topic_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('forum_topic')
|
||||
op.create_table('krock_forum_topic',
|
||||
sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('ttype', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('name', sa.String(length=30), nullable=True),
|
||||
sa.Column('link', sa.String(length=50), nullable=True),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('topic_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
|
@ -1,30 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: a0f6c8743362
|
||||
Revises: 64fee8e5ab34
|
||||
Create Date: 2020-01-19 19:12:39.402679
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a0f6c8743362'
|
||||
down_revision = '64fee8e5ab34'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text("''::character varying"),
|
||||
server_default='')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("''::character varying"))
|
|
@ -1,32 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: a337bcc165c0
|
||||
Revises: f565dde93553
|
||||
Create Date: 2021-01-29 21:30:37.277197
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a337bcc165c0'
|
||||
down_revision = 'f565dde93553'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package_update_config', sa.Column('outdated_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('package_update_config', sa.Column('last_tag', sa.String(length=41), nullable=True))
|
||||
op.drop_column('package_update_config', 'outdated')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package_update_config', sa.Column('outdated', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False))
|
||||
op.drop_column('package_update_config', 'outdated_at')
|
||||
op.drop_column('package_update_config', 'last_tag')
|
||||
# ### end Alembic commands ###
|
|
@ -1,23 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: a791b9b74a4c
|
||||
Revises: 44e138485931
|
||||
Create Date: 2018-12-23 23:52:02.010281
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a791b9b74a4c'
|
||||
down_revision = '44e138485931'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('forum_topic', sa.Column('discarded', sa.Boolean(), server_default='0', nullable=True))
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('forum_topic', 'discarded')
|
|
@ -1,41 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: a9c1c08bf956
|
||||
Revises: 43dc7dbf64c8
|
||||
Create Date: 2020-12-10 16:42:28.086146
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a9c1c08bf956'
|
||||
down_revision = '43dc7dbf64c8'
|
||||
branch_labels = None
|
||||
def upgrade():
|
||||
op.alter_column('api_token', 'access_token', nullable=False)
|
||||
op.alter_column('package', 'author_id', nullable=False)
|
||||
op.execute("""UPDATE package SET "state"='WIP' WHERE "state" IS NULL""")
|
||||
op.alter_column('package', 'state', nullable=False)
|
||||
op.alter_column('package_screenshot', 'package_id', nullable=False)
|
||||
op.alter_column('user', 'rank', nullable=False)
|
||||
op.alter_column('user_email_verification', 'user_id', nullable=False)
|
||||
op.alter_column('user_email_verification', 'email', nullable=False)
|
||||
op.alter_column('user_email_verification', 'token', nullable=False)
|
||||
op.execute("UPDATE notification SET created_at=NOW() WHERE created_at IS NULL")
|
||||
op.alter_column('notification', 'created_at', nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('api_token', 'access_token', nullable=True)
|
||||
op.alter_column('package', 'author_id', nullable=True)
|
||||
op.alter_column('package', 'state', nullable=True)
|
||||
op.alter_column('package_screenshot', 'package_id', nullable=True)
|
||||
op.alter_column('user', 'rank', nullable=True)
|
||||
op.alter_column('user_email_verification', 'user_id', nullable=True)
|
||||
op.alter_column('user_email_verification', 'email', nullable=True)
|
||||
op.alter_column('user_email_verification', 'token', nullable=True)
|
||||
op.alter_column('notification', 'created_at', nullable=True)
|
||||
|
||||
|
||||
|
||||
depends_on = None
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: aa6d21889d22
|
||||
Revises: b254f55eadd2
|
||||
Create Date: 2018-05-29 18:28:28.540416
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'aa6d21889d22'
|
||||
down_revision = 'b254f55eadd2'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("''"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('user', 'password',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text("''"))
|
||||
# ### end Alembic commands ###
|
|
@ -1,35 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: aa6d7b595a94
|
||||
Revises: aa6d21889d22
|
||||
Create Date: 2018-05-29 20:09:56.647358
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'aa6d7b595a94'
|
||||
down_revision = 'aa6d21889d22'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('media_license_id', sa.Integer()))
|
||||
op.execute('UPDATE package SET media_license_id=license_id')
|
||||
op.alter_column('package', 'media_license_id', nullable=False)
|
||||
op.alter_column('package', 'license_id', existing_type=sa.INTEGER(), nullable=False)
|
||||
op.create_foreign_key(None, 'package', 'license', ['media_license_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package', 'license_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=True)
|
||||
op.drop_column('package', 'media_license_id')
|
||||
# ### end Alembic commands ###
|
|
@ -1,37 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: adad68a5e370
|
||||
Revises: d0bec9e5698e
|
||||
Create Date: 2018-06-02 18:23:18.123340
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'adad68a5e370'
|
||||
down_revision = 'd0bec9e5698e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('krock_forum_topic',
|
||||
sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('author_id', sa.Integer(), nullable=False),
|
||||
sa.Column('ttype', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('name', sa.String(length=30), nullable=True),
|
||||
sa.Column('link', sa.String(length=50), nullable=True),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('topic_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('krock_forum_topic')
|
||||
# ### end Alembic commands ###
|
|
@ -1,27 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: b254f55eadd2
|
||||
Revises: 4e482c47e519
|
||||
Create Date: 2018-05-27 23:51:11.008936
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b254f55eadd2'
|
||||
down_revision = '4e482c47e519'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("ALTER TYPE userrank ADD VALUE 'TRUSTED_MEMBER'")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
|
@ -1,56 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: b370c3eb4227
|
||||
Revises: c5e4213721dd
|
||||
Create Date: 2020-07-17 19:22:15.267179
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from app.models import ContentWarning
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b370c3eb4227'
|
||||
down_revision = 'c5e4213721dd'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('content_warning',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('description', sa.String(length=500), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('content_warnings',
|
||||
sa.Column('content_warning_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['content_warning_id'], ['content_warning.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('content_warning_id', 'package_id')
|
||||
)
|
||||
|
||||
bind = op.get_bind()
|
||||
session = orm.Session(bind=bind)
|
||||
|
||||
session.add(ContentWarning("Violence", "Non-cartoon violence"))
|
||||
session.add(ContentWarning("Drugs", "Drugs or alcohol"))
|
||||
session.add(ContentWarning("Bad Language"))
|
||||
session.add(ContentWarning("Gambling"))
|
||||
session.add(ContentWarning("Horror"))
|
||||
session.commit()
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('content_warnings')
|
||||
op.drop_table('content_warning')
|
||||
# ### end Alembic commands ###
|
|
@ -1,36 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: b3c7ff6655af
|
||||
Revises: dff4b87e4a76
|
||||
Create Date: 2020-09-16 14:35:43.805422
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b3c7ff6655af'
|
||||
down_revision = 'dff4b87e4a76'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
status = postgresql.ENUM('WIP', 'CHANGES_NEEDED', 'READY_FOR_REVIEW', 'APPROVED', 'DELETED', name='packagestate')
|
||||
status.create(op.get_bind())
|
||||
|
||||
op.add_column('package', sa.Column('state', sa.Enum('WIP', 'CHANGES_NEEDED', 'READY_FOR_REVIEW', 'APPROVED', 'DELETED', name='packagestate'), nullable=True))
|
||||
op.execute("UPDATE package SET state='APPROVED' WHERE approved=true")
|
||||
op.execute("UPDATE package SET state='DELETED' WHERE soft_deleted=true")
|
||||
op.drop_column('package', 'approved')
|
||||
op.drop_column('package', 'soft_deleted')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('soft_deleted', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False))
|
||||
op.add_column('package', sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.drop_column('package', 'state')
|
||||
# ### end Alembic commands ###
|
|
@ -1,47 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ba730ce1dc3e
|
||||
Revises: 8679442b8dde
|
||||
Create Date: 2020-07-11 00:59:13.519267
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ba730ce1dc3e'
|
||||
down_revision = '8679442b8dde'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('audit_log_entry',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('causer_id', sa.Integer(), nullable=False),
|
||||
sa.Column('severity', sa.Enum('NORMAL', 'EDITOR', 'MODERATION', name='auditseverity'), nullable=False),
|
||||
sa.Column('title', sa.String(length=100), nullable=False),
|
||||
sa.Column('url', sa.String(length=200), nullable=True),
|
||||
sa.Column('package_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['causer_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.alter_column('thread', 'private',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text('false'))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('thread', 'private',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text('false'))
|
||||
op.drop_table('audit_log_entry')
|
||||
# ### end Alembic commands ###
|
|
@ -1,25 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c141a63b2487
|
||||
Revises: cb6ab141c522
|
||||
Create Date: 2020-07-09 00:05:39.845465
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c141a63b2487'
|
||||
down_revision = 'cb6ab141c522'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package', sa.Column('downloads', sa.Integer(), nullable=False, server_default="0"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'downloads')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c154912eaa0c
|
||||
Revises: 7f166b5218d7
|
||||
Create Date: 2020-12-05 02:29:16.706564
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c154912eaa0c'
|
||||
down_revision = '7f166b5218d7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("COMMIT")
|
||||
op.execute("ALTER TYPE auditseverity ADD VALUE 'USER'")
|
||||
|
||||
def downgrade():
|
||||
pass
|
|
@ -1,49 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c1ea65e2b492
|
||||
Revises: e1bf78a597a2
|
||||
Create Date: 2020-12-09 18:34:13.345064
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c1ea65e2b492'
|
||||
down_revision = 'e1bf78a597a2'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('edit_request_change')
|
||||
op.drop_table('edit_request')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('edit_request',
|
||||
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('edit_request_id_seq'::regclass)"), autoincrement=True, nullable=False),
|
||||
sa.Column('package_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('author_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('title', sa.VARCHAR(length=100), autoincrement=False, nullable=False),
|
||||
sa.Column('desc', sa.VARCHAR(length=1000), autoincrement=False, nullable=True),
|
||||
sa.Column('status', sa.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['author_id'], ['user.id'], name='edit_request_author_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], name='edit_request_package_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='edit_request_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('edit_request_change',
|
||||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
||||
sa.Column('request_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('key', postgresql.ENUM('name', 'title', 'shortDesc', 'desc', 'type', 'license', 'tags', 'repo', 'website', 'issueTracker', 'forums', 'harddeps', 'softdeps', name='packagepropertykey'), autoincrement=False, nullable=False),
|
||||
sa.Column('oldValue', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('newValue', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['edit_request.id'], name='edit_request_change_request_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='edit_request_change_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c4152f4240ed
|
||||
Revises: 3f4d7cd8401f
|
||||
Create Date: 2018-05-25 18:27:16.953305
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c4152f4240ed'
|
||||
down_revision = '3f4d7cd8401f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('soft_deleted', sa.Boolean(), nullable=False, server_default="false"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'soft_deleted')
|
||||
# ### end Alembic commands ###
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c5e4213721dd
|
||||
Revises: 9832944cd1e4
|
||||
Create Date: 2020-07-15 17:54:33.738132
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c5e4213721dd'
|
||||
down_revision = '9832944cd1e4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('tag', sa.Column('views', sa.Integer(), nullable=False, server_default="0"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('tag', 'views')
|
|
@ -1,42 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: cb6ab141c522
|
||||
Revises: 7a48dbd05780
|
||||
Create Date: 2020-07-08 21:03:51.856561
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import orm
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cb6ab141c522'
|
||||
down_revision = '7a48dbd05780'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('maintainers',
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('user_id', 'package_id')
|
||||
)
|
||||
|
||||
bind = op.get_bind()
|
||||
session = orm.Session(bind=bind)
|
||||
|
||||
op.execute('INSERT INTO maintainers (package_id, user_id) SELECT id, author_id FROM package;')
|
||||
|
||||
session.commit()
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('maintainers')
|
||||
# ### end Alembic commands ###
|
|
@ -1,38 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: cd5ab8a01f4a
|
||||
Revises: 1af840af0209
|
||||
Create Date: 2021-08-18 20:47:54.268263
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cd5ab8a01f4a'
|
||||
down_revision = '1af840af0209'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('package_review_vote',
|
||||
sa.Column('review_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('is_positive', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['review_id'], ['package_review.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('review_id', 'user_id')
|
||||
)
|
||||
op.add_column('package_review', sa.Column('score', sa.Integer(), nullable=False, server_default="1"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package_review', 'score')
|
||||
op.drop_table('package_review_vote')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: d0bec9e5698e
|
||||
Revises: aa6d7b595a94
|
||||
Create Date: 2018-05-29 21:23:43.847738
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd0bec9e5698e'
|
||||
down_revision = 'aa6d7b595a94'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('license', sa.Column('is_foss', sa.Boolean(), nullable=False, server_default="true"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('license', 'is_foss')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: d4262fb15b37
|
||||
Revises: 8ee3cf3fb312
|
||||
Create Date: 2021-07-22 10:59:03.217264
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd4262fb15b37'
|
||||
down_revision = '8ee3cf3fb312'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('tag', sa.Column('is_protected', sa.Boolean(), nullable=False, server_default="false"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('tag', 'is_protected')
|
||||
# ### end Alembic commands ###
|
|
@ -1,29 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: d6ae9682c45f
|
||||
Revises: 7ff57806ffd5
|
||||
Create Date: 2019-07-01 23:27:42.666877
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd6ae9682c45f'
|
||||
down_revision = '7ff57806ffd5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('user', sa.Column('donate_url', sa.String(length=255), nullable=True))
|
||||
op.add_column('user', sa.Column('website_url', sa.String(length=255), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('user', 'website_url')
|
||||
op.drop_column('user', 'donate_url')
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: dce69ad1e4eb
|
||||
Revises: a791b9b74a4c
|
||||
Create Date: 2018-12-25 18:57:44.575501
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dce69ad1e4eb'
|
||||
down_revision = 'a791b9b74a4c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column("user", sa.Column('profile_pic', sa.String(length=255), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column("user", "profile_pic")
|
||||
# ### end Alembic commands ###
|
|
@ -1,31 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: dd27f1311a90
|
||||
Revises: c141a63b2487
|
||||
Create Date: 2020-07-09 00:20:39.501355
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dd27f1311a90'
|
||||
down_revision = 'c141a63b2487'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('score_downloads', sa.Float(), nullable=False, server_default="0"))
|
||||
op.execute("""
|
||||
UPDATE "package" SET "score_downloads"="score";
|
||||
""")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'score_downloads')
|
||||
# ### end Alembic commands ###
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: de004661c5e1
|
||||
Revises: 605b3d74ada1
|
||||
Create Date: 2018-06-11 23:38:38.611039
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'de004661c5e1'
|
||||
down_revision = '605b3d74ada1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('watchers',
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('thread_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('user_id', 'thread_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('watchers')
|
||||
# ### end Alembic commands ###
|
|
@ -1,25 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: df66c78e6791
|
||||
Revises: a0f6c8743362
|
||||
Create Date: 2020-01-24 18:39:58.363417
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'df66c78e6791'
|
||||
down_revision = 'a0f6c8743362'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('api_token', sa.Column('package_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'api_token', 'package', ['package_id'], ['id'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint(None, 'api_token', type_='foreignkey')
|
||||
op.drop_column('api_token', 'package_id')
|
|
@ -1,31 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: dff4b87e4a76
|
||||
Revises: 3a24fc02365e
|
||||
Create Date: 2020-07-17 23:47:51.096874
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dff4b87e4a76'
|
||||
down_revision = '3a24fc02365e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('package', sa.Column('approved_at', sa.DateTime(), nullable=True, server_default=None))
|
||||
|
||||
op.execute("""
|
||||
UPDATE package SET approved_at=created_at WHERE approved;
|
||||
""")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('package', 'approved_at')
|
||||
# ### end Alembic commands ###
|
|
@ -1,26 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: e1bf78a597a2
|
||||
Revises: 06d23947e7ef
|
||||
Create Date: 2020-12-06 03:16:59.988464
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e1bf78a597a2'
|
||||
down_revision = '06d23947e7ef'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package_screenshot', sa.Column('order', sa.Integer(), nullable=True))
|
||||
op.execute("""UPDATE package_screenshot SET "order" = id""")
|
||||
op.alter_column('package_screenshot', 'order', nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package_screenshot', 'order')
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: e571b3498f9e
|
||||
Revises: 3710e5fbbe87
|
||||
Create Date: 2022-02-01 19:30:59.537512
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e571b3498f9e'
|
||||
down_revision = '3710e5fbbe87'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('package_game_support',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('package_id', sa.Integer(), nullable=False),
|
||||
sa.Column('game_id', sa.Integer(), nullable=False),
|
||||
sa.Column('supports', sa.Boolean(), nullable=False),
|
||||
sa.Column('confidence', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['game_id'], ['package.id'], ),
|
||||
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('game_id', 'package_id', name='_package_game_support_uc')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('package_game_support')
|
|
@ -1,24 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: e82c2141fae3
|
||||
Revises: 96811eb565c1
|
||||
Create Date: 2021-02-02 17:25:04.070483
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e82c2141fae3'
|
||||
down_revision = '96811eb565c1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('package_screenshot', sa.Column('created_at', sa.DateTime(), nullable=False, server_default="now()"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('package_screenshot', 'created_at')
|
|
@ -1,34 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: e9f534df23a8
|
||||
Revises: adad68a5e370
|
||||
Create Date: 2018-06-02 18:30:54.234366
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e9f534df23a8'
|
||||
down_revision = 'adad68a5e370'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('krock_forum_topic', 'link',
|
||||
existing_type=sa.VARCHAR(length=50),
|
||||
type_=sa.String(length=200),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package_release', 'link',
|
||||
existing_type=sa.String(length=200),
|
||||
type_=sa.VARCHAR(length=50),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
|
@ -1,27 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ea5a023711e0
|
||||
Revises: fa12fadbdb40
|
||||
Create Date: 2018-05-26 01:55:09.745881
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ea5a023711e0'
|
||||
down_revision = 'fa12fadbdb40'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("ALTER TYPE userrank ADD VALUE 'BANNED'")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ead35f7d446c
|
||||
Revises: 81e0eb07a3cd
|
||||
Create Date: 2018-05-23 19:39:29.216273
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ead35f7d446c'
|
||||
down_revision = '81e0eb07a3cd'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package', 'forums',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('package', 'forums',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=False)
|
||||
# ### end Alembic commands ###
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue