dynamic database

This commit is contained in:
2024-10-07 22:58:17 -04:00
parent d91460fa82
commit d0641950f9
20 changed files with 2 additions and 98 deletions

View File

@@ -4,7 +4,6 @@ from datetime import datetime
class Admin_Company(db.Model): class Admin_Company(db.Model):
__tablename__ = 'admin_company' __tablename__ = 'admin_company'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -10,7 +10,6 @@ def get_uuid():
class Auth_User(UserMixin, db.Model): class Auth_User(UserMixin, db.Model):
__tablename__ = 'auth_users' __tablename__ = 'auth_users'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Auto_Temp(db.Model): class Auto_Temp(db.Model):
__tablename__ = 'auto_temp' __tablename__ = 'auto_temp'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -27,7 +26,6 @@ class Auto_Temp_schema(ma.SQLAlchemyAutoSchema):
class Auto_Delivery(db.Model): class Auto_Delivery(db.Model):
__tablename__ = 'auto_delivery' __tablename__ = 'auto_delivery'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Card_Card(db.Model): class Card_Card(db.Model):
__tablename__ = 'card_card' __tablename__ = 'card_card'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -4,7 +4,6 @@ from app import db, ma
class Company_Company(db.Model): class Company_Company(db.Model):
__tablename__ = 'company_company' __tablename__ = 'company_company'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Customer_Customer(db.Model): class Customer_Customer(db.Model):
__tablename__ = 'customer_customer' __tablename__ = 'customer_customer'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -35,7 +34,6 @@ class Customer_Customer_schema(ma.SQLAlchemyAutoSchema):
class Customer_Property(db.Model): class Customer_Property(db.Model):
__tablename__ = 'customer_property' __tablename__ = 'customer_property'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -61,7 +59,6 @@ class Customer_Property_schema(ma.SQLAlchemyAutoSchema):
class Customer_Payment_Credit(db.Model): class Customer_Payment_Credit(db.Model):
__tablename__ = 'customer_payment' __tablename__ = 'customer_payment'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -86,7 +83,6 @@ class Customer_Payment_Credit_schema(ma.SQLAlchemyAutoSchema):
class Customer_Description(db.Model): class Customer_Description(db.Model):
__tablename__ = 'customer_description' __tablename__ = 'customer_description'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Delivery_Delivery(db.Model): class Delivery_Delivery(db.Model):
__tablename__ = 'delivery_delivery' __tablename__ = 'delivery_delivery'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -91,7 +90,6 @@ class Delivery_Delivery_schema(ma.SQLAlchemyAutoSchema):
class Delivery_Notes_Driver(db.Model): class Delivery_Notes_Driver(db.Model):
__tablename__ = 'delivery_notes' __tablename__ = 'delivery_notes'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -4,7 +4,6 @@ from datetime import datetime
class Employee_Employee(db.Model): class Employee_Employee(db.Model):
__tablename__ = 'employee_employee' __tablename__ = 'employee_employee'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -34,7 +33,6 @@ class Employee_Employee_schema(ma.SQLAlchemyAutoSchema):
class Employee_Credentials(db.Model): class Employee_Credentials(db.Model):
__tablename__ = 'employee_credentials' __tablename__ = 'employee_credentials'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -54,7 +52,6 @@ class Employee_Credentials_schema(ma.SQLAlchemyAutoSchema):
class Employee_Vacation(db.Model): class Employee_Vacation(db.Model):
__tablename__ = 'employee_vacation' __tablename__ = 'employee_vacation'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -3,7 +3,6 @@ from app import db, ma
class Money_delivery(db.Model): class Money_delivery(db.Model):
__tablename__ = 'money_delivery' __tablename__ = 'money_delivery'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -35,7 +34,6 @@ class Money_delivery_schema(ma.SQLAlchemyAutoSchema):
class Pricing_Taxes(db.Model): class Pricing_Taxes(db.Model):
__tablename__ = 'pricing_taxes' __tablename__ = 'pricing_taxes'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -7,7 +7,6 @@ from datetime import datetime
class Pricing_Oil_Oil(db.Model): class Pricing_Oil_Oil(db.Model):
__tablename__ = 'pricing_oil_oil' __tablename__ = 'pricing_oil_oil'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -1,25 +0,0 @@
from app import db, ma, login_manager
from datetime import datetime
class Printer_jobs(db.Model):
__tablename__ = "printer_jobs"
id = db.Column(db.Integer,
primary_key=True,
autoincrement=True,
unique=False)
delivery_id = db.Column(db.Integer)
date_added = db.Column(db.Date(), default=datetime.utcnow())
date_completed = db.Column(db.Date(), default=datetime.utcnow())
employee_id = db.Column(db.Integer)
#0 = waiting
#1 = printing
#2 = printed
#3 = error
status = db.Column(db.Integer)

View File

