projecteru / redis-ctl

A web application for Redis Cluster management
MIT License
127 stars 61 forks source link

missing table #24

Closed jasonjoo2010 closed 8 years ago

jasonjoo2010 commented 8 years ago

[cluster_task_creator]

this table seemed it didn't exists but there was an alter stmt in update.sql.

plz desc it so i can add it to versions.

jasonjoo2010 commented 8 years ago

and i found there's so many constraint in tables. new row cannot be inserted when adding a new redis node because no cluster_id specified.

should we use constraint? or we should remove all constraint and manage relation only by logic.

jasonjoo2010 commented 8 years ago

oh, i found the problem that the column having constraint must be nullable if you what to add a row having no child. Only redis_node.assignee_id must be nullable currently.

zheplusplus commented 8 years ago
class RedisNode(Base):
    __tablename__ = 'redis_node'

    host = db.Column(db.String(255), nullable=False)
    port = db.Column(db.Integer, nullable=False)
    eru_container_id = db.Column(db.String(64), index=True)
    assignee_id = db.Column(db.ForeignKey(Cluster.id), index=True)
    suppress_alert = db.Column(db.Integer, nullable=False, default=1)

并没有限制 assignee_idnullable=False

jasonjoo2010 commented 8 years ago

dbver中与模型定义中是两套机制, 所以当时有了不一致, 是根据sql定的. 另外缺失的那张表 cluster_task_creator 这个结构不需要加吗?

zheplusplus commented 8 years ago

不是一张表, 是索引的名字, 是在更新到 v0.9 时 update.sql 中手动添加的索引. 自动建库的话索引可能不叫这个.

update.sql:17:

CREATE INDEX `cluster_task_creator` ON `cluster_task` (`user_id`);
jasonjoo2010 commented 8 years ago

soga 我眼瓢了 那没事了, 数据结构全齐活了, 以后CI的时候自动执行dbver即可, 还可手工降级, 不过除了调试没觉得有啥必要性