Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite has no NOW() #3

Open
luckydonald opened this issue Jan 14, 2022 · 1 comment
Open

SQLite has no NOW() #3

luckydonald opened this issue Jan 14, 2022 · 1 comment

Comments

@luckydonald
Copy link
Owner

As brought to my attention in pajowu@da292ad.

NOW() does not work in sqlite databases, which we use for local development. Since this field is not used elsewhere, I decided to simply remove it

upgraded = orm.Required(datetime, sql_default='NOW()')

@luckydonald
Copy link
Owner Author

luckydonald commented Jan 14, 2022

  • a) So maybe we should have a normal python default instead of the sql_default.
  • b) It would make sense to allow users to provide their own version_db.register_database()
    def register_database(db):
    """
    Applies the `Version` table to the given database.
    :param db: the database
    :type db: pony.orm.code.Database
    :return:
    """
    class Version(db.Entity):
    version = orm.PrimaryKey(int, auto=False)
    upgraded = orm.Required(datetime, sql_default='NOW()')
    meta = orm.Optional(orm.Json, lazy=True)
    # end class
    # end def

luckydonald referenced this issue in pajowu/pony_up Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant