Initial commit – AufmaßCreater v2.35
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Pfad zum Projekt-Root hinzufügen
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app import create_app
|
||||
from app.extensions import db
|
||||
from app.models.company import Company
|
||||
|
||||
def add_house_number_column():
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
# Prüfen, ob die Spalte bereits existiert
|
||||
inspector = db.inspect(db.engine)
|
||||
columns = [c['name'] for c in inspector.get_columns('companies')]
|
||||
|
||||
if 'house_number' not in columns:
|
||||
print("Spalte 'house_number' wird hinzugefügt...")
|
||||
db.session.execute(db.text("ALTER TABLE companies ADD COLUMN house_number VARCHAR(20)"))
|
||||
db.session.commit()
|
||||
print("Spalte erfolgreich hinzugefügt.")
|
||||
else:
|
||||
print("Spalte 'house_number' existiert bereits.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
add_house_number_column()
|
||||
Reference in New Issue
Block a user