Subversion Repositories eFlore/Projets.eflore-projets

Rev

Blame | Last modification | View Log | RSS feed

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

CREATE SCHEMA IF NOT EXISTS `tb_eflore` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `tb_eflore` ;

-- -----------------------------------------------------
-- Table `tb_eflore`.`osm_noeuds`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `tb_eflore`.`osm_noeuds` ;

CREATE  TABLE IF NOT EXISTS `tb_eflore`.`osm_noeuds` (
  `id_noeud` BIGINT NOT NULL ,
  `lat` DOUBLE NOT NULL ,
  `long` DOUBLE NOT NULL ,
  PRIMARY KEY (`id_noeud`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `tb_eflore`.`osm_chemin_a_noeuds`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `tb_eflore`.`osm_chemin_a_noeuds` ;

CREATE  TABLE IF NOT EXISTS `tb_eflore`.`osm_chemin_a_noeuds` (
  `id_chemin` BIGINT NOT NULL ,
  `id_noeud` BIGINT NOT NULL ,
  `ordre` INT NOT NULL ,
  PRIMARY KEY (`id_chemin`, `id_noeud`, `ordre`) ,
  INDEX `id_noeud` (`id_noeud` ASC) ,
  INDEX `id_chemin` (`id_chemin` ASC) ,
  CONSTRAINT `avoir_noeud`
    FOREIGN KEY (`id_noeud` )
    REFERENCES `tb_eflore`.`osm_noeuds` (`id_noeud` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `tb_eflore`.`osm_commune`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `tb_eflore`.`osm_commune` ;

CREATE  TABLE IF NOT EXISTS `tb_eflore`.`osm_commune` (
  `id_relation` BIGINT NOT NULL ,
  `nom` VARCHAR(255) NULL ,
  `code_insee` VARCHAR(5) NULL ,
  `polygone` MULTIPOLYGON NULL ,
  `centre` POINT NULL ,
  `notes` TEXT NULL ,
  PRIMARY KEY (`id_relation`) ,
  INDEX `code_insee` (`code_insee` ASC) ,
  INDEX `commune_polygone` USING BTREE (`polygone` ASC, `centre` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `tb_eflore`.`osm_relation_a_chemins`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `tb_eflore`.`osm_relation_a_chemins` ;

CREATE  TABLE IF NOT EXISTS `tb_eflore`.`osm_relation_a_chemins` (
  `id_relation` BIGINT NOT NULL ,
  `id_chemin` BIGINT NOT NULL ,
  `role` VARCHAR(20) NOT NULL ,
  `ordre` INT NOT NULL ,
  `sens` VARCHAR(15) NOT NULL ,
  `nbre_poly` INT NOT NULL ,
  PRIMARY KEY (`id_relation`, `id_chemin`) ,
  INDEX `role` (`role` ASC) ,
  INDEX `sens` (`sens` ASC) ,
  INDEX `ordre` (`ordre` ASC) ,
  INDEX `nbre_poly` (`nbre_poly` ASC) ,
  CONSTRAINT `avoir_chemin_a_noeuds`
    FOREIGN KEY ()
    REFERENCES `tb_eflore`.`osm_chemin_a_noeuds` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `avoir_commune`
    FOREIGN KEY ()
    REFERENCES `tb_eflore`.`osm_commune` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

USE `tb_eflore` ;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;