mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
port: recent items for homepage
This commit is contained in:
@@ -3,6 +3,7 @@ from typing import Any
|
||||
from sqlalchemy import (
|
||||
create_engine,
|
||||
delete,
|
||||
func,
|
||||
insert,
|
||||
select,
|
||||
)
|
||||
@@ -81,6 +82,10 @@ class Base(MappedAsDataclass, DeclarativeBase):
|
||||
def all(cls):
|
||||
return cls.execute(select(cls))
|
||||
|
||||
@classmethod
|
||||
def count(cls):
|
||||
return cls.execute(select(func.count()).select_from(cls)).scalar()
|
||||
|
||||
|
||||
def create_all():
|
||||
Base().metadata.create_all(engine)
|
||||
|
||||
Reference in New Issue
Block a user