@@ -6,7 +6,6 @@ from app import db, ma
class Promo_Promo(db.Model): class Promo_Promo(db.Model):
__tablename__ = 'promo_Promo' __tablename__ = 'promo_Promo'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -4,7 +4,6 @@ from app import db, ma
class Query_EmployeeTypeList(db.Model): class Query_EmployeeTypeList(db.Model):
__tablename__ = 'query_employee_type_list' __tablename__ = 'query_employee_type_list'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
value = db.Column(db.INTEGER) value = db.Column(db.INTEGER)
@@ -20,7 +19,6 @@ class Query_EmployeeTypeList_Schema(ma.SQLAlchemyAutoSchema):
class Query_StateList(db.Model): class Query_StateList(db.Model):
__tablename__ = 'query_state_list' __tablename__ = 'query_state_list'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
value = db.Column(db.INTEGER) value = db.Column(db.INTEGER)
@@ -37,7 +35,6 @@ class Query_StateList_Schema(ma.SQLAlchemyAutoSchema):
class Query_CustomerTypeList(db.Model): class Query_CustomerTypeList(db.Model):
__tablename__ = 'query_customer_type_list' __tablename__ = 'query_customer_type_list'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
value = db.Column(db.INTEGER) value = db.Column(db.INTEGER)
@@ -55,7 +52,6 @@ class Query_CustomerTypeList_Schema(ma.SQLAlchemyAutoSchema):
class Query_ServiceTypeList(db.Model): class Query_ServiceTypeList(db.Model):
__tablename__ = 'query_service_type_list' __tablename__ = 'query_service_type_list'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
value = db.Column(db.INTEGER) value = db.Column(db.INTEGER)
@@ -73,7 +69,6 @@ class Query_ServiceTypeList_Schema(ma.SQLAlchemyAutoSchema):
class Query_DeliveryStatusList(db.Model): class Query_DeliveryStatusList(db.Model):
__tablename__ = 'query_delivery_type_list' __tablename__ = 'query_delivery_type_list'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
value = db.Column(db.INTEGER) value = db.Column(db.INTEGER)

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Stats_Company(db.Model): class Stats_Company(db.Model):
__tablename__ = 'stats_company' __tablename__ = 'stats_company'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Stats_Customer(db.Model): class Stats_Customer(db.Model):
__tablename__ = 'stats_customer' __tablename__ = 'stats_customer'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -5,7 +5,6 @@ from datetime import datetime
class Stats_Employee_Oil(db.Model): class Stats_Employee_Oil(db.Model):
__tablename__ = 'stats_employee_oil' __tablename__ = 'stats_employee_oil'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,
@@ -30,7 +29,6 @@ class Stats_Employee_Oil_schema(ma.SQLAlchemyAutoSchema):
class Stats_Employee_Office(db.Model): class Stats_Employee_Office(db.Model):
__tablename__ = 'stats_employee_office' __tablename__ = 'stats_employee_office'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"} __table_args__ = {"schema": "public"}
id = db.Column(db.Integer, id = db.Column(db.Integer,

View File

@@ -1,27 +0,0 @@
from app import db, ma
from datetime import datetime
class Delivery_Payment(db.Model):
__tablename__ = 'delivery_payment'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"}
id = db.Column(db.Integer,
primary_key=True,
autoincrement=True,
unique=False)
delivery_id = db.Column(db.INTEGER)
time_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
total_amount_oil = db.Column(db.DECIMAL(6, 2))
total_amount_emergency = db.Column(db.DECIMAL(6, 2))
total_amount_prime = db.Column(db.DECIMAL(6, 2))
total_amount_fee = db.Column(db.DECIMAL(6, 2))
total_amount = db.Column(db.DECIMAL(6, 2))
class Delivery_Payment_schema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Delivery_Payment

View File

@@ -1,16 +0,0 @@
from app import db, ma
from datetime import datetime
class Pricing_Taxes(db.Model):
__tablename__ = 'taxes_pricing'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"}
id = db.Column(db.Integer,
primary_key=True,
autoincrement=True,
unique=False)
state_id = db.Column(db.Integer)
taxes_oil = db.Column(db.DECIMAL(6, 2))
taxes_other = db.Column(db.DECIMAL(6, 2))

View File

@@ -36,7 +36,7 @@ def delete_a_promo(promo_id):
""" """
get_promo_data = (db.session get_promo_data = (db.session
.query(Promo_Promo) .query(Promo_Promo)
.first(Promo_Promo.id == promo_id) .filter(Promo_Promo.id == promo_id)
.first()) .first())
db.session.delete(get_promo_data) db.session.delete(get_promo_data)

View File

@@ -10,7 +10,7 @@ class ApplicationConfig:
POSTGRES_USERNAME = 'postgres' POSTGRES_USERNAME = 'postgres'
POSTGRES_PW = 'password' POSTGRES_PW = 'password'
POSTGRES_SERVER = '192.168.1.204:5432' POSTGRES_SERVER = '192.168.1.204:5432'
POSTGRES_DBNAME00 = 'eamco' POSTGRES_DBNAME00 = 'auburnoil'
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME, SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME,
POSTGRES_PW, POSTGRES_PW,
POSTGRES_SERVER, POSTGRES_SERVER,