-
Notifications
You must be signed in to change notification settings - Fork 2
/
models.py
56 lines (47 loc) · 2.06 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from app import db
from enum import unique
from sqlalchemy.sql.schema import Sequence
from sqlalchemy.sql.sqltypes import Integer
from flask_sqlalchemy import SQLAlchemy
#from app import db
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import ForeignKey, sql
import uuid
class user_info(db.Model):
__tablename__='user_info'
id = db.Column(UUID(as_uuid = True), primary_key=True, default=uuid.uuid4)
user_id = db.Column(db.String(150), unique=True, nullable=False)
user_pw = db.Column(db.String(200), nullable=False)
user_nick = db.Column(db.String(120), unique=True, nullable=False)
user_prof = db.Column(db.Text, nullable=True, default = 'https://crayon-team-j.s3.ap-northeast-2.amazonaws.com/sample_image.jpeg')
def __init__(self, user_id, user_pw, user_nick):
self.user_id=user_id
self.user_pw=user_pw
self.user_nick=user_nick
class video_info(db.Model):
__tablename__="video_info"
id = db.Column(db.Integer, autoincrement=True, primary_key=True)
category = db.Column(db.Boolean, nullable=False)
video_title = db.Column(db.String(150))
video_duration = db.Column(db.String(150))
s3_title = db.Column(db.String(150))
youtube_url = db.Column(db.String(150))
s3_video = db.Column(db.String(150))
s3_audio = db.Column(db.String(150))
def __init__(self, category, video_title, video_duration, s3_title, youtube_url, s3_video, s3_audio):
self.category = category
self.video_title = video_title
self.video_duration = video_duration
self.s3_title = s3_title
self.youtube_url = youtube_url
self.s3_video = s3_video
self.s3_audio = s3_audio
class image_info(db.Model):
__tablename__="image_info"
id = db.Column(db.Integer, autoincrement=True, primary_key=True)
video_pk = db.Column(db.Integer, ForeignKey('video_info.id'))
s3_path = db.Column(db.String(150), unique=True)
time_reccord = db.Column(db.String(150))
def __init__(self, video_pk, s3_path):
self.video_pk = video_pk
self.s3_path = s3_path