aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db_creation97
-rw-r--r--db_setup.py22
-rw-r--r--main.py3
3 files changed, 0 insertions, 122 deletions
diff --git a/db_creation b/db_creation
deleted file mode 100644
index 9fc44e0..0000000
--- a/db_creation
+++ /dev/null
@@ -1,97 +0,0 @@
-CREATE TABLE "companies" (
- "id" INTEGER,
- "ico" TEXT NOT NULL UNIQUE,
- "nazev" TEXT,
- "zapis" DATE,
- "sidlo" TEXT,
- "oddil" TEXT,
- "vlozka" TEXT,
- "soud" TEXT,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "insolvency_events" (
- "id" INTEGER NOT NULL UNIQUE,
- "company_id" TEXT NOT NULL,
- "insolvency_event" TEXT UNIQUE,
- FOREIGN KEY("company_id") REFERENCES "companies"("id"),
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "obce" (
- "id" INTEGER NOT NULL,
- "obec_jmeno" TEXT NOT NULL UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "obce_relation" (
- "company_id" INTEGER NOT NULL UNIQUE,
- "obec_id" INTEGER NOT NULL,
- FOREIGN KEY("obec_id") REFERENCES "obce"("id"),
- FOREIGN KEY("company_id") REFERENCES "companies"("id")
-)
-
-CREATE TABLE "osoby" (
- "id" INTEGER NOT NULL,
- "osoba_jmeno" TEXT UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "pravni_formy" (
- "id" INTEGER NOT NULL,
- "pravni_forma" TEXT NOT NULL UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "pravni_formy_relation" (
- "company_id" INTEGER NOT NULL UNIQUE,
- "pravni_forma_id" INTEGER NOT NULL,
- FOREIGN KEY("pravni_forma_id") REFERENCES "pravni_formy"("id"),
- FOREIGN KEY("company_id") REFERENCES "companies"("id")
-)
-
-CREATE TABLE sqlite_sequence(name,seq)
-
-CREATE TABLE "ulice" (
- "id" INTEGER NOT NULL,
- "ulice_jmeno" TEXT NOT NULL UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "ulice_relation" (
- "company_id" INTEGER NOT NULL UNIQUE,
- "ulice_id" INTEGER NOT NULL,
- FOREIGN KEY("company_id") REFERENCES "companies"("id"),
- FOREIGN KEY("ulice_id") REFERENCES "ulice"("id")
-)
-
-CREATE TABLE "predmety_cinnosti_relation" (
- "company_id" INTEGER NOT NULL,
- "predmet_cinnosti_id" INTEGER NOT NULL,
- "zapis_datum" DATE,
- "vymaz_datum" DATE,
- FOREIGN KEY("company_id") REFERENCES "companies"("id"),
- FOREIGN KEY("predmet_cinnosti_id") REFERENCES "predmety_cinnosti"("id")
-)
-
-CREATE TABLE "predmety_podnikani_relation" (
- "company_id" INTEGER NOT NULL,
- "predmet_podnikani_id" INTEGER NOT NULL,
- "zapis_datum" DATE,
- "vymaz_datum" DATE,
- FOREIGN KEY("company_id") REFERENCES "companies"("id"),
- FOREIGN KEY("predmet_podnikani_id") REFERENCES "predmety_podnikani"("id")
-)
-
-CREATE TABLE "predmety_cinnosti" (
- "id" INTEGER NOT NULL,
- "predmet_cinnosti" TEXT NOT NULL UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
-CREATE TABLE "predmety_podnikani" (
- "id" INTEGER NOT NULL,
- "predmet_podnikani" TEXT NOT NULL UNIQUE,
- PRIMARY KEY("id" AUTOINCREMENT)
-)
-
diff --git a/db_setup.py b/db_setup.py
deleted file mode 100644
index 24e44de..0000000
--- a/db_setup.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""
-Created on Sun Jan 17 10:00:18 2021
-
-@author: sveter
-"""
-
-from sqlalchemy import create_engine
-from sqlalchemy.orm import scoped_session, sessionmaker
-from sqlalchemy.ext.declarative import declarative_base
-
-engine = create_engine('sqlite:///justice.db', convert_unicode=True)
-db_session = scoped_session(sessionmaker(autocommit=False,
- autoflush=False,
- bind=engine))
-Base = declarative_base()
-Base.query = db_session.query_property()
-
-def init_db():
- import models
- Base.metadata.create_all(bind=engine) \ No newline at end of file
diff --git a/main.py b/main.py
index f1c38f0..87a59c8 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,4 @@
from app import app
-from db_setup import init_db, db_session
from forms import JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm
from flask import flash, render_template, request, redirect
from models import Company, Insolvency_Events, Konkurz_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association
@@ -12,8 +11,6 @@ from sqlalchemy.sql import select
from sqlalchemy.sql import text
from sqlalchemy import create_engine
-# init_db()
-
@app.route('/', methods=['GET', 'POST'])
def index():
search = JusticeSearchForm(request.form)