Skip to content

Commit

Permalink
WebUser.id -> uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
HMnesterov committed Oct 15, 2023
1 parent 715d761 commit cd00c2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/auth/dao.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from tortoise import models, fields

class WebUser(models.Model):
id = fields.BigIntField(pk=True)
id = fields.UUIDField(pk=True)
username = fields.CharField(max_length=255, index=True, unique=True)
hashed_password = fields.CharField(max_length=255, null=False)
disabled = fields.BooleanField()
3 changes: 2 additions & 1 deletion core/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ async def on_startup():
modules={

"migrate": ["core.migrate"],
"models": ["app.telegram.mybot.dao"]
"models": ["app.telegram.mybot.dao",
"app.auth.dao"]
}
)
await migrate()
Expand Down
9 changes: 9 additions & 0 deletions core/migrations/0002__init_auth__ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS "webuser" (
"id" UUID NOT NULL PRIMARY KEY,
"username" VARCHAR(255) NOT NULL UNIQUE,
"hashed_password" VARCHAR(255) NOT NULL,
"disabled" BOOL NOT NULL
);


CREATE INDEX IF NOT EXISTS "idx_webuser_usernam_a9d232" ON "webuser" ("username");

0 comments on commit cd00c2e

Please sign in to comment.