25 lines
761 B
Python
Executable File
25 lines
761 B
Python
Executable File
import mariadb
|
|
from app.warehouse import get_db_connection
|
|
from flask import Flask
|
|
import os
|
|
|
|
def create_warehouse_locations_table():
|
|
conn = get_db_connection()
|
|
cursor = conn.cursor()
|
|
cursor.execute('''
|
|
CREATE TABLE IF NOT EXISTS warehouse_locations (
|
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
|
location_code VARCHAR(12) NOT NULL UNIQUE,
|
|
size INT,
|
|
description VARCHAR(250)
|
|
)
|
|
''')
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
instance_path = os.path.abspath("instance")
|
|
app = Flask(__name__, instance_path=instance_path)
|
|
with app.app_context():
|
|
create_warehouse_locations_table()
|
|
print("warehouse_locations table created or already exists.") |