Skip to content

Commit

Permalink
model v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fifthaccess committed Mar 1, 2022
1 parent aa03ffe commit 9b47f4e
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# coding: utf-8
from flask_sqlalchemy import SQLAlchemy


db = SQLAlchemy()



class Kuenstler(db.Model):
__tablename__ = 'kuenstler'

KuenstlerId = db.Column(db.Integer, primary_key=True, unique=True)
Gehalt = db.Column(db.Integer)
Herkunftsland = db.Column(db.String(40))
Vorname = db.Column(db.String(40))
Nachname = db.Column(db.String(40))
ManagerId = db.Column(db.ForeignKey('manager.ManagerId'), index=True)

manager = db.relationship('Manager', primaryjoin='Kuenstler.ManagerId == Manager.ManagerId', backref='kuenstlers')



class Lied(db.Model):
__tablename__ = 'lied'

LiedId = db.Column(db.Integer, primary_key=True, unique=True)
Kuenstleranzahl = db.Column(db.Integer)
Liedname = db.Column(db.String(40))
Erscheinungsdatum = db.Column(db.Date)



class LiedKuenstler(db.Model):
__tablename__ = 'lied_kuenstler'

Id = db.Column(db.Integer, primary_key=True, unique=True)
KuenstlerId = db.Column(db.ForeignKey('kuenstler.KuenstlerId'), index=True)
LiedId = db.Column(db.ForeignKey('lied.LiedId'), index=True)

kuenstler = db.relationship('Kuenstler', primaryjoin='LiedKuenstler.KuenstlerId == Kuenstler.KuenstlerId', backref='lied_kuenstlers')
lied = db.relationship('Lied', primaryjoin='LiedKuenstler.LiedId == Lied.LiedId', backref='lied_kuenstlers')



class Manager(db.Model):
__tablename__ = 'manager'

ManagerId = db.Column(db.Integer, primary_key=True, unique=True)
Vorname = db.Column(db.String(40))
Nachname = db.Column(db.String(40))
Firma = db.Column(db.String(40))
Kuenstler_anzahl = db.Column(db.Integer)

0 comments on commit 9b47f4e

Please sign in to comment.