forked from MasoniteFramework/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cc.py
37 lines (26 loc) · 1.06 KB
/
cc.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
"""Sandbox experimental file used to quickly feature test features of the package
"""
from src.masoniteorm.query import QueryBuilder
from src.masoniteorm.connections import MySQLConnection, PostgresConnection
from src.masoniteorm.query.grammars import MySQLGrammar, PostgresGrammar
from src.masoniteorm.models import Model
from src.masoniteorm.relationships import has_many
import inspect
# builder = QueryBuilder(connection=PostgresConnection, grammar=PostgresGrammar).table("users").on("postgres")
# print(builder.where("id", 1).or_where(lambda q: q.where('id', 2).or_where('id', 3)).get())
class User(Model):
__connection__ = "mysql"
__table__ = "users"
__dates__ = ["verified_at"]
@has_many("id", "user_id")
def articles(self):
return Article
class Article(Model):
__connection__ = "sqlite"
# user = User.create({"name": "phill", "email": "phill"})
# print(inspect.isclass(User))
user = User.first()
user.update({"verified_at": None, "updated_at": None})
print(user.first().serialize())
# print(user.serialize())
# print(User.first())