mirror of
https://github.com/MikroWizard/mikroman.git
synced 2025-06-28 07:50:05 +02:00
MikroWizard Initial commit | MikroMan Welcome to the world :)
This commit is contained in:
commit
8c49b9a55d
96 changed files with 12274 additions and 0 deletions
29
migrations/009_authorization.py
Normal file
29
migrations/009_authorization.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# 014_authorization.py
|
||||
|
||||
def migrate(migrator, database, fake=False, **kwargs):
|
||||
|
||||
migrator.sql("""CREATE TYPE type_auth AS ENUM (
|
||||
'loggedin',
|
||||
'loggedout',
|
||||
'failed')
|
||||
""")
|
||||
|
||||
migrator.sql("""CREATE TABLE auth(
|
||||
id serial PRIMARY KEY NOT NULL,
|
||||
devid bigint REFERENCES devices(id),
|
||||
ltype type_auth,
|
||||
ip text,
|
||||
by text,
|
||||
username text,
|
||||
started bigint DEFAULT 0,
|
||||
ended bigint DEFAULT 0,
|
||||
sessionid text DEFAULT Null,
|
||||
message text DEFAULT Null,
|
||||
created timestamp not null default CURRENT_TIMESTAMP
|
||||
)""")
|
||||
|
||||
|
||||
def rollback(migrator, database, fake=False, **kwargs):
|
||||
|
||||
migrator.sql("""DROP TABLE auth""")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue