uocsclub / tryoutmanager

Tool for hosting uoCSClub tryouts for csgames
0 stars 1 forks source link

Add an ORM skeleton #13

Closed scriptbae closed 6 years ago

scriptbae commented 6 years ago

SQLAlchemy implementations of models from the old Rust/Diesel implementation, with some updates made possible by SQLAlchemy's richer support for associations and Postgres semantics.

To create the database, run python3.6 csgadmin/models.py on a machine with a running Postgres instance. The database URL is sourced from a .envrc in the project root.

The .envrc is supplied along with a .gitignore in #12, but the behaviour can be mocked by injecting a valid, complete Postgres URL into your environment.

scriptbae commented 6 years ago

It does. I was waiting on your reply to my last comment before implementing FKs supporting that.

On Dec 24, 2017, at 3:42 PM, Rodger notifications@github.com wrote:

@NuclearBanane requested changes on this pull request.

Unless I'm daft, need to associate an owner with a key?

In tryoutmanager/models.py https://github.com/uocsclub/tryoutmanager/pull/13#discussion_r158609423:

+ +class User(Base):

  • tablename = 'users'
  • email = Column(String, primary_key=True)
  • password = Column(String, nullable=False)
  • name = Column(String, nullable=False)
  • created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
  • github_slug = Column(String, nullable=True)
  • public_keys = relationship('PublicKey', back_populates='user')
  • confirmed = Column(Boolean, nullable=False, default=False)
  • email_confirmation_slug = Column(String, unique=True)
  • email_confirmation_expiry = Column(DateTime(timezone=True))
  • +class PublicKey(Base): I might be missing something but doesn't this need to be associated with an owner?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uocsclub/tryoutmanager/pull/13#pullrequestreview-85448341, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoftvw9De-jy-Qv45D2P4WtpvxZV90wks5tDrc5gaJpZM4RL4NZ.

cannotparse commented 6 years ago

Just being thorough with my reviews :P