Say I have a model (running on MySQL):
*class Foo(DeclarativeBase):*
* __tablename__ = 'foo'*
*
*
* #column definitions*
* id = Column(u'id', CHAR(length=36), default=uuid, primary_key=True,
nullable=False)*
* date_added = Column(u'dateAdded', TIMESTAMP(), nullable=False)*
* reason = Column(u'reason', TEXT())*
The Create Table SQL being generated is:
*CREATE TABLE `foo` (*
* `id` char(36) NOT NULL,*
* `dateAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,*
* `reason` text,*
* PRIMARY KEY (`id`)*
*) ENGINE=InnoDB DEFAULT CHARSET=utf8;*
I'd like for the dateAdded column to be a dateAdded - not dateUpdated,
which would leave the Create Table SQL to look like this:
*CREATE TABLE `foo` (*
* `id` char(36) NOT NULL,*
* `dateAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,*
* `reason` text,*
* PRIMARY KEY (`id`)*
*) ENGINE=InnoDB DEFAULT CHARSET=utf8;*
*
*
Any ideas on how to do this? I keep googlin' around, but setting onupdate
or server_onupdate doesn't seem to work for me (yet...) Thanks!
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/36ZXHV5mZMIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.