fixed small type and added new structure

This commit is contained in:
Steffen Vogel 2010-09-19 21:04:48 +02:00
parent a94e971956
commit cbdb4109c6
3 changed files with 4 additions and 4 deletions

View file

@ -65,7 +65,7 @@ abstract class Entity {
/**
* @OneToMany(targetEntity="Property", mappedBy="entity", cascade={"remove", "persist"})
* @OrderBy({"key" = "ASC"})
* @OrderBy({"`key`" = "ASC"})
*/
protected $properties = NULL;

View file

@ -36,7 +36,7 @@ use Volkszaehler\Model;
* @Table(
* name="properties",
* uniqueConstraints={
* @UniqueConstraint(name="unique_keys", columns={"entity_id", "`key` "})
* @UniqueConstraint(name="unique_keys", columns={"entity_id", "`key`"})
* }
* )
* @HasLifecycleCallbacks

View file

@ -1,9 +1,9 @@
CREATE TABLE entities (id SMALLINT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, type VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, UNIQUE INDEX entities_uuid_uniq (uuid), PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE groups_channel (group_id SMALLINT NOT NULL, channel_id SMALLINT NOT NULL, PRIMARY KEY(group_id, channel_id)) ENGINE = InnoDB;
CREATE TABLE groups_groups (parent_id SMALLINT NOT NULL, child_id SMALLINT NOT NULL, PRIMARY KEY(parent_id, child_id)) ENGINE = InnoDB;
CREATE TABLE data (id SMALLINT AUTO_INCREMENT NOT NULL, channel_id SMALLINT DEFAULT NULL, timestamp BIGINT NOT NULL, value NUMERIC(5, 2) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE data (id SMALLINT AUTO_INCREMENT NOT NULL, channel_id SMALLINT DEFAULT NULL, timestamp BIGINT NOT NULL, value NUMERIC(5, 2) NOT NULL, UNIQUE INDEX unique_timestamp (timestamp, channel_id), PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE tokens (id SMALLINT AUTO_INCREMENT NOT NULL, entity_id SMALLINT DEFAULT NULL, token VARCHAR(255) NOT NULL, valid BIGINT NOT NULL, UNIQUE INDEX tokens_token_uniq (token), PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE properties (id SMALLINT AUTO_INCREMENT NOT NULL, entity_id SMALLINT DEFAULT NULL, name VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, UNIQUE INDEX unique_properties (id, name), PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE properties (id SMALLINT AUTO_INCREMENT NOT NULL, entity_id SMALLINT DEFAULT NULL, `key` VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, UNIQUE INDEX unique_keys (entity_id, `key`), PRIMARY KEY(id)) ENGINE = InnoDB;
ALTER TABLE groups_channel ADD FOREIGN KEY (group_id) REFERENCES entities(id);
ALTER TABLE groups_channel ADD FOREIGN KEY (channel_id) REFERENCES entities(id);
ALTER TABLE groups_groups ADD FOREIGN KEY (parent_id) REFERENCES entities(id);