rest-endpoint: init
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ psycopg2-bin ])"
|
||||
|
||||
from argparse import ArgumentParser, Action
|
||||
import os
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from dataclasses import dataclass
|
||||
import gzip
|
||||
import os
|
||||
from argparse import Action, ArgumentParser
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import psycopg2
|
||||
from psycopg2.extras import execute_values
|
||||
@@ -85,7 +85,7 @@ def insert_sessions_into_db(
|
||||
with conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS "minecraft_login_sessions"(
|
||||
CREATE TABLE IF NOT EXISTS "minecraft_login_session"(
|
||||
"username" TEXT NOT NULL,
|
||||
"start" TIMESTAMP NOT NULL,
|
||||
"duration" BIGINT NOT NULL CHECK (duration >= 0),
|
||||
@@ -96,7 +96,7 @@ def insert_sessions_into_db(
|
||||
execute_values(
|
||||
cur,
|
||||
"""
|
||||
INSERT INTO minecraft_login_sessions(username, start, duration)
|
||||
INSERT INTO minecraft_login_session(username, start, duration)
|
||||
VALUES %s
|
||||
ON CONFLICT DO NOTHING
|
||||
""",
|
||||
|
||||
Reference in New Issue
Block a user